tests/test-removeemptydirs.t
author Matt Harbison <matt_harbison@yahoo.com>
Sun, 22 Aug 2021 17:59:21 -0400
branchstable
changeset 47866 4162f6b40f2c
parent 47580 5f836c10ed3d
child 47980 1941064d3713
permissions -rw-r--r--
windows: degrade to py2 behavior when reading a non-symlink as a symlink While waiting for the push to hg-committed in WSL to complete, I ran a `phabimport` from Windows and got this traceback: $ hg phabimport 11313 ** Unknown exception encountered with possibly-broken third-party extension "mercurial_keyring" (version N/A) ** which supports versions unknown of Mercurial. ** Please disable "mercurial_keyring" and try your action again. ** If that fixes the bug please report it to https://foss.heptapod.net/mercurial/mercurial_keyring/issues ** Python 3.9.5 (default, May 6 2021, 17:29:31) [MSC v.1928 64 bit (AMD64)] ** Mercurial Distributed SCM (version 5.9rc1+hg32.0e2f5733563d) ** Extensions loaded: absorb, blackbox, evolve 10.3.3, extdiff, fastannotate, fix, mercurial_keyring, mq, phabblocker 20210126, phabricator, rebase, show, strip, topic 0.22.3 Traceback (most recent call last): File "mercurial.lock", line 279, in _trylock File "mercurial.vfs", line 202, in makelock File "mercurial.util", line 2147, in makelock FileExistsError: [WinError 183] Cannot create a file when that file already exists: b'hp-omen:78348' -> b'C:\\Users\\Matt\\hg/.hg/store/lock' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<string>", line 24, in <module> File "mercurial.dispatch", line 144, in run File "mercurial.dispatch", line 250, in dispatch File "mercurial.dispatch", line 294, in _rundispatch File "mercurial.dispatch", line 470, in _runcatch File "mercurial.dispatch", line 480, in _callcatch File "mercurial.scmutil", line 153, in callcatch File "mercurial.dispatch", line 460, in _runcatchfunc File "mercurial.dispatch", line 1273, in _dispatch File "mercurial.dispatch", line 918, in runcommand File "mercurial.dispatch", line 1285, in _runcommand File "mercurial.dispatch", line 1271, in <lambda> File "mercurial.util", line 1886, in check File "mercurial.util", line 1886, in check File "hgext.mq", line 4239, in mqcommand File "mercurial.util", line 1886, in check File "mercurial.util", line 1886, in check File "hgext.phabricator", line 314, in inner File "hgext.phabricator", line 2222, in phabimport File "hgext.phabricator", line 2123, in readpatch File "hgext.phabricator", line 2199, in _write File "mercurial.localrepo", line 2956, in lock File "mercurial.localrepo", line 2918, in _lock File "mercurial.lock", line 152, in trylock File "mercurial.lock", line 283, in _trylock File "mercurial.lock", line 314, in _readlock File "mercurial.vfs", line 221, in readlock File "mercurial.util", line 2163, in readlock File "mercurial.windows", line 619, in readlink ValueError: not a symbolic link Both exceptions look accurate (the file exists, and the Windows side can't read WSL side symlinks). I didn't try to reproduce this entirely within the Windows side, but we can do better than a cryptic stacktrace. With this change, the same scenario results in this abort: abort: C:\Users\Matt\hg/.hg/store/lock: The file cannot be accessed by the system When both the `push` and `phabimport` are done on the Windows side, it prints a message about waiting for the lock, and successfully applies the patch after the push completes. I'm not sure if there's enough info to be able to convert the abort into the wait scenario. As it stands now, we don't support symlinks on Windows, which requires either a UAC Administrator level process or an opt-in in developer mode, and there are several places where the new symlink on Windows support in py3 was explicitly disabled in order to get tests to pass quicker. Differential Revision: https://phab.mercurial-scm.org/D11333
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
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
     3
  $ 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
     4
  $ DO_RM=--config=experimental.removeemptydirs=1
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
     5
  $ 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
     6
  $ 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
     7
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
     8
`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
     9
  $ hg init hgrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    10
  $ cd hgrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    11
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    12
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    13
  $ hg ci -qAm foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    14
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    15
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    16
  $ hg rm somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    17
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    18
  no
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    19
  $ hg revert -qa
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    20
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    21
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    22
  $ hg $NO_RM rm somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    23
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    24
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    25
  $ ls somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    26
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    27
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    28
`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
    29
  $ hg init hgmv
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    30
  $ cd hgmv
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    31
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    32
  $ mkdir destdir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    33
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    34
  $ hg ci -qAm foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    35
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    36
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    37
  $ hg mv somedir/foo destdir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    38
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    39
  no
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    40
  $ hg revert -qa
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    41
(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
    42
  $ rm destdir/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 $NO_RM 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
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    48
  $ ls somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    49
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    50
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    51
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
    52
  $ hg init hgupdate
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    53
  $ cd hgupdate
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    54
  $ echo hi > r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    55
  $ hg ci -qAm r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    56
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    57
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    58
  $ hg ci -qAm r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    59
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    60
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    61
  $ hg co -q -r ".^"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    62
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    63
  no
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    64
  $ hg co -q tip
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    65
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    66
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    67
  $ hg $NO_RM co -q -r ".^"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    68
  $ isdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    69
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    70
  $ ls somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    71
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    72
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    73
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
    74
directory:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    75
  $ hg init hgrebase
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    76
  $ cd hgrebase
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    77
  $ echo hi > r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    78
  $ hg ci -qAm r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    79
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    80
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    81
  $ hg ci -qAm first_rebase_source
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    82
  $ hg $NO_RM co -q -r ".^"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    83
  $ echo hi > somedir/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    84
  $ hg ci -qAm first_rebase_dest
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    85
  $ hg $NO_RM co -q -r ".^"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    86
  $ echo hi > somedir/baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    87
  $ hg ci -qAm second_rebase_dest
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    88
  $ hg co -qr 'desc(first_rebase_source)'
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    89
  $ cd $TESTTMP/hgrebase/somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    90
  $ 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
    91
  current directory was removed (rmcwd !)
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
    92
  (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
    93
  $ cd $TESTTMP/hgrebase/somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    94
(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
    95
first_rebase_dest)
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    96
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
    97
  $ 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
    98
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
    99
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   100
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
   101
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
   102
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   103
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
   104
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
   105
47580
5f836c10ed3d test-removeemptydirs: adjust to Windows behavior for the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47579
diff changeset
   106
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
   107
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   108
  $ hg init hghistedit
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   109
  $ cd hghistedit
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   110
  $ echo hi > r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   111
  $ hg ci -qAm r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   112
  $ echo hi > r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   113
  $ hg ci -qAm r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   114
  $ echo hi > r2
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   115
  $ hg ci -qAm r2
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   116
  $ mkdir somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   117
  $ echo hi > somedir/foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   118
  $ hg ci -qAm migrating_revision
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   119
  $ cat > histedit_commands <<EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   120
  > pick 89079fab8aee 0 r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   121
  > pick e6d271df3142 1 r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   122
  > pick 89e25aa83f0f 3 migrating_revision
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   123
  > pick b550aa12d873 2 r2
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   124
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   125
  $ 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
   126
  $ 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
   127
  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
   128
  (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
   129
  $ 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
   130
  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
   131
  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
   132
  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
   133
  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
   134
  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
   135
  $ pwd
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   136
  $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
   137
  $ 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
   138
  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
   139
  $ 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
   140
  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
   141
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
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
   143
f2846abd9e21 test-removeemptydirs: clarify the state of things in the `histedit` case
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47435
diff changeset
   144
  $ cd $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
   145
  $ 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
   146
  somedir/foo
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   147
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
  $ cat > histedit_commands <<EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   150
  > pick 89079fab8aee 0 r0
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   151
  > pick 7c7a22c6009f 3 migrating_revision
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   152
  > pick e6d271df3142 1 r1
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   153
  > pick 40a53c2d4276 2 r2
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   154
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   155
  $ cd $TESTTMP/hghistedit/somedir
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   156
  $ 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
   157
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
   158
  $ isfile foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   159
  yes
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   160
  $ cd $TESTTMP
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   161
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   162
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
   163
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   164
  $ hg init issue5826_withrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   165
  $ cd issue5826_withrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   166
38662
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38493
diff changeset
   167
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
   168
  $ cat >> .hg/hgrc <<EOF
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   169
  > [extensions]
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   170
  > histedit =
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   171
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   172
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
   173
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   174
  $ mkdir foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   175
  $ touch foo/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   176
  $ hg commit -qAm "add foo"
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
  $ mkdir bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   179
  $ touch bar/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   180
  $ hg commit -qAm "add bar"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   181
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   182
  $ mkdir baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   183
  $ touch baz/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   184
  $ hg commit -qAm "add baz"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   185
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   186
Enter the first directory:
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
  $ cd foo
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
Histedit doing 'pick, pick, fold':
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   191
39462
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   192
#if rmcwd
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   193
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   194
  $ hg histedit --commands - <<EOF
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   195
  > pick 6274c77c93c3 1 add bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   196
  > pick ff70a87b588f 0 add foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   197
  > fold 9992bb0ac0db 2 add baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   198
  > 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
   199
  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
   200
  (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
   201
  abort: $ENOENT$
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   202
  [255]
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
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
   205
  $ cd $TESTTMP/issue5826_withrm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   206
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   207
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
   208
successfully, but doesn't really do anything.
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   209
  $ hg histedit --continue
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   210
  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
   211
  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
   212
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   213
  $ 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
   214
  2:94e3f9fae1d6 fold-temp-revision 9992bb0ac0db
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   215
  1:5c806432464a add foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   216
  0:d17db4b0303a add bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   217
39462
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   218
#else
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   219
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   220
  $ cd $TESTTMP/issue5826_withrm
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   221
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   222
  $ hg histedit --commands - <<EOF
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   223
  > pick 6274c77c93c3 1 add bar
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   224
  > pick ff70a87b588f 0 add foo
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   225
  > fold 9992bb0ac0db 2 add baz
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   226
  > EOF
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   227
  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
   228
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   229
  $ 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
   230
  1:b9eddaa97cbc add foo
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   231
  ***
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   232
  add baz
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   233
  0:d17db4b0303a add bar
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   234
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   235
#endif
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   236
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   237
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
   238
  $ hg init issue5826_norm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   239
  $ cd issue5826_norm
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   240
38662
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38493
diff changeset
   241
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
   242
  $ cat >> .hg/hgrc <<EOF
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   243
  > [extensions]
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   244
  > histedit =
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   245
  > [experimental]
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   246
  > removeemptydirs = false
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   247
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   248
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
   249
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   250
  $ mkdir foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   251
  $ touch foo/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   252
  $ hg commit -qAm "add foo"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   253
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   254
  $ mkdir bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   255
  $ touch bar/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   256
  $ hg commit -qAm "add bar"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   257
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   258
  $ mkdir baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   259
  $ touch baz/bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   260
  $ hg commit -qAm "add baz"
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   261
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   262
Enter the first directory:
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   263
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   264
  $ cd foo
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
Histedit doing 'pick, pick, fold':
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   267
39462
e5449ff273d6 tests: stabilize test-removeemptydirs.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 38662
diff changeset
   268
  $ hg histedit --commands - <<EOF
38493
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   269
  > pick 6274c77c93c3 1 add bar
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   270
  > pick ff70a87b588f 0 add foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   271
  > fold 9992bb0ac0db 2 add baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   272
  > EOF
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   273
  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
   274
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   275
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
   276
--continue'
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
  $ 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
   279
  1:b9eddaa97cbc add foo
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   280
  ***
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   281
  add baz
da2a7d8354b2 unlinkpath: make empty directory removal optional (issue5901) (issue5826)
Kyle Lippincott <spectral@google.com>
parents:
diff changeset
   282
  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
   283
ad2aa4e85047 removeemptydirs: add test for `hg split` inside a disappearing directory
Kyle Lippincott <spectral@google.com>
parents: 38493
diff changeset
   284
  $ cd $TESTTMP