Mercurial > hg
comparison hgext/fix.py @ 47886:86a60679cf61 stable 5.9.1
fix: again allow formatting the working copy while merging
I forgot about unfinished merges (I think I was thinking only about
unfinished merge conflicts) when I wrote
https://phab.mercurial-scm.org/D11209. As a coworker (hg contributor
dploch) reported to me, this led to `hg fix --working-dir` failing
when you have an uncommitted merge. The fix is trivial: just move the
assertion to just before the call to `scmutil.movedirstate()` where it
actually matters.
Differential Revision: https://phab.mercurial-scm.org/D11376
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 27 Aug 2021 13:51:44 -0700 |
parents | e69c82bf3a01 |
children | 66ff8d3865b3 |
comparison
equal
deleted
inserted
replaced
47885:3962503cd1e8 | 47886:86a60679cf61 |
---|---|
750 update/merge, and means that the working directory simply isn't affected | 750 update/merge, and means that the working directory simply isn't affected |
751 unless the --working-dir flag is given. | 751 unless the --working-dir flag is given. |
752 | 752 |
753 Directly updates the dirstate for the affected files. | 753 Directly updates the dirstate for the affected files. |
754 """ | 754 """ |
755 assert repo.dirstate.p2() == nullid | |
756 | |
757 for path, data in pycompat.iteritems(filedata): | 755 for path, data in pycompat.iteritems(filedata): |
758 fctx = ctx[path] | 756 fctx = ctx[path] |
759 fctx.write(data, fctx.flags()) | 757 fctx.write(data, fctx.flags()) |
760 | 758 |
761 oldp1 = repo.dirstate.p1() | 759 oldp1 = repo.dirstate.p1() |
762 newp1 = replacements.get(oldp1, oldp1) | 760 newp1 = replacements.get(oldp1, oldp1) |
763 if newp1 != oldp1: | 761 if newp1 != oldp1: |
762 assert repo.dirstate.p2() == nullid | |
764 with repo.dirstate.parentchange(): | 763 with repo.dirstate.parentchange(): |
765 scmutil.movedirstate(repo, repo[newp1]) | 764 scmutil.movedirstate(repo, repo[newp1]) |
766 | 765 |
767 | 766 |
768 def replacerev(ui, repo, ctx, filedata, replacements): | 767 def replacerev(ui, repo, ctx, filedata, replacements): |