Patchwork [05,of,11] test-revert: add case where wc content is already reverted to base content

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 12, 2014, 7:43 p.m.
Message ID <8f40ca39bd68a470926e.1407872625@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5358/
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 1403885253 -7200
#      Fri Jun 27 18:07:33 2014 +0200
# Node ID 8f40ca39bd68a470926e5088415e15c83e8b917c
# Parent  afb24257caa533fb3f0d049f00fe3d9c06e3caf0
test-revert: add case where wc content is already reverted to base content

This test highlights multiple misbehaviors of revert. We augmented the test
comment accordingly.

Patch

diff --git a/tests/test-revert.t b/tests/test-revert.t
--- a/tests/test-revert.t
+++ b/tests/test-revert.t
@@ -449,10 +449,12 @@  Write the python script to disk
   > 
   > # content of file in working copy
   > wccontent = {
   >     # clean: wc content is the same as parent
   >     'clean': lambda cc: cc[1],
+  >     # revert: wc content is the same as base
+  >     'revert': lambda cc: cc[0],
   > }
   > 
   > # build the combination of possible state
   > combination = []
   > for ctxkey in ctxcontent:
@@ -494,14 +496,19 @@  Write the python script to disk
 
 check list of planned files
 
   $ python gen-revert-cases.py filelist
   added_clean
+  added_revert
   clean_clean
+  clean_revert
   missing_clean
+  missing_revert
   modified_clean
+  modified_revert
   removed_clean
+  removed_revert
 
 Script to make a simple text version of the content
 ---------------------------------------------------
 
   $ cat << EOF >> dircontent.py
@@ -525,51 +532,73 @@  Generate appropriate repo state
 Generate base changeset
 
   $ python ../gen-revert-cases.py base
   $ hg addremove --similarity 0
   adding clean_clean
+  adding clean_revert
   adding modified_clean
+  adding modified_revert
   adding removed_clean
+  adding removed_revert
   $ hg status
   A clean_clean
+  A clean_revert
   A modified_clean
+  A modified_revert
   A removed_clean
+  A removed_revert
   $ hg commit -m 'base'
 
 (create a simple text version of the content)
 
   $ python ../dircontent.py > ../content-base.txt
   $ cat ../content-base.txt
   base   clean_clean
+  base   clean_revert
   base   modified_clean
+  base   modified_revert
   base   removed_clean
+  base   removed_revert
 
 Create parent changeset
 
   $ python ../gen-revert-cases.py parent
   $ hg addremove --similarity 0
   adding added_clean
+  adding added_revert
   removing removed_clean
+  removing removed_revert
   $ hg status
   M modified_clean
+  M modified_revert
   A added_clean
+  A added_revert
   R removed_clean
+  R removed_revert
   $ hg commit -m 'parent'
 
 (create a simple text version of the content)
 
   $ python ../dircontent.py > ../content-parent.txt
   $ cat ../content-parent.txt
   parent added_clean
+  parent added_revert
   base   clean_clean
+  base   clean_revert
   parent modified_clean
+  parent modified_revert
 
 Setup working directory
 
   $ python ../gen-revert-cases.py wc | cat
   $ hg addremove --similarity 0
+  removing added_revert
+  adding removed_revert
   $ hg status
+  M modified_revert
+  A removed_revert
+  R added_revert
 
   $ hg status --rev 'desc("base")'
   M modified_clean
   A added_clean
   R removed_clean
@@ -578,11 +607,14 @@  Setup working directory
 
   $ python ../dircontent.py > ../content-wc.txt
   $ cat ../content-wc.txt
   parent added_clean
   base   clean_clean
+  base   clean_revert
   parent modified_clean
+  base   modified_revert
+  base   removed_revert
 
   $ cd ..
 
 Test revert --all to parent content
 -----------------------------------
@@ -593,20 +625,24 @@  Test revert --all to parent content
   $ cd revert-parent-all
 
 check revert output
 
   $ hg revert --all
+  undeleting added_revert
+  reverting modified_revert
+  forgetting removed_revert
 
 Compare resulting directory with revert target.
 
 The diff is filtered to include change only. The only difference should be
 additional `.orig` backup file when applicable.
 
   $ python ../dircontent.py > ../content-parent-all.txt
   $ cd ..
   $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _
-  [1]
+  +base   modified_revert.orig
+  +base   removed_revert
 
 Test revert --all to "base" content
 -----------------------------------
 
 (setup from reference repo)
@@ -614,14 +650,23 @@  Test revert --all to "base" content
   $ cp -r revert-ref revert-base-all
   $ cd revert-base-all
 
 check revert output
 
+Misbehavior:
+
+- report "reverting" when file needs no changes
+|
+| - reverting modified_revert
+| - reverting removed_revert
+
   $ hg revert --all --rev 'desc(base)'
   removing added_clean
   reverting modified_clean
+  reverting modified_revert
   adding removed_clean
+  reverting removed_revert
 
 Compare resulting directory with revert target.
 
 The diff is filtered to include change only. The only difference should be
 additional `.orig` backup file when applicable.
@@ -648,22 +693,34 @@  revert all files individually and check 
   >   echo
   > done
   ### revert for: added_clean
   no changes needed to added_clean
   
+  ### revert for: added_revert
+  
   ### revert for: clean_clean
   no changes needed to clean_clean
   
+  ### revert for: clean_revert
+  no changes needed to clean_revert
+  
   ### revert for: missing_clean
   missing_clean: no such file in rev * (glob)
   
+  ### revert for: missing_revert
+  missing_revert: no such file in rev * (glob)
+  
   ### revert for: modified_clean
   no changes needed to modified_clean
   
+  ### revert for: modified_revert
+  
   ### revert for: removed_clean
   removed_clean: no such file in rev * (glob)
   
+  ### revert for: removed_revert
+  
 
 check resulting directory againt the --all run
 (There should be no difference)
 
   $ python ../dircontent.py > ../content-parent-explicit.txt
@@ -685,27 +742,42 @@  revert all files individually and check 
 Misbehavior:
 
 - fails to report no change to revert for
 |
 | - clean_clean
+| - added_revert
+| - clean_revert
+| - modified_revert
+| - removed_revert
 
   $ for file in `python ../gen-revert-cases.py filelist`; do
   >   echo '### revert for:' $file;
   >   hg revert $file --rev 'desc(base)';
   >   echo
   > done
   ### revert for: added_clean
   
+  ### revert for: added_revert
+  
   ### revert for: clean_clean
   
+  ### revert for: clean_revert
+  
   ### revert for: missing_clean
   missing_clean: no such file in rev * (glob)
   
+  ### revert for: missing_revert
+  missing_revert: no such file in rev * (glob)
+  
   ### revert for: modified_clean
   
+  ### revert for: modified_revert
+  
   ### revert for: removed_clean
   
+  ### revert for: removed_revert
+  
 
 check resulting directory againt the --all run
 (There should be no difference)
 
   $ python ../dircontent.py > ../content-base-explicit.txt