Patchwork [V2] tests: avoid git diffstat singular/plural output difference

login
register
mail settings
Submitter Mathias De Maré
Date Dec. 14, 2014, 8:10 p.m.
Message ID <8ca2aa5000850fd114c3.1418587818@mathias-Latitude-E6540>
Download mbox | patch
Permalink /patch/7093/
State Accepted
Delegated to: Pierre-Yves David
Headers show

Comments

Mathias De Maré - Dec. 14, 2014, 8:10 p.m.
# HG changeset patch
# User Mathias De Maré <mathias.demare@gmail.com>
# Date 1418587258 -3600
#      Son Dez 14 21:00:58 2014 +0100
# Node ID 8ca2aa5000850fd114c30d34dc6248e57634c160
# Parent  b1545533058401608b8e9eb4a6def860b56d3ca6
tests: avoid git diffstat singular/plural output difference

'git diff --stat' output changed with regard to the amount
of changes/insertions/deletions shown.
In older git versions (1.7.7.6), output was shown as:
2 files changed, 2 insertions(+), 1 deletions(-)
In newer versions, output is shown as:
2 files changed, 2 insertions(+), 1 deletion(-)

This patch uses a regex to handle both cases.
Matt Harbison - Dec. 14, 2014, 8:23 p.m.
On Sun, 14 Dec 2014 15:10:18 -0500, Mathias De Maré  
<mathias.demare@gmail.com> wrote:

> # HG changeset patch
> # User Mathias De Maré <mathias.demare@gmail.com>
> # Date 1418587258 -3600
> #      Son Dez 14 21:00:58 2014 +0100
> # Node ID 8ca2aa5000850fd114c30d34dc6248e57634c160
> # Parent  b1545533058401608b8e9eb4a6def860b56d3ca6
> tests: avoid git diffstat singular/plural output difference

This works for me.  Thanks!

--Matt
Pierre-Yves David - Dec. 14, 2014, 9:55 p.m.
On 12/14/2014 12:10 PM, Mathias De Maré wrote:
> # HG changeset patch
> # User Mathias De Maré <mathias.demare@gmail.com>
> # Date 1418587258 -3600
> #      Son Dez 14 21:00:58 2014 +0100
> # Node ID 8ca2aa5000850fd114c30d34dc6248e57634c160
> # Parent  b1545533058401608b8e9eb4a6def860b56d3ca6
> tests: avoid git diffstat singular/plural output difference
>
> 'git diff --stat' output changed with regard to the amount
> of changes/insertions/deletions shown.
> In older git versions (1.7.7.6), output was shown as:
> 2 files changed, 2 insertions(+), 1 deletions(-)
> In newer versions, output is shown as:
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> This patch uses a regex to handle both cases.

Cool, this one is pushed to the clowncopter.

> 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
> @@ -773,23 +773,22 @@ add new changes, including whitespace
>      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
>     \s*barfoo |\s*1 + (re)
>     \s*foobar |\s*2 +- (re)
> -   2 files changed, 2 insertions(+), 1 deletion(-) (no-eol)
> +   2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) \(no-eol\) (re)
>
>   ensure adding include/exclude ignores the subrepo
>     $ hg diff --subrepos -I s/foobar
>     $ hg diff --subrepos -X s/foobar
>
> -

I've dropped this spurious dropped lines.

Patch

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
@@ -773,23 +773,22 @@  add new changes, including whitespace
    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
   \s*barfoo |\s*1 + (re)
   \s*foobar |\s*2 +- (re)
-   2 files changed, 2 insertions(+), 1 deletion(-) (no-eol)
+   2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) \(no-eol\) (re)
 
 ensure adding include/exclude ignores the subrepo
   $ hg diff --subrepos -I s/foobar
   $ hg diff --subrepos -X s/foobar
 
-
 revert the subrepository
   $ hg revert --all
   reverting subrepo ../gitroot (glob)
   ../gitroot: reverting git subrepos without --no-backup is unsupported (glob)
 
   $ hg status --subrepos
   M s/foobar
   A s/barfoo