[PATCH] mq: include involved files in qrefresh -e constructed message (issue3647)

Davide Bolcioni dbolcioni at fb.com
Mon Dec 3 18:45:57 CST 2012


# HG changeset patch
# User Davide Bolcioni <dbolcioni at fb.com>
# Date 1354053904 28800
# Node ID 85615e499caecbaf758363fd90ad52b42e118a1c
# Parent  fb14a5dcdc62987512820531fe60719d650491b6
mq: include involved files in qrefresh -e constructed message (issue3647)

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -2482,9 +2482,33 @@
             raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
         patch = q.applied[-1].name
         ph = patchheader(q.join(patch), q.plainmode)
-        message = ui.edit('\n'.join(ph.message), ph.user or ui.username())
+
+        (modified, added, removed, deleted) = repo.status()[:4]
+        msg = []
+
+        if ph.message:
+            msg.extend(ph.message)
+
+        if not msg:
+            msg.append(_('(replace this line with the message)'))
+
+        if msg[-1]:
+            msg.append("")
+
+        msg.append(_("HG: Lines beginning with 'HG:' are removed."))
+
+        msg.extend([_('HG: added %s') % f for f in added])
+        msg.extend([_('HG: changed %s') % f for f in modified])
+        msg.extend([_('HG: removed %s') % f for f in removed])
+        msg.extend([_('HG: deleted %s') % f for f in deleted])
+
+        message = ui.edit('\n'.join(msg), ph.user or ui.username())
         # We don't want to lose the patch message if qrefresh fails (issue2062)
+        msg = [t for t in message.split('\n') if not t.startswith('HG: ')]
+        message = '\n'.join(msg)
+        ph.setmessage(message)
         repo.savecommitmessage(message)
+
     setupheaderopts(ui, opts)
     wlock = repo.wlock()
     try:


More information about the Mercurial-devel mailing list