changeset 17559:83785bb56062

scmutil: make join cheaper Combined with a few followup patches, this contributes to improving stream_out performance by 10%.
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 14 Sep 2012 12:07:33 -0700
parents 380a89413403
children 9ee25d7b1aed
files mercurial/scmutil.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Fri Sep 14 12:06:40 2012 -0700
+++ b/mercurial/scmutil.py	Fri Sep 14 12:07:33 2012 -0700
@@ -229,6 +229,7 @@
         if expand:
             base = os.path.realpath(util.expandpath(base))
         self.base = base
+        self.basesep = self.base + os.sep
         self._setmustaudit(audit)
         self.createmode = None
         self._trustnlink = None
@@ -331,9 +332,8 @@
 
     def join(self, path):
         if path:
-            return os.path.join(self.base, path)
-        else:
-            return self.base
+            return path.startswith('/') and path or (self.basesep + path)
+        return self.base
 
 class filteropener(abstractopener):
     '''Wrapper opener for filtering filenames with a function.'''