changeset 13637:4e976235c985

merge with stable
author Martin Geisler <mg@aragost.com>
date Mon, 14 Mar 2011 14:05:19 +0100
parents 15470463f932 (current diff) 4bfff063aed6 (diff)
children 72040d98ff0a
files hgext/mq.py setup.py
diffstat 6 files changed, 55 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Mon Mar 14 12:26:50 2011 +0100
+++ b/hgext/color.py	Mon Mar 14 14:05:19 2011 +0100
@@ -26,8 +26,7 @@
 
 Other effects in addition to color, like bold and underlined text, are
 also available. Effects are rendered with the ECMA-48 SGR control
-function (aka ANSI escape codes). This module also provides the
-render_text function, which can be used to add effects to any text.
+function (aka ANSI escape codes).
 
 Default effects may be overridden from your configuration file::
 
--- a/hgext/graphlog.py	Mon Mar 14 12:26:50 2011 +0100
+++ b/hgext/graphlog.py	Mon Mar 14 14:05:19 2011 +0100
@@ -319,7 +319,11 @@
     '''wrap the command'''
     def graph(orig, *args, **kwargs):
         if kwargs['graph']:
-            return wrapfn(*args, **kwargs)
+            try:
+                return wrapfn(*args, **kwargs)
+            except TypeError, e:
+                if len(args) > wrapfn.func_code.co_argcount:
+                    raise util.Abort(_('--graph option allows at most one file'))
         return orig(*args, **kwargs)
     entry = extensions.wrapcommand(table, cmd, graph)
     entry[1].append(('G', 'graph', None, _("show the revision DAG")))
--- a/hgext/mq.py	Mon Mar 14 12:26:50 2011 +0100
+++ b/hgext/mq.py	Mon Mar 14 14:05:19 2011 +0100
@@ -1455,9 +1455,10 @@
 
             try:
                 # might be nice to attempt to roll back strip after this
-                patchf.rename()
                 n = repo.commit(message, user, ph.date, match=match,
                                 force=True)
+                # only write patch after a successful commit
+                patchf.rename()
                 self.applied.append(statusentry(n, patchfn))
             except:
                 ctx = repo[cparents[0]]
--- a/setup.py	Mon Mar 14 12:26:50 2011 +0100
+++ b/setup.py	Mon Mar 14 14:05:19 2011 +0100
@@ -105,6 +105,10 @@
     p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE, env=env)
     out, err = p.communicate()
+    return out, err
+
+def runhg(cmd, env):
+    out, err = runcmd(cmd, env)
     # If root is executing setup.py, but the repository is owned by
     # another user (as in "sudo python setup.py install") we will get
     # trust warnings since the .hg/hgrc file is untrusted. That is
@@ -135,7 +139,7 @@
         # error 0xc0150004. See: http://bugs.python.org/issue3440
         env['SystemRoot'] = os.environ['SystemRoot']
     cmd = [sys.executable, 'hg', 'id', '-i', '-t']
-    l = runcmd(cmd, env).split()
+    l = runhg(cmd, env).split()
     while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
         l.pop()
     if len(l) > 1: # tag found
@@ -145,7 +149,7 @@
     elif len(l) == 1: # no tag found
         cmd = [sys.executable, 'hg', 'parents', '--template',
                '{latesttag}+{latesttagdistance}-']
-        version = runcmd(cmd, env) + l[0]
+        version = runhg(cmd, env) + l[0]
     if version.endswith('+'):
         version += time.strftime('%Y%m%d')
 elif os.path.exists('.hg_archival.txt'):
@@ -361,7 +365,7 @@
 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
     # XCode 4.0 dropped support for ppc architecture, which is hardcoded in
     # distutils.sysconfig
-    version = runcmd(['/usr/bin/xcodebuild', '-version'], {}).splitlines()[0]
+    version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()[0]
     # Also parse only first digit, because 3.2.1 can't be parsed nicely
     if (version.startswith('Xcode') and
         StrictVersion(version.split()[1]) >= StrictVersion('4.0')):
--- a/tests/test-glog.t	Mon Mar 14 12:26:50 2011 +0100
+++ b/tests/test-glog.t	Mon Mar 14 14:05:19 2011 +0100
@@ -686,6 +686,11 @@
   show revision history alongside an ASCII revision graph
   [255]
 
+Only one file is allowed:
+  $ hg log -G foo bar
+  abort: --graph option allows at most one file
+  [255]
+
 Empty revision range - display nothing:
   $ hg glog -r 1..0
 
--- a/tests/test-mq-qrefresh.t	Mon Mar 14 12:26:50 2011 +0100
+++ b/tests/test-mq-qrefresh.t	Mon Mar 14 14:05:19 2011 +0100
@@ -487,3 +487,38 @@
 
   $ cd ..
 
+Refresh with bad usernames. Mercurial used to abort on bad usernames,
+but only after writing the bad name into the patch.
+
+  $ hg init bad-usernames
+  $ cd bad-usernames
+  $ touch a
+  $ hg add a
+  $ hg qnew a
+  $ hg qrefresh -u 'foo
+  > bar'
+  transaction abort!
+  rollback completed
+  refresh interrupted while patch was popped! (revert --all, qpush to recover)
+  abort: username 'foo\nbar' contains a newline!
+  [255]
+  $ cat .hg/patches/a
+  # HG changeset patch
+  # Parent 0000000000000000000000000000000000000000
+  diff --git a/a b/a
+  new file mode 100644
+  $ hg qpush
+  applying a
+  now at: a
+  $ hg qrefresh -u ' '
+  transaction abort!
+  rollback completed
+  refresh interrupted while patch was popped! (revert --all, qpush to recover)
+  abort: empty username!
+  [255]
+  $ cat .hg/patches/a
+  # HG changeset patch
+  # Parent 0000000000000000000000000000000000000000
+  diff --git a/a b/a
+  new file mode 100644
+  $ cd ..