comparison mercurial/cmdutil.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 402e5fba6509
children bd15932846a4
comparison
equal deleted inserted replaced
22404:12bc7f06fc41 22405:6f63c47cbb86
657 else: 657 else:
658 p1, p2 = parents 658 p1, p2 = parents
659 659
660 n = None 660 n = None
661 if update: 661 if update:
662 repo.dirstate.beginparentchange()
662 if p1 != parents[0]: 663 if p1 != parents[0]:
663 updatefunc(repo, p1.node()) 664 updatefunc(repo, p1.node())
664 if p2 != parents[1]: 665 if p2 != parents[1]:
665 repo.setparents(p1.node(), p2.node()) 666 repo.setparents(p1.node(), p2.node())
666 667
696 else: 697 else:
697 editor = getcommiteditor(editform=editform, **opts) 698 editor = getcommiteditor(editform=editform, **opts)
698 n = repo.commit(message, opts.get('user') or user, 699 n = repo.commit(message, opts.get('user') or user,
699 opts.get('date') or date, match=m, 700 opts.get('date') or date, match=m,
700 editor=editor, force=partial) 701 editor=editor, force=partial)
702 repo.dirstate.endparentchange()
701 else: 703 else:
702 if opts.get('exact') or opts.get('import_branch'): 704 if opts.get('exact') or opts.get('import_branch'):
703 branch = branch or 'default' 705 branch = branch or 'default'
704 else: 706 else:
705 branch = p1.branch() 707 branch = p1.branch()