Mercurial > hg
comparison mercurial/commands.py @ 19026:1dc393614e61
import: inline checkexact function
We have a sngle call now, no need to make it a function.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Wed, 17 Apr 2013 10:25:14 +0200 |
parents | 3af92401efb3 |
children | 26c51e87e807 |
comparison
equal
deleted
inserted
replaced
19025:3af92401efb3 | 19026:1dc393614e61 |
---|---|
3601 base = opts["base"] | 3601 base = opts["base"] |
3602 strip = opts["strip"] | 3602 strip = opts["strip"] |
3603 wlock = lock = tr = None | 3603 wlock = lock = tr = None |
3604 msgs = [] | 3604 msgs = [] |
3605 | 3605 |
3606 def checkexact(repo, n, nodeid): | |
3607 if opts.get('exact') and hex(n) != nodeid: | |
3608 raise util.Abort(_('patch is damaged or loses information')) | |
3609 | |
3610 def tryone(ui, hunk, parents): | 3606 def tryone(ui, hunk, parents): |
3611 tmpname, message, user, date, branch, nodeid, p1, p2 = \ | 3607 tmpname, message, user, date, branch, nodeid, p1, p2 = \ |
3612 patch.extract(ui, hunk) | 3608 patch.extract(ui, hunk) |
3613 | 3609 |
3614 if not tmpname: | 3610 if not tmpname: |
3699 editor=cmdutil.commiteditor) | 3695 editor=cmdutil.commiteditor) |
3700 repo.savecommitmessage(memctx.description()) | 3696 repo.savecommitmessage(memctx.description()) |
3701 n = memctx.commit() | 3697 n = memctx.commit() |
3702 finally: | 3698 finally: |
3703 store.close() | 3699 store.close() |
3704 checkexact(repo, n, nodeid) | 3700 if opts.get('exact') and hex(n) != nodeid: |
3701 raise util.Abort(_('patch is damaged or loses information')) | |
3705 if n: | 3702 if n: |
3706 # i18n: refers to a short changeset id | 3703 # i18n: refers to a short changeset id |
3707 msg = _('created %s') % short(n) | 3704 msg = _('created %s') % short(n) |
3708 return (msg, n) | 3705 return (msg, n) |
3709 finally: | 3706 finally: |