Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGad2aa4e85047: removeemptydirs: add test for `hg split` inside a disappearing directory
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | tests/test-removeemptydirs.t (92 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Kyle Lippincott | Jul 11 2018, 4:02 PM |
yes | yes | ||||
$ cd $TESTTMP | $ cd $TESTTMP | ||||
This is essentially the exact test from issue5826, just cleaned up a little: | This is essentially the exact test from issue5826, just cleaned up a little: | ||||
$ hg init issue5826_withrm | $ hg init issue5826_withrm | ||||
$ cd issue5826_withrm | $ cd issue5826_withrm | ||||
$ cat >> $HGRCPATH <<EOF | Let's only turn this on for this repo so that we don't contaminate later tests. | ||||
$ cat >> .hg/hgrc <<EOF | |||||
> [extensions] | > [extensions] | ||||
> histedit = | > histedit = | ||||
> EOF | > EOF | ||||
Commit three revisions that each create a directory: | Commit three revisions that each create a directory: | ||||
$ mkdir foo | $ mkdir foo | ||||
$ touch foo/bar | $ touch foo/bar | ||||
$ hg commit -qAm "add foo" | $ hg commit -qAm "add foo" | ||||
2:94e3f9fae1d6 fold-temp-revision 9992bb0ac0db | 2:94e3f9fae1d6 fold-temp-revision 9992bb0ac0db | ||||
1:5c806432464a add foo | 1:5c806432464a add foo | ||||
0:d17db4b0303a add bar | 0:d17db4b0303a add bar | ||||
Now test that again with experimental.removeemptydirs=false: | Now test that again with experimental.removeemptydirs=false: | ||||
$ hg init issue5826_norm | $ hg init issue5826_norm | ||||
$ cd issue5826_norm | $ cd issue5826_norm | ||||
$ cat >> $HGRCPATH <<EOF | Let's only turn this on for this repo so that we don't contaminate later tests. | ||||
$ cat >> .hg/hgrc <<EOF | |||||
> [extensions] | > [extensions] | ||||
> histedit = | > histedit = | ||||
> [experimental] | > [experimental] | ||||
> removeemptydirs = false | > removeemptydirs = false | ||||
> EOF | > EOF | ||||
Commit three revisions that each create a directory: | Commit three revisions that each create a directory: | ||||
$ mkdir foo | $ mkdir foo | ||||
Note the lack of a 'cd' being necessary here, and we don't need to 'histedit | Note the lack of a 'cd' being necessary here, and we don't need to 'histedit | ||||
--continue' | --continue' | ||||
$ hg log -T '{rev}:{node|short} {desc}\n' | $ hg log -T '{rev}:{node|short} {desc}\n' | ||||
1:b9eddaa97cbc add foo | 1:b9eddaa97cbc add foo | ||||
*** | *** | ||||
add baz | add baz | ||||
0:d17db4b0303a add bar | 0:d17db4b0303a add bar | ||||
$ cd $TESTTMP | |||||
Testing `hg split` being run from inside of a directory that was created in the | |||||
commit being split: | |||||
$ hg init hgsplit | |||||
$ cd hgsplit | |||||
$ cat >> .hg/hgrc << EOF | |||||
> [ui] | |||||
> interactive = 1 | |||||
> [extensions] | |||||
> split = | |||||
> EOF | |||||
$ echo anchor > anchor.txt | |||||
$ hg ci -qAm anchor | |||||
Create a changeset with '/otherfile_in_root' and 'somedir/foo', then try to | |||||
split it. | |||||
$ echo otherfile > otherfile_in_root | |||||
$ mkdir somedir | |||||
$ cd somedir | |||||
$ echo hi > foo | |||||
$ hg ci -qAm split_me | |||||
(Note: need to make this file not in this directory, or else the bug doesn't | |||||
reproduce; we're using a separate file due to concerns of portability on | |||||
`echo -e`) | |||||
$ cat > ../split_commands << EOF | |||||
> n | |||||
> y | |||||
> y | |||||
> a | |||||
> EOF | |||||
$ cat ../split_commands | hg split | |||||
current directory was removed | |||||
(consider changing to repo root: $TESTTMP/hgsplit) | |||||
diff --git a/otherfile_in_root b/otherfile_in_root | |||||
new file mode 100644 | |||||
examine changes to 'otherfile_in_root'? [Ynesfdaq?] n | |||||
diff --git a/somedir/foo b/somedir/foo | |||||
new file mode 100644 | |||||
examine changes to 'somedir/foo'? [Ynesfdaq?] y | |||||
@@ -0,0 +1,1 @@ | |||||
+hi | |||||
record change 2/2 to 'somedir/foo'? [Ynesfdaq?] y | |||||
abort: $ENOENT$ | |||||
[255] | |||||
Let's try that again without the rmdir | |||||
$ cd $TESTTMP/hgsplit/somedir | |||||
Show that the previous split didn't do anything | |||||
$ hg log -T '{rev}:{node|short} {desc}\n' | |||||
1:e26b22a4f0b7 split_me | |||||
0:7e53273730c0 anchor | |||||
$ hg status | |||||
? split_commands | |||||
Try again | |||||
$ cat ../split_commands | hg $NO_RM split | |||||
diff --git a/otherfile_in_root b/otherfile_in_root | |||||
new file mode 100644 | |||||
examine changes to 'otherfile_in_root'? [Ynesfdaq?] n | |||||
diff --git a/somedir/foo b/somedir/foo | |||||
new file mode 100644 | |||||
examine changes to 'somedir/foo'? [Ynesfdaq?] y | |||||
@@ -0,0 +1,1 @@ | |||||
+hi | |||||
record change 2/2 to 'somedir/foo'? [Ynesfdaq?] y | |||||
created new head | |||||
diff --git a/otherfile_in_root b/otherfile_in_root | |||||
new file mode 100644 | |||||
examine changes to 'otherfile_in_root'? [Ynesfdaq?] a | |||||
saved backup bundle to $TESTTMP/hgsplit/.hg/strip-backup/*-split.hg (glob) | |||||
Show that this split did something | |||||
$ hg log -T '{rev}:{node|short} {desc}\n' | |||||
2:a440f24fca4f split_me | |||||
1:c994f20276ab split_me | |||||
0:7e53273730c0 anchor | |||||
$ hg status | |||||
? split_commands |