changeset 23153:9ce22bdcd8bc

test-revert: reverting no change means it's clean This is the first step in a series that aims to put the state, not the state transitions, in the filenames of the files generated by the gen-revert-cases.py script. The possible state of a file in a revision and in the working copy is only whether it exists and what its content is (the tests don't care check flags). In the dirstate, the only state is whether it's tracked or not. With the new naming, the file that is currently called modified_untracked-clean now becomes content1_content2_content2-untracked, for example. By putting these states in the filename, it becomes easier to see that we're not missing or duplicating any state, and to check that the state is what we think it is. For example, the file that is currently called missing_clean becomes missing_missing_missing-tracked and it's clearer that it should be tracked. Putting the content in the filename will also make the tests of file content (e.g. "cat ../content-parent.txt") very obvious. When we put the state in the filename, the filenames clearly need to be unique. However, it turns out that some states are currently tested multiple times. The 'revert' transition in the script means to take the content from the grandparent. If the parent is the same as the grandparent, there is no change compared to the parent, which is exactly what 'clean' means. Avoid testing the same state twice.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 16 Oct 2014 23:36:40 -0700
parents b8f6d840d3ec
children 690db7415e23
files tests/test-revert.t
diffstat 1 files changed, 3 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-revert.t	Mon Nov 03 16:56:32 2014 -0600
+++ b/tests/test-revert.t	Thu Oct 16 23:36:40 2014 -0700
@@ -466,8 +466,10 @@
   > 
   > # build the combination of possible states
   > combination = []
-  > for ctxkey in ctxcontent:
+  > for ctxkey, ctxvalue in ctxcontent.iteritems():
   >     for wckey in wccontent:
+  >         if (ctxvalue[0] == ctxvalue[1] and 'revert' in wckey):
+  >             continue
   >         filename = "%s_%s" % (ctxkey, wckey)
   >         combination.append((filename, ctxkey, wckey))
   > 
@@ -517,17 +519,13 @@
   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
@@ -575,9 +573,7 @@
   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
@@ -600,9 +596,7 @@
   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
@@ -630,9 +624,7 @@
   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
@@ -714,9 +706,7 @@
   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
@@ -762,7 +752,6 @@
   R added_untracked-wc
   R clean_removed
   R clean_untracked-clean
-  R clean_untracked-revert
   R clean_untracked-wc
   R modified_removed
   R modified_untracked-clean
@@ -787,7 +776,6 @@
   A missing_wc
   R clean_removed
   R clean_untracked-clean
-  R clean_untracked-revert
   R clean_untracked-wc
   R modified_removed
   R modified_untracked-clean
@@ -815,9 +803,7 @@
   wc     added_untracked-wc
   wc     added_wc
   base   clean_clean
-  base   clean_revert
   base   clean_untracked-clean
-  base   clean_untracked-revert
   wc     clean_untracked-wc
   wc     clean_wc
   wc     missing_untracked-wc
@@ -856,7 +842,6 @@
   reverting clean_deleted
   undeleting clean_removed
   undeleting clean_untracked-clean
-  undeleting clean_untracked-revert
   undeleting clean_untracked-wc
   reverting clean_wc
   forgetting missing_deleted
@@ -912,7 +897,6 @@
   reverting clean_deleted
   undeleting clean_removed
   undeleting clean_untracked-clean
-  undeleting clean_untracked-revert
   undeleting clean_untracked-wc
   reverting clean_wc
   forgetting missing_deleted
@@ -993,13 +977,8 @@
   
   ### revert for: clean_removed
   
-  ### revert for: clean_revert
-  no changes needed to clean_revert
-  
   ### revert for: clean_untracked-clean
   
-  ### revert for: clean_untracked-revert
-  
   ### revert for: clean_untracked-wc
   
   ### revert for: clean_wc
@@ -1012,15 +991,9 @@
   ### revert for: missing_removed
   missing_removed: no such file in rev * (glob)
   
-  ### revert for: missing_revert
-  missing_revert: no such file in rev * (glob)
-  
   ### revert for: missing_untracked-clean
   missing_untracked-clean: no such file in rev * (glob)
   
-  ### revert for: missing_untracked-revert
-  missing_untracked-revert: no such file in rev * (glob)
-  
   ### revert for: missing_untracked-wc
   file not managed: missing_untracked-wc
   
@@ -1117,13 +1090,8 @@
   
   ### revert for: clean_removed
   
-  ### revert for: clean_revert
-  no changes needed to clean_revert
-  
   ### revert for: clean_untracked-clean
   
-  ### revert for: clean_untracked-revert
-  
   ### revert for: clean_untracked-wc
   
   ### revert for: clean_wc
@@ -1136,15 +1104,9 @@
   ### revert for: missing_removed
   missing_removed: no such file in rev * (glob)
   
-  ### revert for: missing_revert
-  missing_revert: no such file in rev * (glob)
-  
   ### revert for: missing_untracked-clean
   missing_untracked-clean: no such file in rev * (glob)
   
-  ### revert for: missing_untracked-revert
-  missing_untracked-revert: no such file in rev * (glob)
-  
   ### revert for: missing_untracked-wc
   file not managed: missing_untracked-wc