Mercurial > evolve
comparison hgext/evolve.py @ 923:a94ce5400e1b stable
evolve: protect call to rebase within a wlock (#42, #35, #16)
Without a wlock, repo.commit would blow away the dirstate's parents on OSes
that have no 'os.symlink' support in python, leading evolve to produce a merge
instead of a rebase. If a user ran the rebase command instead of evolve, then
things would work because rebase is wrapped in a giant wlock.
Unfortunately, we can't use the same idea of wrapping the evolve command in one
giant wlock because that's too early in the process. If the lock did wrap the
entire evolve command, then the working directory would save its current
parents which, since rebase hasn't been called yet, would be just
p1.
Therefore, we need to obtain the lock *after* the dirstate's parents are
changed but *before* the call to rebase. This way ensures that when a conflict
happens the working directory correctly shows both parent changeset.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Fri, 25 Apr 2014 19:58:33 -0500 |
parents | 1ebe5c51919b |
children | 89b50258ad33 |
comparison
equal
deleted
inserted
replaced
918:6c5a6c2706f6 | 923:a94ce5400e1b |
---|---|
751 'no support for evolution merge changesets yet', | 751 'no support for evolution merge changesets yet', |
752 hint="Redo the merge a use `hg prune` to obsolete the old one") | 752 hint="Redo the merge a use `hg prune` to obsolete the old one") |
753 destbookmarks = repo.nodebookmarks(dest.node()) | 753 destbookmarks = repo.nodebookmarks(dest.node()) |
754 nodesrc = orig.node() | 754 nodesrc = orig.node() |
755 destphase = repo[nodesrc].phase() | 755 destphase = repo[nodesrc].phase() |
756 wlock = lock = None | |
756 try: | 757 try: |
758 wlock = repo.wlock() | |
759 lock = repo.lock() | |
757 r = rebase.rebasenode(repo, orig.node(), dest.node(), | 760 r = rebase.rebasenode(repo, orig.node(), dest.node(), |
758 {node.nullrev: node.nullrev}, False) | 761 {node.nullrev: node.nullrev}, False) |
759 if r[-1]: #some conflict | 762 if r[-1]: #some conflict |
760 raise util.Abort( | 763 raise util.Abort( |
761 'unresolved merge conflicts (see hg help resolve)') | 764 'unresolved merge conflicts (see hg help resolve)') |
765 except util.Abort, exc: | 768 except util.Abort, exc: |
766 class LocalMergeFailure(MergeFailure, exc.__class__): | 769 class LocalMergeFailure(MergeFailure, exc.__class__): |
767 pass | 770 pass |
768 exc.__class__ = LocalMergeFailure | 771 exc.__class__ = LocalMergeFailure |
769 raise | 772 raise |
773 finally: | |
774 lockmod.release(lock, wlock) | |
770 oldbookmarks = repo.nodebookmarks(nodesrc) | 775 oldbookmarks = repo.nodebookmarks(nodesrc) |
771 if nodenew is not None: | 776 if nodenew is not None: |
772 phases.retractboundary(repo, destphase, [nodenew]) | 777 phases.retractboundary(repo, destphase, [nodenew]) |
773 createmarkers(repo, [(repo[nodesrc], (repo[nodenew],))]) | 778 createmarkers(repo, [(repo[nodesrc], (repo[nodenew],))]) |
774 for book in oldbookmarks: | 779 for book in oldbookmarks: |