[PATCH] tests: allow more flexibility in git diffstat output

Mathias De Maré mathias.demare at gmail.com
Sat Dec 13 15:40:44 UTC 2014


# HG changeset patch
# User Mathias De Maré <mathias.demare at gmail.com>
# Date 1418460300 -3600
#      Sam Dez 13 09:45:00 2014 +0100
# Node ID eaf33fff7f2c31a5cc57b95898255221b0e3dc6f
# Parent  495bc1b65d25872324a0220354f048b220304bd1
tests: allow more flexibility in git diffstat output

The output of 'git diff --stat' changed in git 1.7.10 and 1.7.11.
To ensure the tests work with earlier versions of git as well,
the output is now wrapped with a whitespace regex.

diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t
--- a/tests/test-subrepo-git.t
+++ b/tests/test-subrepo-git.t
@@ -767,18 +767,21 @@ add new changes, including whitespace
   +++ b/s/foobar
   @@ -1,4 +1,4 @@
   -woopwoop
   +woop    woop
    
    foo
    bar (no-eol)
 
+execute a diffstat
+the output contains a regex, because git 1.7.10 and 1.7.11
+ change the amount of whitespace
   $ hg diff --subrepos --stat
-  barfoo | 1 +
-   foobar | 2 +-
+  \s*barfoo |\s*1 + (re)
+  \s*foobar |\s*2 +- (re)
    2 files changed, 2 insertions(+), 1 deletion(-) (no-eol)
 
 ensure adding include/exclude ignores the subrepo
   $ hg diff --subrepos -I s/foobar
   $ hg diff --subrepos -X s/foobar
 
   $ cd ..


More information about the Mercurial-devel mailing list