[PATCH 1 of 2] mq/qseries: move code around
Yann E. MORIN
yann.morin.1998 at anciens.enib.fr
Mon May 17 16:22:53 CDT 2010
hgext/mq.py | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
# HG changeset patch
# User "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr>
# Date 1274128626 -7200
# Node ID f878c59335e80143494f46eed8375ff40f51ddf1
# Parent 43337076ba9262bc6fd763c149b9f649abc406ff
mq/qseries: move code around
Move code around to avoid duplication (we print the patch name at
two places), and make code-path easier to follow.
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1407,22 +1407,21 @@
def qseries(self, repo, missing=None, start=0, length=None, status=None,
summary=False):
def displayname(pfx, patchname, state):
+ _len = 0
if pfx:
self.ui.write(pfx)
+ _len += len(pfx)
+ self.ui.write(patchname, label='qseries.' + state)
+ _len += len(patchname)
if summary:
ph = patchheader(self.join(patchname), self.plainmode)
msg = ph.message and ph.message[0] or ''
if not self.ui.plain():
- width = util.termwidth() - len(pfx) - len(patchname) - 2
+ width = util.termwidth() - _len - 2
if width > 0:
msg = util.ellipsis(msg, width)
- else:
- msg = ''
- self.ui.write(patchname, label='qseries.' + state)
- self.ui.write(': ')
- self.ui.write(msg, label='qseries.message.' + state)
- else:
- self.ui.write(patchname, label='qseries.' + state)
+ self.ui.write(': ')
+ self.ui.write(msg, label='qseries.message.' + state)
self.ui.write('\n')
applied = set([p.name for p in self.applied])
More information about the Mercurial-devel
mailing list