Patchwork [1,of,3,stable] tests: use egrep with regular expression branches for compatibility

login
register
mail settings
Submitter Danek Duvall
Date July 20, 2015, 10:46 p.m.
Message ID <2f68e10b2e83f5fe5006.1437432410@smelly.us.oracle.com>
Download mbox | patch
Permalink /patch/10046/
State Accepted
Commit 11ab8714f52982cfbf7f2610dab5e596daabe848
Headers show

Comments

Danek Duvall - July 20, 2015, 10:46 p.m.
# HG changeset patch
# User Danek Duvall <danek.duvall@oracle.com>
# Date 1437431600 25200
#      Mon Jul 20 15:33:20 2015 -0700
# Branch stable
# Node ID 2f68e10b2e83f5fe500664cb949b1adc5f07b037
# Parent  a2d178b3a1b4227e5e7d48d2b3fa5ab1171ca59b
tests: use egrep with regular expression branches for compatibility

GNU grep allows you to use "a\|b" in a regular expression to match either
"a" or "b", but at least Solaris grep does not; only egrep allows for that.
And egrep considers "a+" to be "a{1,}" instead of an "a" and a literal plus
sign, so escape that as well.

Patch

diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -120,7 +120,7 @@  as default style, except for extra phase
   $ hg log --style default > style.out
   $ cmp log.out style.out || diff -u log.out style.out
   $ hg log -T phases > phases.out
-  $ diff -U 0 log.out phases.out | grep -v '^---\|^+++'
+  $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+'
   @@ -2,0 +3 @@
   +phase:       draft
   @@ -6,0 +8 @@
@@ -146,7 +146,7 @@  as default style, except for extra phase
   $ hg log -v --style default > style.out
   $ cmp log.out style.out || diff -u log.out style.out
   $ hg log -v -T phases > phases.out
-  $ diff -U 0 log.out phases.out | grep -v '^---\|^+++'
+  $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+'
   @@ -2,0 +3 @@
   +phase:       draft
   @@ -7,0 +9 @@
@@ -212,7 +212,7 @@  Default style should also preserve color
   $ hg --color=debug log --style default > style.out
   $ cmp log.out style.out || diff -u log.out style.out
   $ hg --color=debug log -T phases > phases.out
-  $ diff -U 0 log.out phases.out | grep -v '^---\|^+++'
+  $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+'
   @@ -2,0 +3 @@
   +[log.phase|phase:       draft]
   @@ -6,0 +8 @@
@@ -238,7 +238,7 @@  Default style should also preserve color
   $ hg --color=debug -v log --style default > style.out
   $ cmp log.out style.out || diff -u log.out style.out
   $ hg --color=debug -v log -T phases > phases.out
-  $ diff -U 0 log.out phases.out | grep -v '^---\|^+++'
+  $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+'
   @@ -2,0 +3 @@
   +[log.phase|phase:       draft]
   @@ -7,0 +9 @@