Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 44856:b7808443ed6a
mergestate: split out merge state handling code from main merge module
There's already some pretty reasonable encapsulation here, but I want
to make the mergestate storage a property of the context so memctx
instances can do a reasonable thing. This is the first step in a
reshuffle to make that easier.
Differential Revision: https://phab.mercurial-scm.org/D8550
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 18 May 2020 14:59:59 -0400 |
parents | fd3b94f1712d |
children | edd08aa193fb |
comparison
equal
deleted
inserted
replaced
44855:1d2d353e5c4a | 44856:b7808443ed6a |
---|---|
42 extensions, | 42 extensions, |
43 filelog, | 43 filelog, |
44 hook, | 44 hook, |
45 lock as lockmod, | 45 lock as lockmod, |
46 match as matchmod, | 46 match as matchmod, |
47 merge as mergemod, | 47 mergestate as mergestatemod, |
48 mergeutil, | 48 mergeutil, |
49 namespaces, | 49 namespaces, |
50 narrowspec, | 50 narrowspec, |
51 obsolete, | 51 obsolete, |
52 pathutil, | 52 pathutil, |
2466 ) | 2466 ) |
2467 else: | 2467 else: |
2468 ui.status( | 2468 ui.status( |
2469 _(b'working directory now based on revision %d\n') % parents | 2469 _(b'working directory now based on revision %d\n') % parents |
2470 ) | 2470 ) |
2471 mergemod.mergestate.clean(self, self[b'.'].node()) | 2471 mergestatemod.mergestate.clean(self, self[b'.'].node()) |
2472 | 2472 |
2473 # TODO: if we know which new heads may result from this rollback, pass | 2473 # TODO: if we know which new heads may result from this rollback, pass |
2474 # them to destroy(), which will prevent the branchhead cache from being | 2474 # them to destroy(), which will prevent the branchhead cache from being |
2475 # invalidated. | 2475 # invalidated. |
2476 self.destroyed() | 2476 self.destroyed() |
2865 fparent1, fparent2 = fparent2, nullid | 2865 fparent1, fparent2 = fparent2, nullid |
2866 elif fparent2 in fparentancestors: | 2866 elif fparent2 in fparentancestors: |
2867 fparent2 = nullid | 2867 fparent2 = nullid |
2868 elif not fparentancestors: | 2868 elif not fparentancestors: |
2869 # TODO: this whole if-else might be simplified much more | 2869 # TODO: this whole if-else might be simplified much more |
2870 ms = mergemod.mergestate.read(self) | 2870 ms = mergestatemod.mergestate.read(self) |
2871 if ( | 2871 if ( |
2872 fname in ms | 2872 fname in ms |
2873 and ms[fname] == mergemod.MERGE_RECORD_MERGED_OTHER | 2873 and ms[fname] == mergestatemod.MERGE_RECORD_MERGED_OTHER |
2874 ): | 2874 ): |
2875 fparent1, fparent2 = fparent2, nullid | 2875 fparent1, fparent2 = fparent2, nullid |
2876 | 2876 |
2877 # is the file changed? | 2877 # is the file changed? |
2878 text = fctx.data() | 2878 text = fctx.data() |
2966 | 2966 |
2967 cctx = context.workingcommitctx( | 2967 cctx = context.workingcommitctx( |
2968 self, status, text, user, date, extra | 2968 self, status, text, user, date, extra |
2969 ) | 2969 ) |
2970 | 2970 |
2971 ms = mergemod.mergestate.read(self) | 2971 ms = mergestatemod.mergestate.read(self) |
2972 mergeutil.checkunresolved(ms) | 2972 mergeutil.checkunresolved(ms) |
2973 | 2973 |
2974 # internal config: ui.allowemptycommit | 2974 # internal config: ui.allowemptycommit |
2975 allowemptycommit = ( | 2975 allowemptycommit = ( |
2976 wctx.branch() != wctx.p1().branch() | 2976 wctx.branch() != wctx.p1().branch() |