# HG changeset patch # User Martin Geisler # Date 2011-05-31 06:47:16 # Node ID 00256f689f9c2b264e2b79efe23cde16b4826926 # Parent 81f559d1b9b22da0dc1acdc86eb6d189c518151a mq: print "'foo' 'bar'", not "['foo', 'bar']" when showing guards The internal list representation of guards was leaking into the output. The guards were always printed using repr(guard) and that style was kept. When "hg qguard -l" prints several guards for a patch, it does so by joining the names with " " and that style was used for the error messages too. diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -455,13 +455,13 @@ class queue(object): guards = self.active() exactneg = [g for g in patchguards if g[0] == '-' and g[1:] in guards] if exactneg: - return False, exactneg[0] + return False, repr(exactneg[0]) pos = [g for g in patchguards if g[0] == '+'] exactpos = [g for g in pos if g[1:] in guards] if pos: if exactpos: - return True, exactpos[0] - return False, pos + return True, repr(exactpos[0]) + return False, ' '.join(map(repr, pos)) return True, '' def explain_pushable(self, idx, all_patches=False): @@ -479,11 +479,11 @@ class queue(object): write(_('allowing %s - no matching negative guards\n') % self.series[idx]) else: - write(_('allowing %s - guarded by %r\n') % + write(_('allowing %s - guarded by %s\n') % (self.series[idx], why)) if not pushable: if why: - write(_('skipping %s - guarded by %r\n') % + write(_('skipping %s - guarded by %s\n') % (self.series[idx], why)) else: write(_('skipping %s - no matching guards\n') % @@ -1114,7 +1114,7 @@ class queue(object): _("cannot push to a previous patch: %s") % patch) else: if reason: - reason = _('guarded by %r') % reason + reason = _('guarded by %s') % reason else: reason = _('no matching guards') self.ui.warn(_("cannot push '%s' - %s\n") % (patch, reason)) diff --git a/tests/test-mq-guards.t b/tests/test-mq-guards.t --- a/tests/test-mq-guards.t +++ b/tests/test-mq-guards.t @@ -63,7 +63,7 @@ should print +a should fail $ hg qpush a.patch - cannot push 'a.patch' - guarded by ['+a'] + cannot push 'a.patch' - guarded by '+a' [1] $ hg qguard a.patch @@ -366,9 +366,9 @@ new.patch, b.patch: Guarded. c.patch: Ap 3 G d.patch $ hg qpush -a applying new.patch - skipping b.patch - guarded by ['+2'] + skipping b.patch - guarded by '+2' applying c.patch - skipping d.patch - guarded by ['+2'] + skipping d.patch - guarded by '+2' now at: c.patch $ qappunappv % hg qapplied diff --git a/tests/test-mq-qpush-fail.t b/tests/test-mq-qpush-fail.t --- a/tests/test-mq-qpush-fail.t +++ b/tests/test-mq-qpush-fail.t @@ -122,7 +122,7 @@ Test qpush to a patch below the currentl try to push and pop while a is guarded $ hg qpush a - cannot push 'a' - guarded by ['+block'] + cannot push 'a' - guarded by '+block' [1] $ hg qpush -a applying b diff --git a/tests/test-mq.t b/tests/test-mq.t --- a/tests/test-mq.t +++ b/tests/test-mq.t @@ -460,7 +460,7 @@ qpush --move $ hg qguard test1b.patch -- -negguard $ hg qguard test2.patch -- +posguard $ hg qpush --move test2.patch # can't move guarded patch - cannot push 'test2.patch' - guarded by ['+posguard'] + cannot push 'test2.patch' - guarded by '+posguard' [1] $ hg qselect posguard number of unguarded, unapplied patches has changed from 2 to 3