# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1246109324 -7200 # Node ID 894c5b4be27505bf2098f73a25ea2c0dfd854ab4 # Parent ef440eab290f9790ac2042dbf8c4a895a9926e52 mq: align columns in verbose qseries output. diff -r ef440eab290f -r 894c5b4be275 hgext/mq.py --- a/hgext/mq.py Wed Jul 01 10:19:40 2009 -0400 +++ b/hgext/mq.py Sat Jun 27 15:28:44 2009 +0200 @@ -1343,19 +1343,24 @@ def qseries(self, repo, missing=None, start=0, length=None, status=None, summary=False): - def displayname(patchname): + def displayname(pfx, patchname): if summary: ph = patchheader(self.join(patchname)) msg = ph.message msg = msg and ': ' + msg[0] or ': ' else: msg = '' - return '%s%s' % (patchname, msg) + msg = "%s%s%s" % (pfx, patchname, msg) + if self.ui.interactive(): + msg = util.ellipsis(msg, util.termwidth()) + self.ui.write(msg + '\n') applied = set([p.name for p in self.applied]) if length is None: length = len(self.series) - start if not missing: + if self.ui.verbose: + idxwidth = len(str(start+length - 1)) for i in xrange(start, start+length): patch = self.series[i] if patch in applied: @@ -1366,10 +1371,10 @@ stat = 'G' pfx = '' if self.ui.verbose: - pfx = '%d %s ' % (i, stat) + pfx = '%*d %s ' % (idxwidth, i, stat) elif status and status != stat: continue - self.ui.write('%s%s\n' % (pfx, displayname(patch))) + displayname(pfx, patch) else: msng_list = [] for root, dirs, files in os.walk(self.path): @@ -1383,7 +1388,7 @@ msng_list.append(fl) for x in sorted(msng_list): pfx = self.ui.verbose and ('D ') or '' - self.ui.write("%s%s\n" % (pfx, displayname(x))) + displayname(pfx, x) def issaveline(self, l): if l.name == '.hg.patches.save.line':