merge with stable
authorMatt Mackall <mpm@selenic.com>
Fri, 06 Apr 2012 15:18:14 -0500
changeset 16373 329887a7074c
parent 16371 4417eb761ba8 (current diff)
parent 16372 709924be3d04 (diff)
child 16374 29c2ff719715
merge with stable
contrib/check-code.py
mercurial/commands.py
mercurial/context.py
mercurial/ui.py
--- a/contrib/check-code.py	Fri Apr 06 15:16:30 2012 -0500
+++ b/contrib/check-code.py	Fri Apr 06 15:18:14 2012 -0500
@@ -95,6 +95,8 @@
      "explicit exit code checks unnecessary"),
     (uprefix + r'set -e', "don't use set -e"),
     (uprefixc + r'( *)\t', "don't use tabs to indent"),
+    (uprefixc + r'.*do\s*true;\s*done',
+     "don't use true as loop body, use sleep 0"),
   ],
   # warnings
   []
--- a/mercurial/commands.py	Fri Apr 06 15:16:30 2012 -0500
+++ b/mercurial/commands.py	Fri Apr 06 15:18:14 2012 -0500
@@ -2438,9 +2438,9 @@
     Returns 0 on success.
     """
     changesets += tuple(opts.get('rev', []))
-    if not changesets:
+    revs = scmutil.revrange(repo, changesets)
+    if not revs:
         raise util.Abort(_("export requires at least one changeset"))
-    revs = scmutil.revrange(repo, changesets)
     if len(revs) > 1:
         ui.note(_('exporting patches:\n'))
     else:
--- a/mercurial/context.py	Fri Apr 06 15:16:30 2012 -0500
+++ b/mercurial/context.py	Fri Apr 06 15:18:14 2012 -0500
@@ -127,7 +127,7 @@
     def phasestr(self):
         return phases.phasenames[self.phase()]
     def mutable(self):
-        return self._repo._phaserev[self._rev] > phases.public
+        return self.phase() > phases.public
     def hidden(self):
         return self._rev in self._repo.changelog.hiddenrevs
 
--- a/mercurial/mdiff.py	Fri Apr 06 15:16:30 2012 -0500
+++ b/mercurial/mdiff.py	Fri Apr 06 15:18:14 2012 -0500
@@ -156,10 +156,10 @@
     return ' '.join(parts) + '\n'
 
 def unidiff(a, ad, b, bd, fn1, fn2, r=None, opts=defaultopts):
-    def datetag(date, addtab=True):
+    def datetag(date, fn=None):
         if not opts.git and not opts.nodates:
             return '\t%s\n' % date
-        if addtab and ' ' in fn1:
+        if fn and ' ' in fn:
             return '\t\n'
         return '\n'
 
@@ -177,19 +177,19 @@
     elif not a:
         b = splitnewlines(b)
         if a is None:
-            l1 = '--- /dev/null%s' % datetag(epoch, False)
+            l1 = '--- /dev/null%s' % datetag(epoch)
         else:
-            l1 = "--- %s%s" % ("a/" + fn1, datetag(ad))
-        l2 = "+++ %s%s" % ("b/" + fn2, datetag(bd))
+            l1 = "--- %s%s" % ("a/" + fn1, datetag(ad, fn1))
+        l2 = "+++ %s%s" % ("b/" + fn2, datetag(bd, fn2))
         l3 = "@@ -0,0 +1,%d @@\n" % len(b)
         l = [l1, l2, l3] + ["+" + e for e in b]
     elif not b:
         a = splitnewlines(a)
-        l1 = "--- %s%s" % ("a/" + fn1, datetag(ad))
+        l1 = "--- %s%s" % ("a/" + fn1, datetag(ad, fn1))
         if b is None:
-            l2 = '+++ /dev/null%s' % datetag(epoch, False)
+            l2 = '+++ /dev/null%s' % datetag(epoch)
         else:
-            l2 = "+++ %s%s" % ("b/" + fn2, datetag(bd))
+            l2 = "+++ %s%s" % ("b/" + fn2, datetag(bd, fn2))
         l3 = "@@ -1,%d +0,0 @@\n" % len(a)
         l = [l1, l2, l3] + ["-" + e for e in a]
     else:
@@ -199,8 +199,8 @@
         if not l:
             return ""
 
-        l.insert(0, "--- a/%s%s" % (fn1, datetag(ad)))
-        l.insert(1, "+++ b/%s%s" % (fn2, datetag(bd)))
+        l.insert(0, "--- a/%s%s" % (fn1, datetag(ad, fn1)))
+        l.insert(1, "+++ b/%s%s" % (fn2, datetag(bd, fn2)))
 
     for ln in xrange(len(l)):
         if l[ln][-1] != '\n':
--- a/mercurial/ui.py	Fri Apr 06 15:16:30 2012 -0500
+++ b/mercurial/ui.py	Fri Apr 06 15:18:14 2012 -0500
@@ -483,7 +483,7 @@
             if not getattr(self.ferr, 'closed', False):
                 self.ferr.flush()
         except IOError, inst:
-            if inst.errno not in (errno.EPIPE, errno.EIO):
+            if inst.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
                 raise
 
     def flush(self):
--- a/tests/hghave	Fri Apr 06 15:16:30 2012 -0500
+++ b/tests/hghave	Fri Apr 06 15:18:14 2012 -0500
@@ -177,7 +177,6 @@
         return True
     except (OSError, AttributeError):
         return False
-    return hasattr(os, "symlink") # FIXME: should also check file system and os
 
 def has_tla():
     return matchoutput('tla --version 2>&1', r'The GNU Arch Revision')
--- a/tests/test-debugbuilddag.t	Fri Apr 06 15:16:30 2012 -0500
+++ b/tests/test-debugbuilddag.t	Fri Apr 06 15:18:14 2012 -0500
@@ -7,6 +7,7 @@
   $ hg debugbuilddag '+2:f +3:p2 @temp <f+4 @default /p2 +2' \
   > --config extensions.progress= --config progress.assume-tty=1 \
   > --config progress.delay=0 --config progress.refresh=0 \
+  > --config progress.format=topic,bar,number \
   > --config progress.width=60 2>&1 | \
   > python "$TESTDIR/filtercr.py"
   
--- a/tests/test-diff-unified.t	Fri Apr 06 15:16:30 2012 -0500
+++ b/tests/test-diff-unified.t	Fri Apr 06 15:18:14 2012 -0500
@@ -140,3 +140,54 @@
   +c3
   @@ -3,1 +4,0 @@ c4
   -c5
+
+  $ echo a > f1
+  $ hg ci -m movef2
+
+Test diff headers terminating with TAB when necessary (issue3357)
+Regular diff --nodates, file creation
+
+  $ hg mv f1 'f 1'
+  $ echo b > 'f 1'
+  $ hg diff --nodates 'f 1'
+  diff -r 7574207d0d15 f 1
+  --- /dev/null
+  +++ b/f 1	
+  @@ -0,0 +1,1 @@
+  +b
+
+Git diff, adding space
+
+  $ hg diff --git
+  diff --git a/f1 b/f 1
+  rename from f1
+  rename to f 1
+  --- a/f1
+  +++ b/f 1	
+  @@ -1,1 +1,1 @@
+  -a
+  +b
+
+Regular diff --nodates, file deletion
+
+  $ hg ci -m addspace
+  $ hg mv 'f 1' f1
+  $ echo a > f1
+  $ hg diff --nodates 'f 1'
+  diff -r ca50fe67c9c7 f 1
+  --- a/f 1	
+  +++ /dev/null
+  @@ -1,1 +0,0 @@
+  -b
+
+Git diff, removing space
+
+  $ hg diff --git
+  diff --git a/f 1 b/f1
+  rename from f 1
+  rename to f1
+  --- a/f 1	
+  +++ b/f1
+  @@ -1,1 +1,1 @@
+  -b
+  +a
--- a/tests/test-export.t	Fri Apr 06 15:16:30 2012 -0500
+++ b/tests/test-export.t	Fri Apr 06 15:18:14 2012 -0500
@@ -129,3 +129,17 @@
   exporting patch:
   ____________0123456789_______ABCDEFGHIJKLMNOPQRSTUVWXYZ______abcdefghijklmnopqrstuvwxyz____.patch
 
+Catch exporting unknown revisions (especially empty revsets, see issue3353)
+
+  $ hg export
+  abort: export requires at least one changeset
+  [255]
+  $ hg export ""
+  hg: parse error: empty query
+  [255]
+  $ hg export 999
+  abort: unknown revision '999'!
+  [255]
+  $ hg export "not all()"
+  abort: export requires at least one changeset
+  [255]
--- a/tests/test-hup.t	Fri Apr 06 15:16:30 2012 -0500
+++ b/tests/test-hup.t	Fri Apr 06 15:18:14 2012 -0500
@@ -11,7 +11,7 @@
   $ (
   > echo lock
   > echo addchangegroup
-  > while [ ! -s .hg/store/journal ]; do true; done
+  > while [ ! -s .hg/store/journal ]; do sleep 0; done
   > kill -HUP $P
   > ) > p
 
--- a/tests/test-mq-qimport.t	Fri Apr 06 15:16:30 2012 -0500
+++ b/tests/test-mq-qimport.t	Fri Apr 06 15:18:14 2012 -0500
@@ -28,6 +28,14 @@
   abort: unable to read file non-existing-file
   [255]
 
+qimport null revision
+
+  $ hg qimport -r null
+  abort: revision -1 is not mutable
+  (see "hg help phases" for details)
+  [255]
+  $ hg qseries
+
 import email
 
   $ hg qimport --push -n email - <<EOF
--- a/tests/test-serve.t	Fri Apr 06 15:16:30 2012 -0500
+++ b/tests/test-serve.t	Fri Apr 06 15:18:14 2012 -0500
@@ -14,7 +14,7 @@
   >    else
   >        kill `cat hg.pid`
   >    fi
-  >    while kill -0 `cat hg.pid` 2>/dev/null; do true; done
+  >    while kill -0 `cat hg.pid` 2>/dev/null; do sleep 0; done
   > }
 
   $ hg init test