Patchwork [11,of,11] test-revert: add case where file is tracked but deleted in working directory

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 12, 2014, 7:43 p.m.
Message ID <4cc453b17c4a04835f26.1407872631@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5366/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 12, 2014, 7:43 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1403714441 -3600
#      Wed Jun 25 17:40:41 2014 +0100
# Node ID 4cc453b17c4a04835f260e2ae965fd941bcb8be4
# Parent  4585e663cd1012a00cdcdc91666fdb6f0ad09b95
test-revert: add case where file is tracked but deleted in working directory
Matt Mackall - Aug. 13, 2014, 8:10 p.m.
On Tue, 2014-08-12 at 12:43 -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1403714441 -3600
> #      Wed Jun 25 17:40:41 2014 +0100
> # Node ID 4cc453b17c4a04835f260e2ae965fd941bcb8be4
> # Parent  4585e663cd1012a00cdcdc91666fdb6f0ad09b95
> test-revert: add case where file is tracked but deleted in working directory

Queued for default, thanks. Lots of review fatigue here, you might want
to use smaller batches.

Patch

diff --git a/tests/test-revert.t b/tests/test-revert.t
--- a/tests/test-revert.t
+++ b/tests/test-revert.t
@@ -455,10 +455,13 @@  Write the python script to disk
   >     '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,
+  >     # deleted: file is recorded as tracked but missing
+  >     #          rely on file deletion outside of this script
+  >     'deleted': lambda cc:'TOBEDELETED',
   > }
   > # untracked-X is a version of X where the file is not tracked (? unknown)
   > wccontent['untracked-clean'] = wccontent['clean']
   > wccontent['untracked-revert'] = wccontent['revert']
   > wccontent['untracked-wc'] = wccontent['wc']
@@ -504,38 +507,43 @@  Write the python script to disk
 
 check list of planned files
 
   $ python gen-revert-cases.py filelist
   added_clean
+  added_deleted
   added_removed
   added_revert
   added_untracked-clean
   added_untracked-revert
   added_untracked-wc
   added_wc
   clean_clean
+  clean_deleted
   clean_removed
   clean_revert
   clean_untracked-clean
   clean_untracked-revert
   clean_untracked-wc
   clean_wc
   missing_clean
+  missing_deleted
   missing_removed
   missing_revert
   missing_untracked-clean
   missing_untracked-revert
   missing_untracked-wc
   missing_wc
   modified_clean
+  modified_deleted
   modified_removed
   modified_revert
   modified_untracked-clean
   modified_untracked-revert
   modified_untracked-wc
   modified_wc
   removed_clean
+  removed_deleted
   removed_removed
   removed_revert
   removed_untracked-clean
   removed_untracked-revert
   removed_untracked-wc
@@ -565,46 +573,52 @@  Generate appropriate repo state
 Generate base changeset
 
   $ python ../gen-revert-cases.py base
   $ hg addremove --similarity 0
   adding clean_clean
+  adding clean_deleted
   adding clean_removed
   adding clean_revert
   adding clean_untracked-clean
   adding clean_untracked-revert
   adding clean_untracked-wc
   adding clean_wc
   adding modified_clean
+  adding modified_deleted
   adding modified_removed
   adding modified_revert
   adding modified_untracked-clean
   adding modified_untracked-revert
   adding modified_untracked-wc
   adding modified_wc
   adding removed_clean
+  adding removed_deleted
   adding removed_removed
   adding removed_revert
   adding removed_untracked-clean
   adding removed_untracked-revert
   adding removed_untracked-wc
   adding removed_wc
   $ hg status
   A clean_clean
+  A clean_deleted
   A clean_removed
   A clean_revert
   A clean_untracked-clean
   A clean_untracked-revert
   A clean_untracked-wc
   A clean_wc
   A modified_clean
+  A modified_deleted
   A modified_removed
   A modified_revert
   A modified_untracked-clean
   A modified_untracked-revert
   A modified_untracked-wc
   A modified_wc
   A removed_clean
+  A removed_deleted
   A removed_removed
   A removed_revert
   A removed_untracked-clean
   A removed_untracked-revert
   A removed_untracked-wc
@@ -614,24 +628,27 @@  Generate base changeset
 (create a simple text version of the content)
 
   $ python ../dircontent.py > ../content-base.txt
   $ cat ../content-base.txt
   base   clean_clean
+  base   clean_deleted
   base   clean_removed
   base   clean_revert
   base   clean_untracked-clean
   base   clean_untracked-revert
   base   clean_untracked-wc
   base   clean_wc
   base   modified_clean
+  base   modified_deleted
   base   modified_removed
   base   modified_revert
   base   modified_untracked-clean
   base   modified_untracked-revert
   base   modified_untracked-wc
   base   modified_wc
   base   removed_clean
+  base   removed_deleted
   base   removed_removed
   base   removed_revert
   base   removed_untracked-clean
   base   removed_untracked-revert
   base   removed_untracked-wc
@@ -640,39 +657,44 @@  Generate base changeset
 Create parent changeset
 
   $ python ../gen-revert-cases.py parent
   $ hg addremove --similarity 0
   adding added_clean
+  adding added_deleted
   adding added_removed
   adding added_revert
   adding added_untracked-clean
   adding added_untracked-revert
   adding added_untracked-wc
   adding added_wc
   removing removed_clean
+  removing removed_deleted
   removing removed_removed
   removing removed_revert
   removing removed_untracked-clean
   removing removed_untracked-revert
   removing removed_untracked-wc
   removing removed_wc
   $ hg status
   M modified_clean
+  M modified_deleted
   M modified_removed
   M modified_revert
   M modified_untracked-clean
   M modified_untracked-revert
   M modified_untracked-wc
   M modified_wc
   A added_clean
+  A added_deleted
   A added_removed
   A added_revert
   A added_untracked-clean
   A added_untracked-revert
   A added_untracked-wc
   A added_wc
   R removed_clean
+  R removed_deleted
   R removed_removed
   R removed_revert
   R removed_untracked-clean
   R removed_untracked-revert
   R removed_untracked-wc
@@ -682,24 +704,27 @@  Create parent changeset
 (create a simple text version of the content)
 
   $ python ../dircontent.py > ../content-parent.txt
   $ cat ../content-parent.txt
   parent added_clean
+  parent added_deleted
   parent added_removed
   parent added_revert
   parent added_untracked-clean
   parent added_untracked-revert
   parent added_untracked-wc
   parent added_wc
   base   clean_clean
+  base   clean_deleted
   base   clean_removed
   base   clean_revert
   base   clean_untracked-clean
   base   clean_untracked-revert
   base   clean_untracked-wc
   base   clean_wc
   parent modified_clean
+  parent modified_deleted
   parent modified_removed
   parent modified_revert
   parent modified_untracked-clean
   parent modified_untracked-revert
   parent modified_untracked-wc
@@ -711,18 +736,21 @@  Setup working directory
   $ hg addremove --similarity 0
   removing added_removed
   removing added_revert
   removing added_untracked-revert
   removing clean_removed
+  adding missing_deleted
   adding missing_untracked-wc
   adding missing_wc
   removing modified_removed
+  adding removed_deleted
   adding removed_revert
   adding removed_untracked-revert
   adding removed_untracked-wc
   adding removed_wc
   $ hg forget *untracked*
+  $ rm *deleted*
   $ hg status
   M added_wc
   M clean_wc
   M modified_revert
   M modified_wc
@@ -740,10 +768,15 @@  Setup working directory
   R clean_untracked-wc
   R modified_removed
   R modified_untracked-clean
   R modified_untracked-revert
   R modified_untracked-wc
+  ! added_deleted
+  ! clean_deleted
+  ! missing_deleted
+  ! modified_deleted
+  ! removed_deleted
   ? missing_untracked-wc
   ? removed_untracked-revert
   ? removed_untracked-wc
 
   $ hg status --rev 'desc("base")'
@@ -761,14 +794,20 @@  Setup working directory
   R modified_removed
   R modified_untracked-clean
   R modified_untracked-revert
   R modified_untracked-wc
   R removed_clean
+  R removed_deleted
   R removed_removed
   R removed_untracked-clean
   R removed_untracked-revert
   R removed_untracked-wc
+  ! added_deleted
+  ! clean_deleted
+  ! missing_deleted
+  ! modified_deleted
+  ! removed_deleted
   ? missing_untracked-wc
 
 (create a simple text version of the content)
 
   $ python ../dircontent.py > ../content-wc.txt
@@ -807,28 +846,33 @@  Test revert --all to parent content
   $ cd revert-parent-all
 
 check revert output
 
   $ hg revert --all
+  reverting added_deleted
   undeleting added_removed
   undeleting added_revert
   undeleting added_untracked-clean
   undeleting added_untracked-revert
   undeleting added_untracked-wc
   reverting added_wc
+  reverting clean_deleted
   undeleting clean_removed
   undeleting clean_untracked-clean
   undeleting clean_untracked-revert
   undeleting clean_untracked-wc
   reverting clean_wc
+  forgetting missing_deleted
   forgetting missing_wc
+  reverting modified_deleted
   undeleting modified_removed
   reverting modified_revert
   undeleting modified_untracked-clean
   undeleting modified_untracked-revert
   undeleting modified_untracked-wc
   reverting modified_wc
+  forgetting removed_deleted
   forgetting removed_revert
   forgetting removed_wc
 
 Compare resulting directory with revert target.
 
@@ -870,25 +914,30 @@  Misbehavior:
 | - reverting modified_revert
 | - reverting removed_revert
 
   $ hg revert --all --rev 'desc(base)'
   removing added_clean
+  removing added_deleted
   removing added_wc
+  reverting clean_deleted
   undeleting clean_removed
   undeleting clean_untracked-clean
   undeleting clean_untracked-revert
   undeleting clean_untracked-wc
   reverting clean_wc
+  forgetting missing_deleted
   forgetting missing_wc
   reverting modified_clean
+  reverting modified_deleted
   undeleting modified_removed
   reverting modified_revert
   undeleting modified_untracked-clean
   undeleting modified_untracked-revert
   undeleting modified_untracked-wc
   reverting modified_wc
   adding removed_clean
+  reverting removed_deleted
   adding removed_removed
   reverting removed_revert
   adding removed_untracked-clean
   adding removed_untracked-revert
   adding removed_untracked-wc
@@ -936,10 +985,12 @@  revert all files individually and check 
   >   echo
   > done
   ### revert for: added_clean
   no changes needed to added_clean
   
+  ### revert for: added_deleted
+  
   ### revert for: added_removed
   
   ### revert for: added_revert
   
   ### revert for: added_untracked-clean
@@ -951,10 +1002,12 @@  revert all files individually and check 
   ### revert for: added_wc
   
   ### revert for: clean_clean
   no changes needed to clean_clean
   
+  ### revert for: clean_deleted
+  
   ### revert for: clean_removed
   
   ### revert for: clean_revert
   no changes needed to clean_revert
   
@@ -967,10 +1020,12 @@  revert all files individually and check 
   ### revert for: clean_wc
   
   ### revert for: missing_clean
   missing_clean: no such file in rev * (glob)
   
+  ### revert for: missing_deleted
+  
   ### revert for: missing_removed
   missing_removed: no such file in rev * (glob)
   
   ### revert for: missing_revert
   missing_revert: no such file in rev * (glob)
@@ -987,10 +1042,12 @@  revert all files individually and check 
   ### revert for: missing_wc
   
   ### revert for: modified_clean
   no changes needed to modified_clean
   
+  ### revert for: modified_deleted
+  
   ### revert for: modified_removed
   
   ### revert for: modified_revert
   
   ### revert for: modified_untracked-clean
@@ -1002,10 +1059,12 @@  revert all files individually and check 
   ### revert for: modified_wc
   
   ### revert for: removed_clean
   removed_clean: no such file in rev * (glob)
   
+  ### revert for: removed_deleted
+  
   ### revert for: removed_removed
   removed_removed: no such file in rev * (glob)
   
   ### revert for: removed_revert
   
@@ -1059,10 +1118,12 @@  Misbehavior:
   >   hg revert $file --rev 'desc(base)';
   >   echo
   > done
   ### revert for: added_clean
   
+  ### revert for: added_deleted
+  
   ### revert for: added_removed
   
   ### revert for: added_revert
   
   ### revert for: added_untracked-clean
@@ -1073,10 +1134,12 @@  Misbehavior:
   
   ### revert for: added_wc
   
   ### revert for: clean_clean
   
+  ### revert for: clean_deleted
+  
   ### revert for: clean_removed
   
   ### revert for: clean_revert
   
   ### revert for: clean_untracked-clean
@@ -1088,10 +1151,12 @@  Misbehavior:
   ### revert for: clean_wc
   
   ### revert for: missing_clean
   missing_clean: no such file in rev * (glob)
   
+  ### revert for: missing_deleted
+  
   ### revert for: missing_removed
   missing_removed: no such file in rev * (glob)
   
   ### revert for: missing_revert
   missing_revert: no such file in rev * (glob)
@@ -1107,10 +1172,12 @@  Misbehavior:
   
   ### revert for: missing_wc
   
   ### revert for: modified_clean
   
+  ### revert for: modified_deleted
+  
   ### revert for: modified_removed
   
   ### revert for: modified_revert
   
   ### revert for: modified_untracked-clean
@@ -1121,10 +1188,12 @@  Misbehavior:
   
   ### revert for: modified_wc
   
   ### revert for: removed_clean
   
+  ### revert for: removed_deleted
+  
   ### revert for: removed_removed
   
   ### revert for: removed_revert
   
   ### revert for: removed_untracked-clean