equal
deleted
inserted
replaced
419 path = os.path.relpath(path, self.base) |
419 path = os.path.relpath(path, self.base) |
420 r = util.checkosfilename(path) |
420 r = util.checkosfilename(path) |
421 if r: |
421 if r: |
422 raise error.Abort(b"%s: %r" % (r, path)) |
422 raise error.Abort(b"%s: %r" % (r, path)) |
423 self.audit(path, mode=mode) |
423 self.audit(path, mode=mode) |
|
424 |
|
425 def isfileorlink_checkdir( |
|
426 self, dircache, path: Optional[bytes] = None |
|
427 ) -> bool: |
|
428 """return True if the path is a regular file or a symlink and |
|
429 the directories along the path are "normal", that is |
|
430 not symlinks or nested hg repositories.""" |
|
431 try: |
|
432 for prefix in pathutil.finddirs_rev_noroot(util.localpath(path)): |
|
433 if prefix in dircache: |
|
434 res = dircache[prefix] |
|
435 else: |
|
436 res = self.audit._checkfs_exists(prefix, path) |
|
437 dircache[prefix] = res |
|
438 if not res: |
|
439 return False |
|
440 except (OSError, error.Abort): |
|
441 return False |
|
442 return self.isfileorlink(path) |
424 |
443 |
425 def __call__( |
444 def __call__( |
426 self, |
445 self, |
427 path: bytes, |
446 path: bytes, |
428 mode: bytes = b"rb", |
447 mode: bytes = b"rb", |