comparison mercurial/dirstate.py @ 24635:21e1ece30f8c

util: move dirs() and finddirs() from scmutil to util An upcoming commit requires that match.py be able to call scmutil.dirs(), but when match.py imports scmutil, a dependency cycle is created. This commit avoids the cycle by moving dirs() and its related finddirs() function from scmutil to util, which match.py already depends on.
author Drew Gottlieb <drgott@google.com>
date Mon, 06 Apr 2015 14:36:08 -0700
parents b2fb1403994e
children cb981009d697
comparison
equal deleted inserted replaced
24634:4ece2847cf4c 24635:21e1ece30f8c
137 raise 137 raise
138 return [nullid, nullid] 138 return [nullid, nullid]
139 139
140 @propertycache 140 @propertycache
141 def _dirs(self): 141 def _dirs(self):
142 return scmutil.dirs(self._map, 'r') 142 return util.dirs(self._map, 'r')
143 143
144 def dirs(self): 144 def dirs(self):
145 return self._dirs 145 return self._dirs
146 146
147 @rootcache('.hgignore') 147 @rootcache('.hgignore')
379 if state == 'a' or oldstate == 'r': 379 if state == 'a' or oldstate == 'r':
380 scmutil.checkfilename(f) 380 scmutil.checkfilename(f)
381 if f in self._dirs: 381 if f in self._dirs:
382 raise util.Abort(_('directory %r already in dirstate') % f) 382 raise util.Abort(_('directory %r already in dirstate') % f)
383 # shadows 383 # shadows
384 for d in scmutil.finddirs(f): 384 for d in util.finddirs(f):
385 if d in self._dirs: 385 if d in self._dirs:
386 break 386 break
387 if d in self._map and self[d] != 'r': 387 if d in self._map and self[d] != 'r':
388 raise util.Abort( 388 raise util.Abort(
389 _('file %r in dirstate clashes with %r') % (d, f)) 389 _('file %r in dirstate clashes with %r') % (d, f))
599 def _dirignore(self, f): 599 def _dirignore(self, f):
600 if f == '.': 600 if f == '.':
601 return False 601 return False
602 if self._ignore(f): 602 if self._ignore(f):
603 return True 603 return True
604 for p in scmutil.finddirs(f): 604 for p in util.finddirs(f):
605 if self._ignore(p): 605 if self._ignore(p):
606 return True 606 return True
607 return False 607 return False
608 608
609 def _walkexplicit(self, match, subrepos): 609 def _walkexplicit(self, match, subrepos):
696 except OSError, inst: # nf not found on disk - it is dirstate only 696 except OSError, inst: # nf not found on disk - it is dirstate only
697 if nf in dmap: # does it exactly match a missing file? 697 if nf in dmap: # does it exactly match a missing file?
698 results[nf] = None 698 results[nf] = None
699 else: # does it match a missing directory? 699 else: # does it match a missing directory?
700 if alldirs is None: 700 if alldirs is None:
701 alldirs = scmutil.dirs(dmap) 701 alldirs = util.dirs(dmap)
702 if nf in alldirs: 702 if nf in alldirs:
703 if matchedir: 703 if matchedir:
704 matchedir(nf) 704 matchedir(nf)
705 notfoundadd(nf) 705 notfoundadd(nf)
706 else: 706 else: