[Updated] D8585: scmutil: speed up relativization of paths when it's a no-op
valentin.gatienbaron (Valentin Gatien-Baron)
phabricator at mercurial-scm.org
Tue May 26 16:40:02 UTC 2020
valentin.gatienbaron edited the summary of this revision.
valentin.gatienbaron updated this revision to Diff 21484.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8585?vs=21481&id=21484
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8585/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8585
AFFECTED FILES
mercurial/scmutil.py
CHANGE DETAILS
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -803,9 +803,12 @@
if relative:
cwd = repo.getcwd()
- pathto = repo.pathto
- return lambda f: pathto(f, cwd)
- elif repo.ui.configbool(b'ui', b'slash'):
+ if cwd != b'':
+ # this branch would work even if cwd == b'' (ie cwd = repo
+ # root), but its generality makes the returned function slower
+ pathto = repo.pathto
+ return lambda f: pathto(f, cwd)
+ if repo.ui.configbool(b'ui', b'slash'):
return lambda f: f
else:
return util.localpath
To: valentin.gatienbaron, #hg-reviewers, marmoute, durin42
Cc: durin42, marmoute, joerg.sonnenberger, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200526/3e99896b/attachment-0002.html>
More information about the Mercurial-patches
mailing list