[PATCH DEFAULT] import: --no-commit should update .hg/last-message.txt
steve at borho.org
steve at borho.org
Wed Oct 27 14:51:35 UTC 2010
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1287695074 18000
# Branch stable
# Node ID ecdde03a377ec33dbc1f82f21b4ff0fe2de49d26
# Parent db2ff771204daa1f5d2fd0a141b0263df17fe6fc
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.
diff -r db2ff771204d -r ecdde03a377e mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2262,6 +2262,7 @@
d = opts["base"]
strip = opts["strip"]
wlock = lock = None
+ msgs = []
def tryone(ui, hunk):
tmpname, message, user, date, branch, nodeid, p1, p2 = \
@@ -2312,7 +2313,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:
@@ -2361,6 +2365,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)
More information about the Mercurial-devel
mailing list