mercurial/dirstate.py
changeset 43753 deacffd227e2
parent 43752 95d2eab0a7b9
child 43875 cf065c6a0197
equal deleted inserted replaced
43752:95d2eab0a7b9 43753:deacffd227e2
   767                 kind = _(b'socket')
   767                 kind = _(b'socket')
   768             elif stat.S_ISDIR(mode):
   768             elif stat.S_ISDIR(mode):
   769                 kind = _(b'directory')
   769                 kind = _(b'directory')
   770             return _(b'unsupported file type (type is %s)') % kind
   770             return _(b'unsupported file type (type is %s)') % kind
   771 
   771 
   772         matchedir = match.explicitdir
       
   773         badfn = match.bad
   772         badfn = match.bad
   774         dmap = self._map
   773         dmap = self._map
   775         lstat = os.lstat
   774         lstat = os.lstat
   776         getkind = stat.S_IFMT
   775         getkind = stat.S_IFMT
   777         dirkind = stat.S_IFDIR
   776         dirkind = stat.S_IFDIR
   821                 kind = getkind(st.st_mode)
   820                 kind = getkind(st.st_mode)
   822                 if kind == dirkind:
   821                 if kind == dirkind:
   823                     if nf in dmap:
   822                     if nf in dmap:
   824                         # file replaced by dir on disk but still in dirstate
   823                         # file replaced by dir on disk but still in dirstate
   825                         results[nf] = None
   824                         results[nf] = None
   826                     if matchedir:
       
   827                         matchedir(nf)
       
   828                     foundadd((nf, ff))
   825                     foundadd((nf, ff))
   829                 elif kind == regkind or kind == lnkkind:
   826                 elif kind == regkind or kind == lnkkind:
   830                     results[nf] = st
   827                     results[nf] = st
   831                 else:
   828                 else:
   832                     badfn(ff, badtype(kind))
   829                     badfn(ff, badtype(kind))
   835             except OSError as inst:  # nf not found on disk - it is dirstate only
   832             except OSError as inst:  # nf not found on disk - it is dirstate only
   836                 if nf in dmap:  # does it exactly match a missing file?
   833                 if nf in dmap:  # does it exactly match a missing file?
   837                     results[nf] = None
   834                     results[nf] = None
   838                 else:  # does it match a missing directory?
   835                 else:  # does it match a missing directory?
   839                     if self._map.hasdir(nf):
   836                     if self._map.hasdir(nf):
   840                         if matchedir:
       
   841                             matchedir(nf)
       
   842                         notfoundadd(nf)
   837                         notfoundadd(nf)
   843                     else:
   838                     else:
   844                         badfn(ff, encoding.strtolocal(inst.strerror))
   839                         badfn(ff, encoding.strtolocal(inst.strerror))
   845 
   840 
   846         # match.files() may contain explicitly-specified paths that shouldn't
   841         # match.files() may contain explicitly-specified paths that shouldn't