Patchwork [3,of,8] test-revert: also create a text version of the snapshot

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 11, 2014, 6:39 p.m.
Message ID <1220257fd25d7dce1495.1407782389@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5345/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 11, 2014, 6:39 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1403878089 -7200
#      Fri Jun 27 16:08:09 2014 +0200
# Node ID 1220257fd25d7dce14954c2cc316a8276a5659dc
# Parent  5878ef23eb3066d139453bf444e15047ddcf2d40
test-revert: also create a text version of the snapshot

The text version just a list of existing files with their content. We use a
small custom script for that.

This is going to be very useful to compare revert result with revert target
content.

Patch

diff --git a/tests/test-revert.t b/tests/test-revert.t
--- a/tests/test-revert.t
+++ b/tests/test-revert.t
@@ -475,10 +475,24 @@  Write the python script to disk
   >     f = open(filename, 'w')
   >     f.write(data + '\n')
   >     f.close()
   > EOF
 
+Script to make a simple text version of the content
+---------------------------------------------------
+
+  $ cat << EOF >> dircontent.py
+  > # generate a simple text view of the directoty 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
 -------------------------------
 
   $ hg init revert-ref
@@ -491,24 +505,42 @@  Generate base changeset
   adding modified_clean
   $ hg status
   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
   $ hg addremove --similarity 0
   $ hg status
   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
   $ hg addremove --similarity 0
   $ hg status
 
   $ 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 ..