D12153: mergestate: use an early return for trivial merges
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Feb 8 21:28:21 UTC 2022
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
`filemerge.filemerge()` returns `None` if no merge was needed because
the two sides were identical. I'd like to move that to the
caller. This is a little refactoring to prepare for that.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D12153
AFFECTED FILES
mercurial/mergestate.py
CHANGE DETAILS
diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -434,8 +434,11 @@
if merge_ret is None:
# If return value of merge is None, then there are no real conflict
del self._state[dfile]
+ self._results[dfile] = None, None
self._dirty = True
- elif not merge_ret:
+ return None
+
+ if not merge_ret:
self.mark(dfile, MERGE_RECORD_RESOLVED)
action = None
To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list