test-revert: add case where the file is marked as removed in the wc
Unlike untracked, the file is also missing from the working directory.
This test highlights a small misbehavior in output when reverting to another
revision.
--- a/tests/test-revert.t Fri Jun 27 18:08:16 2014 +0200
+++ b/tests/test-revert.t Fri Jun 27 18:09:46 2014 +0200
@@ -455,6 +455,8 @@
> 'revert': lambda cc: cc[0],
> # wc: file exist with a content different from base and parent
> 'wc': lambda cc: 'wc',
+ > # removed: file is missing and marked as untracked
+ > 'removed': lambda cc: None,
> }
>
> # build the combination of possible states
@@ -500,18 +502,23 @@
$ python gen-revert-cases.py filelist
added_clean
+ added_removed
added_revert
added_wc
clean_clean
+ clean_removed
clean_revert
clean_wc
missing_clean
+ missing_removed
missing_revert
missing_wc
modified_clean
+ modified_removed
modified_revert
modified_wc
removed_clean
+ removed_removed
removed_revert
removed_wc
@@ -541,22 +548,28 @@
$ python ../gen-revert-cases.py base
$ hg addremove --similarity 0
adding clean_clean
+ adding clean_removed
adding clean_revert
adding clean_wc
adding modified_clean
+ adding modified_removed
adding modified_revert
adding modified_wc
adding removed_clean
+ adding removed_removed
adding removed_revert
adding removed_wc
$ hg status
A clean_clean
+ A clean_removed
A clean_revert
A clean_wc
A modified_clean
+ A modified_removed
A modified_revert
A modified_wc
A removed_clean
+ A removed_removed
A removed_revert
A removed_wc
$ hg commit -m 'base'
@@ -566,12 +579,15 @@
$ python ../dircontent.py > ../content-base.txt
$ cat ../content-base.txt
base clean_clean
+ base clean_removed
base clean_revert
base clean_wc
base modified_clean
+ base modified_removed
base modified_revert
base modified_wc
base removed_clean
+ base removed_removed
base removed_revert
base removed_wc
@@ -580,19 +596,24 @@
$ python ../gen-revert-cases.py parent
$ hg addremove --similarity 0
adding added_clean
+ adding added_removed
adding added_revert
adding added_wc
removing removed_clean
+ removing removed_removed
removing removed_revert
removing removed_wc
$ hg status
M modified_clean
+ M modified_removed
M modified_revert
M modified_wc
A added_clean
+ A added_removed
A added_revert
A added_wc
R removed_clean
+ R removed_removed
R removed_revert
R removed_wc
$ hg commit -m 'parent'
@@ -602,12 +623,15 @@
$ python ../dircontent.py > ../content-parent.txt
$ cat ../content-parent.txt
parent added_clean
+ parent added_removed
parent added_revert
parent added_wc
base clean_clean
+ base clean_removed
base clean_revert
base clean_wc
parent modified_clean
+ parent modified_removed
parent modified_revert
parent modified_wc
@@ -615,8 +639,11 @@
$ python ../gen-revert-cases.py wc | cat
$ hg addremove --similarity 0
+ removing added_removed
removing added_revert
+ removing clean_removed
adding missing_wc
+ removing modified_removed
adding removed_revert
adding removed_wc
$ hg status
@@ -627,7 +654,10 @@
A missing_wc
A removed_revert
A removed_wc
+ R added_removed
R added_revert
+ R clean_removed
+ R modified_removed
$ hg status --rev 'desc("base")'
M clean_wc
@@ -637,7 +667,10 @@
A added_clean
A added_wc
A missing_wc
+ R clean_removed
+ R modified_removed
R removed_clean
+ R removed_removed
(create a simple text version of the content)
@@ -668,10 +701,13 @@
check revert output
$ hg revert --all
+ undeleting added_removed
undeleting added_revert
reverting added_wc
+ undeleting clean_removed
reverting clean_wc
forgetting missing_wc
+ undeleting modified_removed
reverting modified_revert
reverting modified_wc
forgetting removed_revert
@@ -713,12 +749,15 @@
$ hg revert --all --rev 'desc(base)'
removing added_clean
removing added_wc
+ undeleting clean_removed
reverting clean_wc
forgetting missing_wc
reverting modified_clean
+ undeleting modified_removed
reverting modified_revert
reverting modified_wc
adding removed_clean
+ adding removed_removed
reverting removed_revert
reverting removed_wc
@@ -759,6 +798,8 @@
### revert for: added_clean
no changes needed to added_clean
+ ### revert for: added_removed
+
### revert for: added_revert
### revert for: added_wc
@@ -766,6 +807,8 @@
### revert for: clean_clean
no changes needed to clean_clean
+ ### revert for: clean_removed
+
### revert for: clean_revert
no changes needed to clean_revert
@@ -774,6 +817,9 @@
### revert for: missing_clean
missing_clean: no such file in rev * (glob)
+ ### revert for: missing_removed
+ missing_removed: no such file in rev * (glob)
+
### revert for: missing_revert
missing_revert: no such file in rev * (glob)
@@ -782,6 +828,8 @@
### revert for: modified_clean
no changes needed to modified_clean
+ ### revert for: modified_removed
+
### revert for: modified_revert
### revert for: modified_wc
@@ -789,6 +837,9 @@
### revert for: removed_clean
removed_clean: no such file in rev * (glob)
+ ### revert for: removed_removed
+ removed_removed: no such file in rev * (glob)
+
### revert for: removed_revert
### revert for: removed_wc
@@ -822,6 +873,7 @@
| - clean_revert
| - modified_revert
| - removed_revert
+| - added_removed
$ for file in `python ../gen-revert-cases.py filelist`; do
> echo '### revert for:' $file;
@@ -830,12 +882,16 @@
> done
### revert for: added_clean
+ ### revert for: added_removed
+
### revert for: added_revert
### revert for: added_wc
### revert for: clean_clean
+ ### revert for: clean_removed
+
### revert for: clean_revert
### revert for: clean_wc
@@ -843,6 +899,9 @@
### revert for: missing_clean
missing_clean: no such file in rev * (glob)
+ ### revert for: missing_removed
+ missing_removed: no such file in rev * (glob)
+
### revert for: missing_revert
missing_revert: no such file in rev * (glob)
@@ -850,12 +909,16 @@
### revert for: modified_clean
+ ### revert for: modified_removed
+
### revert for: modified_revert
### revert for: modified_wc
### revert for: removed_clean
+ ### revert for: removed_removed
+
### revert for: removed_revert
### revert for: removed_wc