diff mercurial/commands.py @ 12913:0e0a52bd58f9

import: --no-commit should update .hg/last-message.txt The patch parser goes through all of that trouble extracting the commit message from the patch file. It seems such a waste not to use it.
author Steve Borho <steve@borho.org>
date Thu, 21 Oct 2010 16:04:34 -0500
parents 15ca4bfecfe3
children 5c3e5cd141ea
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Nov 02 09:47:47 2010 +0100
+++ b/mercurial/commands.py	Thu Oct 21 16:04:34 2010 -0500
@@ -2279,6 +2279,7 @@
     d = opts["base"]
     strip = opts["strip"]
     wlock = lock = None
+    msgs = []
 
     def tryone(ui, hunk):
         tmpname, message, user, date, branch, nodeid, p1, p2 = \
@@ -2329,7 +2330,10 @@
             finally:
                 files = cmdutil.updatedir(ui, repo, files,
                                           similarity=sim / 100.0)
-            if not opts.get('no_commit'):
+            if opts.get('no_commit'):
+                if message:
+                    msgs.append(message)
+            else:
                 if opts.get('exact'):
                     m = None
                 else:
@@ -2378,6 +2382,8 @@
             if not haspatch:
                 raise util.Abort(_('no diffs found'))
 
+        if msgs:
+            repo.opener('last-message.txt', 'wb').write('* * *\n'.join(msgs))
     finally:
         release(lock, wlock)