Mercurial > hg-stable
changeset 48543:608a35db186c
filemerge: stop returning always-`True` value
Now that we've removed some more leftovers from "merge driver", it's
clear that the first element of `filemerge()`'s return value is always
`True`.
Differential Revision: https://phab.mercurial-scm.org/D11885
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 07 Dec 2021 21:17:18 -0800 |
parents | 40522aea2f27 |
children | 58a3be48ddd2 |
files | hgext/largefiles/overrides.py mercurial/filemerge.py mercurial/mergestate.py |
diffstat | 3 files changed, 25 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Mon Dec 06 13:43:00 2021 -0800 +++ b/hgext/largefiles/overrides.py Tue Dec 07 21:17:18 2021 -0800 @@ -695,7 +695,7 @@ ) ): repo.wwrite(fcd.path(), fco.data(), fco.flags()) - return True, 0, False + return 0, False @eh.wrapfunction(copiesmod, b'pathcopies')
--- a/mercurial/filemerge.py Mon Dec 06 13:43:00 2021 -0800 +++ b/mercurial/filemerge.py Tue Dec 07 21:17:18 2021 -0800 @@ -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()
--- a/mercurial/mergestate.py Mon Dec 06 13:43:00 2021 -0800 +++ b/mercurial/mergestate.py Tue Dec 07 21:17:18 2021 -0800 @@ -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