##// END OF EJS Templates
tryimportone: use dirstateguard instead of beginparentchange/endparentchange...
FUJIWARA Katsunori -
r24995:0579b0c2 default
parent child Browse files
Show More
@@ -818,6 +818,7 b' def tryimportone(ui, repo, hunk, parents'
818 msg = _('applied to working directory')
818 msg = _('applied to working directory')
819
819
820 rejects = False
820 rejects = False
821 dsguard = None
821
822
822 try:
823 try:
823 cmdline_message = logmessage(ui, opts)
824 cmdline_message = logmessage(ui, opts)
@@ -859,7 +860,7 b' def tryimportone(ui, repo, hunk, parents'
859
860
860 n = None
861 n = None
861 if update:
862 if update:
862 repo.dirstate.beginparentchange()
863 dsguard = dirstateguard(repo, 'tryimportone')
863 if p1 != parents[0]:
864 if p1 != parents[0]:
864 updatefunc(repo, p1.node())
865 updatefunc(repo, p1.node())
865 if p2 != parents[1]:
866 if p2 != parents[1]:
@@ -899,7 +900,7 b' def tryimportone(ui, repo, hunk, parents'
899 n = repo.commit(message, opts.get('user') or user,
900 n = repo.commit(message, opts.get('user') or user,
900 opts.get('date') or date, match=m,
901 opts.get('date') or date, match=m,
901 editor=editor, force=partial)
902 editor=editor, force=partial)
902 repo.dirstate.endparentchange()
903 dsguard.close()
903 else:
904 else:
904 if opts.get('exact') or opts.get('import_branch'):
905 if opts.get('exact') or opts.get('import_branch'):
905 branch = branch or 'default'
906 branch = branch or 'default'
@@ -937,6 +938,7 b' def tryimportone(ui, repo, hunk, parents'
937 msg = _('created %s') % short(n)
938 msg = _('created %s') % short(n)
938 return (msg, n, rejects)
939 return (msg, n, rejects)
939 finally:
940 finally:
941 lockmod.release(dsguard)
940 os.unlink(tmpname)
942 os.unlink(tmpname)
941
943
942 def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False,
944 def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False,
General Comments 0
You need to be logged in to leave comments. Login now