mercurial/pathutil.py
changeset 36649 d3b893ec5f08
parent 36647 052351e3e1cd
child 38592 21be76e07148
equal deleted inserted replaced
36648:6585ac350fd9 36649:d3b893ec5f08
    79             for p in '.hg', '.hg.':
    79             for p in '.hg', '.hg.':
    80                 if p in lparts[1:]:
    80                 if p in lparts[1:]:
    81                     pos = lparts.index(p)
    81                     pos = lparts.index(p)
    82                     base = os.path.join(*parts[:pos])
    82                     base = os.path.join(*parts[:pos])
    83                     raise error.Abort(_("path '%s' is inside nested repo %r")
    83                     raise error.Abort(_("path '%s' is inside nested repo %r")
    84                                      % (path, base))
    84                                       % (path, pycompat.bytestr(base)))
    85 
    85 
    86         normparts = util.splitpath(normpath)
    86         normparts = util.splitpath(normpath)
    87         assert len(parts) == len(normparts)
    87         assert len(parts) == len(normparts)
    88 
    88 
    89         parts.pop()
    89         parts.pop()
   117             # They must be ignored for patterns can be checked too.
   117             # They must be ignored for patterns can be checked too.
   118             if err.errno not in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL):
   118             if err.errno not in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL):
   119                 raise
   119                 raise
   120         else:
   120         else:
   121             if stat.S_ISLNK(st.st_mode):
   121             if stat.S_ISLNK(st.st_mode):
   122                 msg = _('path %r traverses symbolic link %r') % (path, prefix)
   122                 msg = (_('path %r traverses symbolic link %r')
       
   123                        % (pycompat.bytestr(path), pycompat.bytestr(prefix)))
   123                 raise error.Abort(msg)
   124                 raise error.Abort(msg)
   124             elif (stat.S_ISDIR(st.st_mode) and
   125             elif (stat.S_ISDIR(st.st_mode) and
   125                   os.path.isdir(os.path.join(curpath, '.hg'))):
   126                   os.path.isdir(os.path.join(curpath, '.hg'))):
   126                 if not self.callback or not self.callback(curpath):
   127                 if not self.callback or not self.callback(curpath):
   127                     msg = _("path '%s' is inside nested repo %r")
   128                     msg = _("path '%s' is inside nested repo %r")
   128                     raise error.Abort(msg % (path, prefix))
   129                     raise error.Abort(msg % (path, pycompat.bytestr(prefix)))
   129 
   130 
   130     def check(self, path):
   131     def check(self, path):
   131         try:
   132         try:
   132             self(path)
   133             self(path)
   133             return True
   134             return True