tests/test-removeemptydirs.t
author Gregory Szorc <gregory.szorc@gmail.com>
Thu, 02 Aug 2018 16:36:40 -0700
changeset 38931 eb022ce9e505
parent 38662 ad2aa4e85047
child 39479 e5449ff273d6
permissions -rw-r--r--
changegroup: inline ellipsisdata() There's only one caller of it. I don't think it needs to exist as a standalone function. Differential Revision: https://phab.mercurial-scm.org/D4074
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38497
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
     1
Tests for experimental.removeemptydirs
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
     2
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
     3
  $ NO_RM=--config=experimental.removeemptydirs=0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
     4
  $ isdir() { if [ -d $1 ]; then echo yes; else echo no; fi }
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
     5
  $ isfile() { if [ -f $1 ]; then echo yes; else echo no; fi }
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
     6
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
     7
`hg rm` of the last file in a directory:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
     8
  $ hg init hgrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
     9
  $ cd hgrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    10
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    11
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    12
  $ hg ci -qAm foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    13
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    14
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    15
  $ hg rm somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    16
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    17
  no
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    18
  $ hg revert -qa
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    19
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    20
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    21
  $ hg $NO_RM rm somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    22
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    23
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    24
  $ ls somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    25
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    26
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    27
`hg mv` of the last file in a directory:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    28
  $ hg init hgmv
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    29
  $ cd hgmv
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    30
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    31
  $ mkdir destdir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    32
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    33
  $ hg ci -qAm foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    34
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    35
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    36
  $ hg mv somedir/foo destdir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    37
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    38
  no
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    39
  $ hg revert -qa
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    40
(revert doesn't get rid of destdir/foo?)
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    41
  $ rm destdir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    42
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    43
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    44
  $ hg $NO_RM mv somedir/foo destdir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    45
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    46
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    47
  $ ls somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    48
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    49
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    50
Updating to a commit that doesn't have the directory:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    51
  $ hg init hgupdate
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    52
  $ cd hgupdate
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    53
  $ echo hi > r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    54
  $ hg ci -qAm r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    55
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    56
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    57
  $ hg ci -qAm r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    58
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    59
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    60
  $ hg co -q -r ".^"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    61
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    62
  no
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    63
  $ hg co -q tip
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    64
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    65
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    66
  $ hg $NO_RM co -q -r ".^"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    67
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    68
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    69
  $ ls somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    70
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    71
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    72
Rebasing across a commit that doesn't have the directory, from inside the
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    73
directory:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    74
  $ hg init hgrebase
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    75
  $ cd hgrebase
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    76
  $ echo hi > r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    77
  $ hg ci -qAm r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    78
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    79
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    80
  $ hg ci -qAm first_rebase_source
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    81
  $ hg $NO_RM co -q -r ".^"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    82
  $ echo hi > somedir/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    83
  $ hg ci -qAm first_rebase_dest
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    84
  $ hg $NO_RM co -q -r ".^"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    85
  $ echo hi > somedir/baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    86
  $ hg ci -qAm second_rebase_dest
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    87
  $ hg co -qr 'desc(first_rebase_source)'
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    88
  $ cd $TESTTMP/hgrebase/somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    89
  $ hg --config extensions.rebase= rebase -qr . -d 'desc(first_rebase_dest)'
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    90
  current directory was removed
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    91
  (consider changing to repo root: $TESTTMP/hgrebase)
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    92
  $ cd $TESTTMP/hgrebase/somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    93
(The current node is the rebased first_rebase_source on top of
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    94
first_rebase_dest)
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    95
This should not output anything about current directory being removed:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    96
  $ hg $NO_RM --config extensions.rebase= rebase -qr . -d 'desc(second_rebase_dest)'
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    97
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    98
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    99
Histediting across a commit that doesn't have the directory, from inside the
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   100
directory (reordering nodes):
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   101
  $ hg init hghistedit
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   102
  $ cd hghistedit
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   103
  $ echo hi > r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   104
  $ hg ci -qAm r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   105
  $ echo hi > r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   106
  $ hg ci -qAm r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   107
  $ echo hi > r2
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   108
  $ hg ci -qAm r2
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   109
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   110
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   111
  $ hg ci -qAm migrating_revision
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   112
  $ cat > histedit_commands <<EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   113
  > pick 89079fab8aee 0 r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   114
  > pick e6d271df3142 1 r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   115
  > pick 89e25aa83f0f 3 migrating_revision
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   116
  > pick b550aa12d873 2 r2
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   117
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   118
  $ cd $TESTTMP/hghistedit/somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   119
  $ hg --config extensions.histedit= histedit -q --commands ../histedit_commands
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   120
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   121
histedit doesn't output anything when the current diretory is removed. We rely
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   122
on the tests being commonly run on machines where the current directory
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   123
disappearing from underneath us actually has an observable effect, such as an
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   124
error or no files listed
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   125
#if linuxormacos
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   126
  $ isfile foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   127
  no
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   128
#endif
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   129
  $ cd $TESTTMP/hghistedit/somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   130
  $ isfile foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   131
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   132
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   133
  $ cd $TESTTMP/hghistedit
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   134
  $ cat > histedit_commands <<EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   135
  > pick 89079fab8aee 0 r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   136
  > pick 7c7a22c6009f 3 migrating_revision
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   137
  > pick e6d271df3142 1 r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   138
  > pick 40a53c2d4276 2 r2
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   139
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   140
  $ cd $TESTTMP/hghistedit/somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   141
  $ hg $NO_RM --config extensions.histedit= histedit -q --commands ../histedit_commands
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   142
Regardless of system, we should always get a 'yes' here.
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   143
  $ isfile foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   144
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   145
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   146
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   147
This is essentially the exact test from issue5826, just cleaned up a little:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   148
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   149
  $ hg init issue5826_withrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   150
  $ cd issue5826_withrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   151
38662
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   152
Let's only turn this on for this repo so that we don't contaminate later tests.
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   153
  $ cat >> .hg/hgrc <<EOF
38497
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   154
  > [extensions]
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   155
  > histedit =
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   156
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   157
Commit three revisions that each create a directory:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   158
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   159
  $ mkdir foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   160
  $ touch foo/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   161
  $ hg commit -qAm "add foo"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   162
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   163
  $ mkdir bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   164
  $ touch bar/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   165
  $ hg commit -qAm "add bar"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   166
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   167
  $ mkdir baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   168
  $ touch baz/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   169
  $ hg commit -qAm "add baz"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   170
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   171
Enter the first directory:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   172
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   173
  $ cd foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   174
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   175
Histedit doing 'pick, pick, fold':
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   176
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   177
  $ hg histedit --commands /dev/stdin <<EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   178
  > pick 6274c77c93c3 1 add bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   179
  > pick ff70a87b588f 0 add foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   180
  > fold 9992bb0ac0db 2 add baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   181
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   182
  abort: $ENOENT$
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   183
  [255]
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   184
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   185
Go back to the repo root after losing it as part of that operation:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   186
  $ cd $TESTTMP/issue5826_withrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   187
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   188
Note the lack of a non-zero exit code from this function - it exits
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   189
successfully, but doesn't really do anything.
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   190
  $ hg histedit --continue
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   191
  9992bb0ac0db: cannot fold - working copy is not a descendant of previous commit 5c806432464a
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   192
  saved backup bundle to $TESTTMP/issue5826_withrm/.hg/strip-backup/ff70a87b588f-e94f9789-histedit.hg
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   193
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   194
  $ hg log -T '{rev}:{node|short} {desc}\n'
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   195
  2:94e3f9fae1d6 fold-temp-revision 9992bb0ac0db
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   196
  1:5c806432464a add foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   197
  0:d17db4b0303a add bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   198
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   199
Now test that again with experimental.removeemptydirs=false:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   200
  $ hg init issue5826_norm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   201
  $ cd issue5826_norm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   202
38662
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   203
Let's only turn this on for this repo so that we don't contaminate later tests.
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   204
  $ cat >> .hg/hgrc <<EOF
38497
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   205
  > [extensions]
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   206
  > histedit =
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   207
  > [experimental]
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   208
  > removeemptydirs = false
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   209
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   210
Commit three revisions that each create a directory:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   211
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   212
  $ mkdir foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   213
  $ touch foo/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   214
  $ hg commit -qAm "add foo"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   215
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   216
  $ mkdir bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   217
  $ touch bar/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   218
  $ hg commit -qAm "add bar"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   219
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   220
  $ mkdir baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   221
  $ touch baz/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   222
  $ hg commit -qAm "add baz"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   223
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   224
Enter the first directory:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   225
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   226
  $ cd foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   227
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   228
Histedit doing 'pick, pick, fold':
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   229
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   230
  $ hg histedit --commands /dev/stdin <<EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   231
  > pick 6274c77c93c3 1 add bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   232
  > pick ff70a87b588f 0 add foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   233
  > fold 9992bb0ac0db 2 add baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   234
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   235
  saved backup bundle to $TESTTMP/issue5826_withrm/issue5826_norm/.hg/strip-backup/5c806432464a-cd4c8d86-histedit.hg
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   236
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   237
Note the lack of a 'cd' being necessary here, and we don't need to 'histedit
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   238
--continue'
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   239
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   240
  $ hg log -T '{rev}:{node|short} {desc}\n'
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   241
  1:b9eddaa97cbc add foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   242
  ***
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   243
  add baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   244
  0:d17db4b0303a add bar
38662
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   245
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   246
  $ cd $TESTTMP
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   247
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   248
Testing `hg split` being run from inside of a directory that was created in the
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   249
commit being split:
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   250
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   251
  $ hg init hgsplit
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   252
  $ cd hgsplit
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   253
  $ cat >> .hg/hgrc << EOF
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   254
  > [ui]
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   255
  > interactive = 1
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   256
  > [extensions]
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   257
  > split =
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   258
  > EOF
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   259
  $ echo anchor > anchor.txt
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   260
  $ hg ci -qAm anchor
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   261
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   262
Create a changeset with '/otherfile_in_root' and 'somedir/foo', then try to
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   263
split it.
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   264
  $ echo otherfile > otherfile_in_root
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   265
  $ mkdir somedir
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   266
  $ cd somedir
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   267
  $ echo hi > foo
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   268
  $ hg ci -qAm split_me
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   269
(Note: need to make this file not in this directory, or else the bug doesn't
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   270
reproduce; we're using a separate file due to concerns of portability on
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   271
`echo -e`)
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   272
  $ cat > ../split_commands << EOF
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   273
  > n
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   274
  > y
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   275
  > y
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   276
  > a
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   277
  > EOF
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   278
  $ cat ../split_commands | hg split
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   279
  current directory was removed
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   280
  (consider changing to repo root: $TESTTMP/hgsplit)
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   281
  diff --git a/otherfile_in_root b/otherfile_in_root
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   282
  new file mode 100644
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   283
  examine changes to 'otherfile_in_root'? [Ynesfdaq?] n
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   284
  
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   285
  diff --git a/somedir/foo b/somedir/foo
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   286
  new file mode 100644
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   287
  examine changes to 'somedir/foo'? [Ynesfdaq?] y
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   288
  
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   289
  @@ -0,0 +1,1 @@
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   290
  +hi
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   291
  record change 2/2 to 'somedir/foo'? [Ynesfdaq?] y
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   292
  
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   293
  abort: $ENOENT$
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   294
  [255]
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   295
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   296
Let's try that again without the rmdir
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   297
  $ cd $TESTTMP/hgsplit/somedir
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   298
Show that the previous split didn't do anything
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   299
  $ hg log -T '{rev}:{node|short} {desc}\n'
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   300
  1:e26b22a4f0b7 split_me
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   301
  0:7e53273730c0 anchor
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   302
  $ hg status
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   303
  ? split_commands
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   304
Try again
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   305
  $ cat ../split_commands | hg $NO_RM split
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   306
  diff --git a/otherfile_in_root b/otherfile_in_root
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   307
  new file mode 100644
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   308
  examine changes to 'otherfile_in_root'? [Ynesfdaq?] n
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   309
  
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   310
  diff --git a/somedir/foo b/somedir/foo
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   311
  new file mode 100644
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   312
  examine changes to 'somedir/foo'? [Ynesfdaq?] y
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   313
  
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   314
  @@ -0,0 +1,1 @@
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   315
  +hi
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   316
  record change 2/2 to 'somedir/foo'? [Ynesfdaq?] y
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   317
  
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   318
  created new head
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   319
  diff --git a/otherfile_in_root b/otherfile_in_root
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   320
  new file mode 100644
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   321
  examine changes to 'otherfile_in_root'? [Ynesfdaq?] a
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   322
  
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   323
  saved backup bundle to $TESTTMP/hgsplit/.hg/strip-backup/*-split.hg (glob)
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   324
Show that this split did something
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   325
  $ hg log -T '{rev}:{node|short} {desc}\n'
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   326
  2:a440f24fca4f split_me
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   327
  1:c994f20276ab split_me
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   328
  0:7e53273730c0 anchor
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   329
  $ hg status
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38497
diff changeset
   330
  ? split_commands