comparison mercurial/scmutil.py @ 16199:8181bd808dc5 stable

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.
author Idan Kamara <idankk86@gmail.com>
date Thu, 01 Mar 2012 17:39:58 +0200
parents fa8488565afd
children 85db991780b7
comparison
equal deleted inserted replaced
16198:fa8488565afd 16199:8181bd808dc5
209 if self._audit: 209 if self._audit:
210 r = util.checkosfilename(path) 210 r = util.checkosfilename(path)
211 if r: 211 if r:
212 raise util.Abort("%s: %r" % (r, path)) 212 raise util.Abort("%s: %r" % (r, path))
213 self.auditor(path) 213 self.auditor(path)
214 f = os.path.join(self.base, path) 214 f = self.join(path)
215 215
216 if not text and "b" not in mode: 216 if not text and "b" not in mode:
217 mode += "b" # for that other OS 217 mode += "b" # for that other OS
218 218
219 nlink = -1 219 nlink = -1
253 self._fixfilemode(f) 253 self._fixfilemode(f)
254 return fp 254 return fp
255 255
256 def symlink(self, src, dst): 256 def symlink(self, src, dst):
257 self.auditor(dst) 257 self.auditor(dst)
258 linkname = os.path.join(self.base, dst) 258 linkname = self.join(dst)
259 try: 259 try:
260 os.unlink(linkname) 260 os.unlink(linkname)
261 except OSError: 261 except OSError:
262 pass 262 pass
263 263
277 f.close() 277 f.close()
278 self._fixfilemode(dst) 278 self._fixfilemode(dst)
279 279
280 def audit(self, path): 280 def audit(self, path):
281 self.auditor(path) 281 self.auditor(path)
282
283 def join(self, path):
284 return os.path.join(self.base, path)
282 285
283 class filteropener(abstractopener): 286 class filteropener(abstractopener):
284 '''Wrapper opener for filtering filenames with a function.''' 287 '''Wrapper opener for filtering filenames with a function.'''
285 288
286 def __init__(self, opener, filter): 289 def __init__(self, opener, filter):