Mercurial > hg
comparison mercurial/util.py @ 13910:93452579df9e
audit: improve nested repo message
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 07 Apr 2011 14:43:19 -0500 |
parents | 31eb145b50b6 |
children | 98ee3dd5bab4 |
comparison
equal
deleted
inserted
replaced
13909:184cf2fa1046 | 13910:93452579df9e |
---|---|
528 lparts = [p.lower() for p in parts] | 528 lparts = [p.lower() for p in parts] |
529 for p in '.hg', '.hg.': | 529 for p in '.hg', '.hg.': |
530 if p in lparts[1:]: | 530 if p in lparts[1:]: |
531 pos = lparts.index(p) | 531 pos = lparts.index(p) |
532 base = os.path.join(*parts[:pos]) | 532 base = os.path.join(*parts[:pos]) |
533 raise Abort(_('path %r is inside repo %r') % (path, base)) | 533 raise Abort(_('path %r is inside nested repo %r') |
534 % (path, base)) | |
534 def check(prefix): | 535 def check(prefix): |
535 curpath = os.path.join(self.root, prefix) | 536 curpath = os.path.join(self.root, prefix) |
536 try: | 537 try: |
537 st = os.lstat(curpath) | 538 st = os.lstat(curpath) |
538 except OSError, err: | 539 except OSError, err: |
545 raise Abort(_('path %r traverses symbolic link %r') % | 546 raise Abort(_('path %r traverses symbolic link %r') % |
546 (path, prefix)) | 547 (path, prefix)) |
547 elif (stat.S_ISDIR(st.st_mode) and | 548 elif (stat.S_ISDIR(st.st_mode) and |
548 os.path.isdir(os.path.join(curpath, '.hg'))): | 549 os.path.isdir(os.path.join(curpath, '.hg'))): |
549 if not self.callback or not self.callback(curpath): | 550 if not self.callback or not self.callback(curpath): |
550 raise Abort(_('path %r is inside repo %r') % | 551 raise Abort(_('path %r is inside nested repo %r') % |
551 (path, prefix)) | 552 (path, prefix)) |
552 parts.pop() | 553 parts.pop() |
553 prefixes = [] | 554 prefixes = [] |
554 while parts: | 555 while parts: |
555 prefix = os.sep.join(parts) | 556 prefix = os.sep.join(parts) |