[PATCH STABLE] solaris: diff -u emits "No differences encountered"

Danek Duvall danek.duvall at oracle.com
Wed Feb 19 17:42:20 CST 2014


# HG changeset patch
# User Danek Duvall <danek.duvall at oracle.com>
# Date 1392846409 28800
#      Wed Feb 19 13:46:49 2014 -0800
# Node ID 921bee7c9985df6c023106dd74e4d32ee8020d20
# Parent  0e2877f8605dcaf4fdf2ab7e0046f1f6f80161dd
solaris: diff -u emits "No differences encountered"

Solaris diff -u isn't silent when two files are identical, and tests that
don't account for that will fail.  Fix those tests, and introduce a check
that prevents reintroduction.

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -121,6 +121,7 @@ testpats = [
     (r'^( *)\t', "don't use tabs to indent"),
     (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)',
      "put a backslash-escaped newline after sed 'i' command"),
+    (r'^diff *-\w*u.*$\n(^  \$ |^$)', "prefix diff -u with cmp"),
   ],
   # warnings
   [
diff --git a/tests/test-convert-bzr.t b/tests/test-convert-bzr.t
--- a/tests/test-convert-bzr.t
+++ b/tests/test-convert-bzr.t
@@ -102,7 +102,7 @@ compare timestamps
   >   > ../bzr-timestamps
   $ cd ..
   $ hg -R source-hg log --template "{date|isodate}\n" > hg-timestamps
-  $ diff -u bzr-timestamps hg-timestamps
+  $ cmp bzr-timestamps hg-timestamps || diff -u bzr-timestamps hg-timestamps
   $ cd ..
 
 merge
diff --git a/tests/test-highlight.t b/tests/test-highlight.t
--- a/tests/test-highlight.t
+++ b/tests/test-highlight.t
@@ -522,7 +522,7 @@ hgweb fileannotate, raw
   $ echo "" >> b
   $ echo "" >> b
   $ echo "" >> b
-  $ diff -u b a
+  $ cmp b a || diff -u b a
 
 hgweb filerevision, raw
 
@@ -531,7 +531,7 @@ hgweb filerevision, raw
   $ echo "200 Script output follows" > b
   $ echo "" >> b
   $ hg cat primes.py >> b
-  $ diff -u b a
+  $ cmp b a || diff -u b a
 
 hgweb highlightcss friendly
 


More information about the Mercurial-devel mailing list