[PATCH STABLE] qseries: don't truncate the patch name (issue1912)

Dan Villiom Podlaski Christiansen danchr at gmail.com
Tue Nov 17 13:44:55 CST 2009


# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1258486821 -3600
# Node ID c73c9a61d6c968b66434871ea6d94edf57ed2382
# Parent  57949bfec718c467f02bd4e9c2bfb8e24d001a5b
qseries: don't truncate the patch name (issue1912)

Instead of truncating the entire output line of `qseries', only the
summary is truncated.

The incorrect behaviour was seen invoking the following script from
Emacs' scratch buffer:

(progn
  (cd (expand-file-name "/path/to/a/queued/repository/"))
  (setenv "HGRCPATH" "/dev/null")
  (setenv "COLUMNS" "8")

  (start-process "test qseries" (current-buffer)
                 "./hg" "--config" "extensions.mq=" "qseries"))

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1385,12 +1385,15 @@ class queue(object):
             if summary:
                 ph = patchheader(self.join(patchname))
                 msg = ph.message
-                msg = msg and ': ' + msg[0] or ': '
+                if self.ui.interactive():
+                    width = util.termwidth() - len(pfx) - len(patchname) - 2
+                    if msg and width > 0:
+                        msg = util.ellipsis(msg[0], 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])


More information about the Mercurial-devel mailing list