Patchwork [5,of,8] test-revert: add methodical revert to parent for working directory

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 11, 2014, 6:39 p.m.
Message ID <31b8bd16d1b4e1e6b02e.1407782391@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5347/
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 1403712235 -3600
#      Wed Jun 25 17:03:55 2014 +0100
# Node ID 31b8bd16d1b4e1e6b02e84979d4968d9415b92e9
# Parent  0bd30f8195ca0c6b29d5f203f47ec5ff62ece8a5
test-revert: add methodical revert to parent for working directory

Now that we can automatically generate states, we need to actually run revert on
them and check the result. While running such test we are checking multiple
elements. The output of the `hg revert` command, the resulting content of file,
and the creation of backup file.

The first practical test is using the simple case `hg revert --all`, reverting
all files to working directory parent content.

Patch

diff --git a/tests/test-revert.t b/tests/test-revert.t
--- a/tests/test-revert.t
+++ b/tests/test-revert.t
@@ -549,5 +549,26 @@  Setup working directory
   $ cat ../content-wc.txt
   parent modified_clean
 
   $ cd ..
 
+Test revert --all to parent content
+-----------------------------------
+
+(setup from reference repo)
+
+  $ cp -r revert-ref revert-parent-all
+  $ cd revert-parent-all
+
+check revert output
+
+  $ hg revert --all
+
+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]