diff --git a/hgext/color.py b/hgext/color.py --- a/hgext/color.py +++ b/hgext/color.py @@ -26,8 +26,7 @@ whitespace. 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:: diff --git a/hgext/graphlog.py b/hgext/graphlog.py --- a/hgext/graphlog.py +++ b/hgext/graphlog.py @@ -319,7 +319,11 @@ def _wrapcmd(ui, cmd, table, wrapfn): '''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"))) diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -1455,9 +1455,10 @@ class queue(object): 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]] diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -105,6 +105,10 @@ def runcmd(cmd, env): 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 @@ if os.path.isdir('.hg'): # 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 @@ if os.path.isdir('.hg'): 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 os.name == 'nt': 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')): diff --git a/tests/test-glog.t b/tests/test-glog.t --- a/tests/test-glog.t +++ b/tests/test-glog.t @@ -686,6 +686,11 @@ Unused arguments: 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 diff --git a/tests/test-mq-qrefresh.t b/tests/test-mq-qrefresh.t --- a/tests/test-mq-qrefresh.t +++ b/tests/test-mq-qrefresh.t @@ -487,3 +487,38 @@ Issue1441 with git patches: $ 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 ..