Mercurial > public > mercurial-scm > hg
diff mercurial/commands.py @ 22405:6f63c47cbb86
dirstate: wrap setparent calls with begin/endparentchange (issue4353)
This wraps all the locations of dirstate.setparent with the appropriate
begin/endparentchange calls. This will prevent exceptions during those calls
from causing incoherent dirstates (issue4353).
author | Durham Goode <durham@fb.com> |
---|---|
date | Fri, 05 Sep 2014 11:36:20 -0700 |
parents | e2806b8613ca |
children | ca854cd4a26a |
line wrap: on
line diff
--- a/mercurial/commands.py Fri Sep 05 11:34:29 2014 -0700 +++ b/mercurial/commands.py Fri Sep 05 11:36:20 2014 -0700 @@ -483,9 +483,11 @@ try: ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'backout') + repo.dirstate.beginparentchange() stats = mergemod.update(repo, parent, True, True, False, node, False) repo.setparents(op1, op2) + repo.dirstate.endparentchange() hg._showstats(repo, stats) if stats[3]: repo.ui.status(_("use 'hg resolve' to retry unresolved " @@ -2750,7 +2752,9 @@ wlock = repo.wlock() try: + repo.dirstate.beginparentchange() repo.setparents(r1, r2) + repo.dirstate.endparentchange() finally: wlock.release() @@ -3310,10 +3314,12 @@ cont = False # drop the second merge parent + repo.dirstate.beginparentchange() repo.setparents(current.node(), nullid) repo.dirstate.write() # fix up dirstate for copies and renames cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev()) + repo.dirstate.endparentchange() # commit node = repo.commit(text=message, user=user, @@ -3922,6 +3928,7 @@ try: try: wlock = repo.wlock() + repo.dirstate.beginparentchange() if not opts.get('no_commit'): lock = repo.lock() tr = repo.transaction('import') @@ -3962,6 +3969,7 @@ tr.close() if msgs: repo.savecommitmessage('\n* * *\n'.join(msgs)) + repo.dirstate.endparentchange() return ret except: # re-raises # wlock.release() indirectly calls dirstate.write(): since