changeset 41570:1f2714052d7e

merge: don't unnecessarily calculate absolute path I think this also makes the code clearer (and prepares for a later patch that replaces origpath()). Differential Revision: https://phab.mercurial-scm.org/D5849
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 04 Feb 2019 21:23:44 -0800
parents ef2295651351
children f9ad1b65d3c3
files mercurial/merge.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Mon Feb 04 21:21:55 2019 -0800
+++ b/mercurial/merge.py	Mon Feb 04 21:23:44 2019 -0800
@@ -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()