# HG changeset patch # User Bryan O'Sullivan # Date 2012-09-14 19:07:33 # Node ID 83785bb5606291e679d9a868d4a3bede152c34fd # Parent 380a89413403ef99ee1c435292938dac1195fcab scmutil: make join cheaper Combined with a few followup patches, this contributes to improving stream_out performance by 10%. diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -229,6 +229,7 @@ class opener(abstractopener): 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 @@ class opener(abstractopener): 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.'''