tests/test-removeemptydirs.t
author pacien <pacien.trangirard@pacien.net>
Thu, 22 Sep 2022 16:09:53 +0200
changeset 49499 4f36738a869a
parent 47980 1941064d3713
child 49592 12efb17faee2
permissions -rw-r--r--
tests: fix http-bad-server expected errors for python 3.10 (issue6643) The format of the error message changed with this version of Python. This also removes obsolete Python 3 checks.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38493
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
47980
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
     3
  $ cat >> pwd.py << EOF
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
     4
  > import os
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
     5
  > try:
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
     6
  >     print(os.getcwd())
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
     7
  > except OSError:
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
     8
  >     print("<directory is no longer accessible>")
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
     9
  > EOF
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
    10
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    11
  $ NO_RM=--config=experimental.removeemptydirs=0
47579
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
    12
  $ DO_RM=--config=experimental.removeemptydirs=1
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    13
  $ 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
    14
  $ 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
    15
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    16
`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
    17
  $ hg init hgrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    18
  $ cd hgrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    19
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    20
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    21
  $ hg ci -qAm 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
  $ hg rm somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    25
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    26
  no
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    27
  $ hg revert -qa
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    28
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    29
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    30
  $ hg $NO_RM rm somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    31
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    32
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    33
  $ ls somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    34
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    35
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    36
`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
    37
  $ hg init hgmv
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    38
  $ cd hgmv
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    39
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    40
  $ mkdir destdir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    41
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    42
  $ hg ci -qAm foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    43
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    44
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    45
  $ hg mv somedir/foo destdir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    46
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    47
  no
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    48
  $ hg revert -qa
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    49
(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
    50
  $ rm destdir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    51
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    52
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    53
  $ 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
    54
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    55
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    56
  $ ls somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    57
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    58
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    59
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
    60
  $ hg init hgupdate
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    61
  $ cd hgupdate
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    62
  $ echo hi > r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    63
  $ hg ci -qAm r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    64
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    65
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    66
  $ hg ci -qAm r1
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
  $ hg co -q -r ".^"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    70
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    71
  no
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    72
  $ hg co -q tip
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    73
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    74
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    75
  $ hg $NO_RM co -q -r ".^"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    76
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    77
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    78
  $ ls somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    79
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    80
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    81
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
    82
directory:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    83
  $ hg init hgrebase
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    84
  $ cd hgrebase
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    85
  $ echo hi > r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    86
  $ hg ci -qAm r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    87
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    88
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    89
  $ hg ci -qAm first_rebase_source
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    90
  $ hg $NO_RM co -q -r ".^"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    91
  $ echo hi > somedir/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    92
  $ hg ci -qAm first_rebase_dest
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    93
  $ hg $NO_RM co -q -r ".^"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    94
  $ echo hi > somedir/baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    95
  $ hg ci -qAm second_rebase_dest
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    96
  $ hg co -qr 'desc(first_rebase_source)'
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    97
  $ cd $TESTTMP/hgrebase/somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    98
  $ hg --config extensions.rebase= rebase -qr . -d 'desc(first_rebase_dest)'
39462
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
    99
  current directory was removed (rmcwd !)
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   100
  (consider changing to repo root: $TESTTMP/hgrebase) (rmcwd !)
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   101
  $ cd $TESTTMP/hgrebase/somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   102
(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
   103
first_rebase_dest)
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   104
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
   105
  $ 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
   106
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   107
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   108
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
   109
directory (reordering nodes):
47579
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   110
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   111
A directory with the right pass exists at the end of the run, but it is a
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   112
different directory than the current one.
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   113
47580
5f836c10ed3d test-removeemptydirs: adjust to Windows behavior for the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47579
diff changeset
   114
Windows is not affected
5f836c10ed3d test-removeemptydirs: adjust to Windows behavior for the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47579
diff changeset
   115
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   116
  $ hg init hghistedit
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   117
  $ cd hghistedit
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   118
  $ echo hi > r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   119
  $ hg ci -qAm r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   120
  $ echo hi > r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   121
  $ hg ci -qAm r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   122
  $ echo hi > r2
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   123
  $ hg ci -qAm r2
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   124
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   125
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   126
  $ hg ci -qAm migrating_revision
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   127
  $ cat > histedit_commands <<EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   128
  > pick 89079fab8aee 0 r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   129
  > pick e6d271df3142 1 r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   130
  > pick 89e25aa83f0f 3 migrating_revision
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   131
  > pick b550aa12d873 2 r2
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   132
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   133
  $ cd $TESTTMP/hghistedit/somedir
47579
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   134
  $ hg $DO_RM --config extensions.histedit= histedit -q --commands ../histedit_commands
47580
5f836c10ed3d test-removeemptydirs: adjust to Windows behavior for the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47579
diff changeset
   135
  current directory was removed (no-windows !)
5f836c10ed3d test-removeemptydirs: adjust to Windows behavior for the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47579
diff changeset
   136
  (consider changing to repo root: $TESTTMP/hghistedit) (no-windows !)
47579
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   137
  $ ls -1 $TESTTMP/hghistedit/
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   138
  histedit_commands
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   139
  r0
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   140
  r1
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   141
  r2
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   142
  somedir
47980
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
   143
#if windows
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
   144
  $ "$PYTHON" "$TESTTMP/pwd.py"
47579
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   145
  $TESTTMP/hghistedit/somedir
47980
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
   146
#else
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
   147
  $ echo ${PWD} # no-pwd-check
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
   148
  $TESTTMP/hghistedit/somedir
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
   149
  $ "$PYTHON" "$TESTTMP/pwd.py"
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
   150
  <directory is no longer accessible>
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
   151
#endif
47579
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   152
  $ ls -1 $TESTTMP/hghistedit/somedir
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   153
  foo
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   154
  $ ls -1
47580
5f836c10ed3d test-removeemptydirs: adjust to Windows behavior for the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47579
diff changeset
   155
  foo (windows !)
47579
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   156
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   157
Get out of the doomed directory
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   158
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   159
  $ cd $TESTTMP/hghistedit
47980
1941064d3713 tests: make removeemptydirs more portable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47580
diff changeset
   160
  chdir: error retrieving current directory: getcwd: cannot access parent directories: $ENOENT$ (?)
47579
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   161
  $ hg files --rev . | grep somedir/
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   162
  somedir/foo
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   163
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   164
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   165
  $ cat > histedit_commands <<EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   166
  > pick 89079fab8aee 0 r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   167
  > pick 7c7a22c6009f 3 migrating_revision
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   168
  > pick e6d271df3142 1 r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   169
  > pick 40a53c2d4276 2 r2
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   170
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   171
  $ cd $TESTTMP/hghistedit/somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   172
  $ 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
   173
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
   174
  $ isfile foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   175
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   176
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   177
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   178
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
   179
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   180
  $ hg init issue5826_withrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   181
  $ cd issue5826_withrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   182
38662
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38493
diff changeset
   183
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: 38493
diff changeset
   184
  $ cat >> .hg/hgrc <<EOF
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   185
  > [extensions]
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   186
  > histedit =
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   187
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   188
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
   189
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   190
  $ mkdir foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   191
  $ touch foo/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   192
  $ hg commit -qAm "add foo"
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
  $ mkdir bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   195
  $ touch bar/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   196
  $ hg commit -qAm "add bar"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   197
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   198
  $ mkdir baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   199
  $ touch baz/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   200
  $ hg commit -qAm "add baz"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   201
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   202
Enter the first directory:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   203
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   204
  $ cd foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   205
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   206
Histedit doing 'pick, pick, fold':
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   207
39462
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   208
#if rmcwd
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   209
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   210
  $ hg histedit --commands - <<EOF
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   211
  > pick 6274c77c93c3 1 add bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   212
  > pick ff70a87b588f 0 add foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   213
  > fold 9992bb0ac0db 2 add baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   214
  > EOF
47435
e9fbf8fd5f33 histedit: don't swallow errors that happen when updating the working copy
Martin von Zweigbergk <martinvonz@google.com>
parents: 41966
diff changeset
   215
  current directory was removed
e9fbf8fd5f33 histedit: don't swallow errors that happen when updating the working copy
Martin von Zweigbergk <martinvonz@google.com>
parents: 41966
diff changeset
   216
  (consider changing to repo root: $TESTTMP/issue5826_withrm)
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   217
  abort: $ENOENT$
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   218
  [255]
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
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
   221
  $ cd $TESTTMP/issue5826_withrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   222
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   223
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
   224
successfully, but doesn't really do anything.
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   225
  $ hg histedit --continue
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   226
  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
   227
  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
   228
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   229
  $ 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
   230
  2:94e3f9fae1d6 fold-temp-revision 9992bb0ac0db
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   231
  1:5c806432464a add foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   232
  0:d17db4b0303a add bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   233
39462
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   234
#else
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   235
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   236
  $ cd $TESTTMP/issue5826_withrm
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   237
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   238
  $ hg histedit --commands - <<EOF
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   239
  > pick 6274c77c93c3 1 add bar
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   240
  > pick ff70a87b588f 0 add foo
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   241
  > fold 9992bb0ac0db 2 add baz
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   242
  > EOF
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   243
  saved backup bundle to $TESTTMP/issue5826_withrm/.hg/strip-backup/5c806432464a-cd4c8d86-histedit.hg
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   244
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   245
  $ hg log -T '{rev}:{node|short} {desc}\n'
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   246
  1:b9eddaa97cbc add foo
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   247
  ***
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   248
  add baz
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   249
  0:d17db4b0303a add bar
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   250
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   251
#endif
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   252
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   253
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
   254
  $ hg init issue5826_norm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   255
  $ cd issue5826_norm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   256
38662
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38493
diff changeset
   257
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: 38493
diff changeset
   258
  $ cat >> .hg/hgrc <<EOF
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   259
  > [extensions]
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   260
  > histedit =
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   261
  > [experimental]
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   262
  > removeemptydirs = false
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   263
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   264
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
   265
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   266
  $ mkdir foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   267
  $ touch foo/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   268
  $ hg commit -qAm "add foo"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   269
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   270
  $ mkdir bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   271
  $ touch bar/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   272
  $ hg commit -qAm "add bar"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   273
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   274
  $ mkdir baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   275
  $ touch baz/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   276
  $ hg commit -qAm "add baz"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   277
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   278
Enter the first directory:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   279
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   280
  $ cd foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   281
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   282
Histedit doing 'pick, pick, fold':
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   283
39462
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   284
  $ hg histedit --commands - <<EOF
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   285
  > pick 6274c77c93c3 1 add bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   286
  > pick ff70a87b588f 0 add foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   287
  > fold 9992bb0ac0db 2 add baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   288
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   289
  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
   290
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   291
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
   292
--continue'
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   293
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   294
  $ 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
   295
  1:b9eddaa97cbc add foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   296
  ***
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   297
  add baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   298
  0:d17db4b0303a add bar
38662
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38493
diff changeset
   299
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38493
diff changeset
   300
  $ cd $TESTTMP