[PATCH 5 of 7] tests: make external diff command output portable

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Fri Feb 5 08:53:38 EST 2016


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1454679125 -32400
#      Fri Feb 05 22:32:05 2016 +0900
# Node ID 928c95eab0128dd1475e0dd8ebdb3a820a84a529
# Parent  3b10fa10cdd14d4e20a32de71531573be6a5f6fc
tests: make external diff command output portable

Before this patch, some tests using external "diff" command via
extdiff extension fail on Solaris, because of incompatibility of
"diff" command output.

For example, system standard "diff" (= /usr/bin/diff) on Solaris
differs from GNU diff in points below:

  - timezone isn't displayed for timestamp value of each files

  - chunk header is always formatted in "@@ -X.x +Y.y @@" style

    On Linux, ".x" and/or ".y" are sometimes omitted.

  - newly created file causes "@@ -1,0 +1,nnnn @@" chunk header

    On Linux, "@@ -0,0 +1,nnnn @@" is used in such case.

In fact, even after this patch, tests below aren't yet portable,
because of other incompatibility of "diff".

  test-subrepo-deep-nested-change.t
  test-largefiles-update.t

diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -343,8 +343,8 @@ Disallow grafting an already grafted cse
   [255]
 
   $ hg extdiff --config extensions.extdiff= --patch -r 2 -r 13
-  --- */hg-5c095ad7e90f.patch	* +0000 (glob)
-  +++ */hg-7a4785234d87.patch	* +0000 (glob)
+  --- */hg-5c095ad7e90f.patch	* (glob)
+  +++ */hg-7a4785234d87.patch	* (glob)
   @@ -1,18 +1,18 @@
    # HG changeset patch
   -# User test
@@ -374,8 +374,8 @@ Disallow grafting an already grafted cse
   [1]
 
   $ hg extdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
-  --- */hg-5c095ad7e90f.patch	* +0000 (glob)
-  +++ */hg-7a4785234d87.patch	* +0000 (glob)
+  --- */hg-5c095ad7e90f.patch	* (glob)
+  +++ */hg-7a4785234d87.patch	* (glob)
   @@ -1,8 +1,8 @@
    # HG changeset patch
   -# User test
diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t
--- a/tests/test-largefiles-update.t
+++ b/tests/test-largefiles-update.t
@@ -24,13 +24,13 @@ directory (and ".hg/largefiles/dirstate"
   diff -Npru repo.0d9d9b8dc9a3/.hglf/large1 repo/.hglf/large1
   --- repo.0d9d9b8dc9a3/.hglf/large1	* (glob)
   +++ repo/.hglf/large1	* (glob)
-  @@ -1 +1 @@
+  @@ -1* +1* @@ (glob)
   -4669e532d5b2c093a78eca010077e708a071bb64
   +58e24f733a964da346e2407a2bee99d9001184f5
   diff -Npru repo.0d9d9b8dc9a3/normal1 repo/normal1
   --- repo.0d9d9b8dc9a3/normal1	* (glob)
   +++ repo/normal1	* (glob)
-  @@ -1 +1 @@
+  @@ -1* +1* @@ (glob)
   -normal1
   +normal1 in #1
   [1]
diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t
--- a/tests/test-subrepo-deep-nested-change.t
+++ b/tests/test-subrepo-deep-nested-change.t
@@ -715,15 +715,15 @@ Interaction with extdiff, largefiles and
 
   $ hg --config extensions.extdiff= extdiff -r '.^' -S
   diff -Npru cloned.*/.hgsub cloned/.hgsub (glob)
-  --- cloned.*/.hgsub	* +0000 (glob)
-  +++ cloned/.hgsub	* +0000 (glob)
-  @@ -1,2 +1 @@
+  --- cloned.*/.hgsub	* (glob)
+  +++ cloned/.hgsub	* (glob)
+  @@ -1,2 +1* @@ (glob)
    sub1 = ../sub1
   -sub3 = sub3
   diff -Npru cloned.*/.hgsubstate cloned/.hgsubstate (glob)
-  --- cloned.*/.hgsubstate	* +0000 (glob)
-  +++ cloned/.hgsubstate	* +0000 (glob)
-  @@ -1,2 +1 @@
+  --- cloned.*/.hgsubstate	* (glob)
+  +++ cloned/.hgsubstate	* (glob)
+  @@ -1,2 +1* @@ (glob)
    7a36fa02b66e61f27f3d4a822809f159479b8ab2 sub1
   -b1a26de6f2a045a9f079323693614ee322f1ff7e sub3
   [1]
@@ -732,63 +732,63 @@ Interaction with extdiff, largefiles and
   diff -Npru cloned.*/.hglf/b.dat cloned.*/.hglf/b.dat (glob)
   --- cloned.*/.hglf/b.dat	* (glob)
   +++ cloned.*/.hglf/b.dat	* (glob)
-  @@ -0,0 +1 @@
+  @@ -*,0 +1* @@ (glob)
   +da39a3ee5e6b4b0d3255bfef95601890afd80709
   diff -Npru cloned.*/.hglf/foo/bar/large.dat cloned.*/.hglf/foo/bar/large.dat (glob)
   --- cloned.*/.hglf/foo/bar/large.dat	* (glob)
   +++ cloned.*/.hglf/foo/bar/large.dat	* (glob)
-  @@ -0,0 +1 @@
+  @@ -*,0 +1* @@ (glob)
   +2f6933b5ee0f5fdd823d9717d8729f3c2523811b
   diff -Npru cloned.*/.hglf/large.bin cloned.*/.hglf/large.bin (glob)
   --- cloned.*/.hglf/large.bin	* (glob)
   +++ cloned.*/.hglf/large.bin	* (glob)
-  @@ -0,0 +1 @@
+  @@ -*,0 +1* @@ (glob)
   +7f7097b041ccf68cc5561e9600da4655d21c6d18
   diff -Npru cloned.*/.hgsub cloned.*/.hgsub (glob)
   --- cloned.*/.hgsub	* (glob)
   +++ cloned.*/.hgsub	* (glob)
-  @@ -1 +1,2 @@
+  @@ -1* +1,2 @@ (glob)
    sub1 = ../sub1
   +sub3 = sub3
   diff -Npru cloned.*/.hgsubstate cloned.*/.hgsubstate (glob)
   --- cloned.*/.hgsubstate	* (glob)
   +++ cloned.*/.hgsubstate	* (glob)
-  @@ -1 +1,2 @@
+  @@ -1* +1,2 @@ (glob)
   -fc3b4ce2696f7741438c79207583768f2ce6b0dd sub1
   +7a36fa02b66e61f27f3d4a822809f159479b8ab2 sub1
   +b1a26de6f2a045a9f079323693614ee322f1ff7e sub3
   diff -Npru cloned.*/foo/bar/def cloned.*/foo/bar/def (glob)
   --- cloned.*/foo/bar/def	* (glob)
   +++ cloned.*/foo/bar/def	* (glob)
-  @@ -0,0 +1 @@
+  @@ -*,0 +1* @@ (glob)
   +changed
   diff -Npru cloned.*/main cloned.*/main (glob)
   --- cloned.*/main	* (glob)
   +++ cloned.*/main	* (glob)
-  @@ -1 +1 @@
+  @@ -1* +1* @@ (glob)
   -main
   +foo
   diff -Npru cloned.*/sub1/.hgsubstate cloned.*/sub1/.hgsubstate (glob)
   --- cloned.*/sub1/.hgsubstate	* (glob)
   +++ cloned.*/sub1/.hgsubstate	* (glob)
-  @@ -1 +1 @@
+  @@ -1* +1* @@ (glob)
   -c57a0840e3badd667ef3c3ef65471609acb2ba3c sub2
   +c77908c81ccea3794a896c79e98b0e004aee2e9e sub2
   diff -Npru cloned.*/sub1/sub2/folder/test.txt cloned.*/sub1/sub2/folder/test.txt (glob)
   --- cloned.*/sub1/sub2/folder/test.txt	* (glob)
   +++ cloned.*/sub1/sub2/folder/test.txt	* (glob)
-  @@ -0,0 +1 @@
+  @@ -*,0 +1* @@ (glob)
   +subfolder
   diff -Npru cloned.*/sub1/sub2/sub2 cloned.*/sub1/sub2/sub2 (glob)
   --- cloned.*/sub1/sub2/sub2	* (glob)
   +++ cloned.*/sub1/sub2/sub2	* (glob)
-  @@ -1 +1 @@
+  @@ -1* +1* @@ (glob)
   -sub2
   +modified
   diff -Npru cloned.*/sub3/a.txt cloned.*/sub3/a.txt (glob)
   --- cloned.*/sub3/a.txt	* (glob)
   +++ cloned.*/sub3/a.txt	* (glob)
-  @@ -0,0 +1 @@
+  @@ -*,0 +1* @@ (glob)
   +xyz
   [1]
 
@@ -796,7 +796,7 @@ Interaction with extdiff, largefiles and
   $ hg --config extensions.extdiff= extdiff -S
   --- */cloned.*/sub1/sub2/sub2	* (glob)
   +++ */cloned/sub1/sub2/sub2	* (glob)
-  @@ -1 +1 @@
+  @@ -1* +1* @@ (glob)
   -modified
   +mod
   [1]


More information about the Mercurial-devel mailing list