D5849: merge: don't unnecessarily calculate absolute path
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Feb 5 17:27:09 UTC 2019
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
I think this also makes the code clearer (and prepares for the next
patch).
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5849
AFFECTED FILES
mercurial/merge.py
CHANGE DETAILS
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1499,13 +1499,14 @@
# If a file or directory exists with the same name, back that
# up. Otherwise, look to see if there is a file that conflicts
# with a directory this file is in, and if so, back that up.
- absf = repo.wjoin(f)
+ conflicting = f
if not repo.wvfs.lexists(f):
for p in util.finddirs(f):
if repo.wvfs.isfileorlink(p):
- absf = repo.wjoin(p)
+ conflicting = p
break
- if repo.wvfs.lexists(absf):
+ if repo.wvfs.lexists(conflicting):
+ absf = repo.wjoin(conflicting)
orig = scmutil.origpath(ui, repo, absf)
util.rename(absf, orig)
wctx[f].clearunknown()
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list