# HG changeset patch # User Martin Geisler # Date 1306824436 -7200 # 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 -r 81f559d1b9b2 -r 00256f689f9c hgext/mq.py --- a/hgext/mq.py Fri May 27 12:42:36 2011 +0200 +++ b/hgext/mq.py Tue May 31 08:47:16 2011 +0200 @@ -455,13 +455,13 @@ 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 @@ 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 @@ _("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 -r 81f559d1b9b2 -r 00256f689f9c tests/test-mq-guards.t --- a/tests/test-mq-guards.t Fri May 27 12:42:36 2011 +0200 +++ b/tests/test-mq-guards.t Tue May 31 08:47:16 2011 +0200 @@ -63,7 +63,7 @@ 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 @@ 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 -r 81f559d1b9b2 -r 00256f689f9c tests/test-mq-qpush-fail.t --- a/tests/test-mq-qpush-fail.t Fri May 27 12:42:36 2011 +0200 +++ b/tests/test-mq-qpush-fail.t Tue May 31 08:47:16 2011 +0200 @@ -122,7 +122,7 @@ 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 -r 81f559d1b9b2 -r 00256f689f9c tests/test-mq.t --- a/tests/test-mq.t Fri May 27 12:42:36 2011 +0200 +++ b/tests/test-mq.t Tue May 31 08:47:16 2011 +0200 @@ -460,7 +460,7 @@ $ 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