[Updated] [+-- ] D11885: filemerge: stop returning always-`True` value
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Dec 14 21:43:59 UTC 2021
martinvonz updated this revision to Diff 31486.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D11885?vs=31373&id=31486
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D11885/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D11885
AFFECTED FILES
hgext/largefiles/overrides.py
mercurial/filemerge.py
mercurial/mergestate.py
CHANGE DETAILS
diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -354,7 +354,7 @@
self._restore_backup(wctx[dfile], localkey, flags)
else:
wctx[dfile].remove(ignoremissing=True)
- complete, merge_ret, deleted = filemerge.filemerge(
+ merge_ret, deleted = filemerge.filemerge(
self._repo,
wctx,
self._local,
@@ -371,26 +371,25 @@
elif not merge_ret:
self.mark(dfile, MERGE_RECORD_RESOLVED)
- if complete:
- action = None
- if deleted:
- if fcd.isabsent():
- # dc: local picked. Need to drop if present, which may
- # happen on re-resolves.
- action = ACTION_FORGET
+ action = None
+ if deleted:
+ if fcd.isabsent():
+ # dc: local picked. Need to drop if present, which may
+ # happen on re-resolves.
+ action = ACTION_FORGET
+ else:
+ # cd: remote picked (or otherwise deleted)
+ action = ACTION_REMOVE
+ else:
+ if fcd.isabsent(): # dc: remote picked
+ action = ACTION_GET
+ elif fco.isabsent(): # cd: local picked
+ if dfile in self.localctx:
+ action = ACTION_ADD_MODIFIED
else:
- # cd: remote picked (or otherwise deleted)
- action = ACTION_REMOVE
- else:
- if fcd.isabsent(): # dc: remote picked
- action = ACTION_GET
- elif fco.isabsent(): # cd: local picked
- if dfile in self.localctx:
- action = ACTION_ADD_MODIFIED
- else:
- action = ACTION_ADD
- # else: regular merges (no action necessary)
- self._results[dfile] = merge_ret, action
+ action = ACTION_ADD
+ # else: regular merges (no action necessary)
+ self._results[dfile] = merge_ret, action
return merge_ret
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -1031,7 +1031,7 @@
a boolean indicating whether the file was deleted from disk."""
if not fco.cmp(fcd): # files identical?
- return True, None, False
+ return None, False
ui = repo.ui
fd = fcd.path()
@@ -1089,8 +1089,7 @@
toolconf = tool, toolpath, binary, symlink, scriptfn
if mergetype == nomerge:
- r, deleted = func(repo, mynode, fcd, fco, fca, toolconf, labels)
- return True, r, deleted
+ return func(repo, mynode, fcd, fco, fca, toolconf, labels)
if orig != fco.path():
ui.status(
@@ -1109,7 +1108,7 @@
b'in-memory merge does not support merge conflicts'
)
ui.warn(onfailure % fduipath)
- return True, 1, False
+ return 1, False
backup = _makebackup(repo, ui, wctx, fcd)
r = 1
@@ -1150,7 +1149,7 @@
)
# we're done if premerge was successful (r is 0)
if not r:
- return not r, r, False
+ return r, False
needcheck, r, deleted = func(
repo,
@@ -1177,7 +1176,7 @@
ui.warn(onfailure % fduipath)
_onfilemergefailure(ui)
- return True, r, deleted
+ return r, deleted
finally:
if not r and backup is not None:
backup.remove()
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -695,7 +695,7 @@
)
):
repo.wwrite(fcd.path(), fco.data(), fco.flags())
- return True, 0, False
+ return 0, False
@eh.wrapfunction(copiesmod, b'pathcopies')
To: martinvonz, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211214/9572520f/attachment-0002.html>
More information about the Mercurial-patches
mailing list