[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:38:08 UTC 2020
Closed by commit rHG5d8ae9248a70: scmutil: speed up relativization of paths when it's a no-op (authored by valentin.gatienbaron).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8585?vs=21472&id=21481
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 is correct when cwd == b'', ie cwd = repo root,
+ # but it's 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/ce2a4691/attachment-0002.html>
More information about the Mercurial-patches
mailing list