--- a/mercurial/cmdutil.py Thu May 07 12:07:10 2015 +0900
+++ b/mercurial/cmdutil.py Thu May 07 12:07:11 2015 +0900
@@ -818,6 +818,7 @@
msg = _('applied to working directory')
rejects = False
+ dsguard = None
try:
cmdline_message = logmessage(ui, opts)
@@ -859,7 +860,7 @@
n = None
if update:
- repo.dirstate.beginparentchange()
+ dsguard = dirstateguard(repo, 'tryimportone')
if p1 != parents[0]:
updatefunc(repo, p1.node())
if p2 != parents[1]:
@@ -899,7 +900,7 @@
n = repo.commit(message, opts.get('user') or user,
opts.get('date') or date, match=m,
editor=editor, force=partial)
- repo.dirstate.endparentchange()
+ dsguard.close()
else:
if opts.get('exact') or opts.get('import_branch'):
branch = branch or 'default'
@@ -937,6 +938,7 @@
msg = _('created %s') % short(n)
return (msg, n, rejects)
finally:
+ lockmod.release(dsguard)
os.unlink(tmpname)
def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False,