qseries: don't truncate the patch name (issue1912) stable
authorDan Villiom Podlaski Christiansen <danchr@gmail.com>
Tue, 17 Nov 2009 22:16:41 +0100
branchstable
changeset 9874 c51494c53841
parent 9873 541218fbad2a
child 9877 d266aa7606ce
child 9878 7e7d56fe4833
qseries: don't truncate the patch name (issue1912) Instead of truncating the entire output line of `qseries', only the summary is truncated.
hgext/mq.py
tests/test-mq
tests/test-mq.out
--- a/hgext/mq.py	Tue Nov 17 16:23:05 2009 -0600
+++ b/hgext/mq.py	Tue Nov 17 22:16:41 2009 +0100
@@ -1384,13 +1384,16 @@
         def displayname(pfx, patchname):
             if summary:
                 ph = patchheader(self.join(patchname))
-                msg = ph.message
-                msg = msg and ': ' + msg[0] or ': '
+                msg = ph.message and ph.message[0] or ''
+                if self.ui.interactive():
+                    width = util.termwidth() - len(pfx) - len(patchname) - 2
+                    if width > 0:
+                        msg = util.ellipsis(msg, width)
+                    else:
+                        msg = ''
+                msg = "%s%s: %s" % (pfx, patchname, msg)
             else:
-                msg = ''
-            msg = "%s%s%s" % (pfx, patchname, msg)
-            if self.ui.interactive():
-                msg = util.ellipsis(msg, util.termwidth())
+                msg = pfx + patchname
             self.ui.write(msg + '\n')
 
         applied = set([p.name for p in self.applied])
--- a/tests/test-mq	Tue Nov 17 16:23:05 2009 -0600
+++ b/tests/test-mq	Tue Nov 17 22:16:41 2009 +0100
@@ -143,8 +143,10 @@
 hg qpop -a
 hg --traceback qpush -a
 
+# setting columns & interactive tests truncating (issue1912)
 echo % qseries
-hg qseries
+COLUMNS=4 hg qseries --config ui.interactive=true
+COLUMNS=20 hg qseries --config ui.interactive=true -vs
 hg qpop
 hg qseries -vs
 hg qpush
--- a/tests/test-mq.out	Tue Nov 17 16:23:05 2009 -0600
+++ b/tests/test-mq.out	Tue Nov 17 22:16:41 2009 +0100
@@ -130,6 +130,8 @@
 % qseries
 test.patch
 test2.patch
+0 A test.patch: f...
+1 A test2.patch: 
 popping test2.patch
 now at: test.patch
 0 A test.patch: foo bar