comparison 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
comparison
equal deleted inserted replaced
12912:15b8a652b558 12913:0e0a52bd58f9
2277 cmdutil.bail_if_changed(repo) 2277 cmdutil.bail_if_changed(repo)
2278 2278
2279 d = opts["base"] 2279 d = opts["base"]
2280 strip = opts["strip"] 2280 strip = opts["strip"]
2281 wlock = lock = None 2281 wlock = lock = None
2282 msgs = []
2282 2283
2283 def tryone(ui, hunk): 2284 def tryone(ui, hunk):
2284 tmpname, message, user, date, branch, nodeid, p1, p2 = \ 2285 tmpname, message, user, date, branch, nodeid, p1, p2 = \
2285 patch.extract(ui, hunk) 2286 patch.extract(ui, hunk)
2286 2287
2327 patch.patch(tmpname, ui, strip=strip, cwd=repo.root, 2328 patch.patch(tmpname, ui, strip=strip, cwd=repo.root,
2328 files=files, eolmode=None) 2329 files=files, eolmode=None)
2329 finally: 2330 finally:
2330 files = cmdutil.updatedir(ui, repo, files, 2331 files = cmdutil.updatedir(ui, repo, files,
2331 similarity=sim / 100.0) 2332 similarity=sim / 100.0)
2332 if not opts.get('no_commit'): 2333 if opts.get('no_commit'):
2334 if message:
2335 msgs.append(message)
2336 else:
2333 if opts.get('exact'): 2337 if opts.get('exact'):
2334 m = None 2338 m = None
2335 else: 2339 else:
2336 m = cmdutil.matchfiles(repo, files or []) 2340 m = cmdutil.matchfiles(repo, files or [])
2337 n = repo.commit(message, opts.get('user') or user, 2341 n = repo.commit(message, opts.get('user') or user,
2376 lastcommit = commitid 2380 lastcommit = commitid
2377 2381
2378 if not haspatch: 2382 if not haspatch:
2379 raise util.Abort(_('no diffs found')) 2383 raise util.Abort(_('no diffs found'))
2380 2384
2385 if msgs:
2386 repo.opener('last-message.txt', 'wb').write('* * *\n'.join(msgs))
2381 finally: 2387 finally:
2382 release(lock, wlock) 2388 release(lock, wlock)
2383 2389
2384 def incoming(ui, repo, source="default", **opts): 2390 def incoming(ui, repo, source="default", **opts):
2385 """show new changesets found in source 2391 """show new changesets found in source