test-revert: also create a text version of the snapshot
authorPierre-Yves David <pierre-yves.david@fb.com>
Fri, 27 Jun 2014 16:08:09 +0200
changeset 22126 651b2149f1e7
parent 22125 7fce964be27d
child 22127 3163b8f8ff26
test-revert: also create a text version of the snapshot The text version is just a list of existing files with their content. We use a small custom script for that. This is going to be very useful for comparing revert results with revert target content.
tests/test-revert.t
--- a/tests/test-revert.t	Tue Aug 12 12:53:23 2014 -0500
+++ b/tests/test-revert.t	Fri Jun 27 16:08:09 2014 +0200
@@ -477,6 +477,20 @@
   >     f.close()
   > EOF
 
+Script to make a simple text version of the content
+---------------------------------------------------
+
+  $ cat << EOF >> dircontent.py
+  > # generate a simple text view of the directory for easy comparison
+  > import os
+  > files = os.listdir('.')
+  > files.sort()
+  > for filename in files:
+  >     if os.path.isdir(filename):
+  >         continue
+  >     content = open(filename).read()
+  >     print '%-6s %s' % (content.strip(), filename)
+  > EOF
 
 Generate appropriate repo state
 -------------------------------
@@ -493,6 +507,12 @@
   A modified_clean
   $ hg commit -m 'base'
 
+(create a simple text version of the content)
+
+  $ python ../dircontent.py > ../content-base.txt
+  $ cat ../content-base.txt
+  base   modified_clean
+
 Create parent changeset
 
   $ python ../gen-revert-cases.py parent
@@ -501,6 +521,12 @@
   M modified_clean
   $ hg commit -m 'parent'
 
+(create a simple text version of the content)
+
+  $ python ../dircontent.py > ../content-parent.txt
+  $ cat ../content-parent.txt
+  parent modified_clean
+
 Setup working directory
 
   $ python ../gen-revert-cases.py wc | cat
@@ -510,5 +536,11 @@
   $ hg status --rev 'desc("base")'
   M modified_clean
 
+(create a simple text version of the content)
+
+  $ python ../dircontent.py > ../content-wc.txt
+  $ cat ../content-wc.txt
+  parent modified_clean
+
   $ cd ..