# HG changeset patch # User Idan Kamara # Date 2012-03-01 15:39:58 # Node ID 8181bd808dc56e25dd2e49057bec128a05faae45 # Parent fa8488565afde5375feac30b7df4f9352932d2aa scmutil: add join method to opener to construct path relative to base Useful when we only have the opener without the base path used when it was constructed. diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -211,7 +211,7 @@ class opener(abstractopener): if r: raise util.Abort("%s: %r" % (r, path)) self.auditor(path) - f = os.path.join(self.base, path) + f = self.join(path) if not text and "b" not in mode: mode += "b" # for that other OS @@ -255,7 +255,7 @@ class opener(abstractopener): def symlink(self, src, dst): self.auditor(dst) - linkname = os.path.join(self.base, dst) + linkname = self.join(dst) try: os.unlink(linkname) except OSError: @@ -280,6 +280,9 @@ class opener(abstractopener): def audit(self, path): self.auditor(path) + def join(self, path): + return os.path.join(self.base, path) + class filteropener(abstractopener): '''Wrapper opener for filtering filenames with a function.'''