##// END OF EJS Templates
Simplify ignore logic in dirstate.walk...
Matt Mackall -
r3534:549cb7b6 default
parent child Browse files
Show More
@@ -25,7 +25,6 b' class dirstate(object):'
25 self.dirs = None
25 self.dirs = None
26 self.copymap = {}
26 self.copymap = {}
27 self.ignorefunc = None
27 self.ignorefunc = None
28 self.blockignore = False
29
28
30 def wjoin(self, f):
29 def wjoin(self, f):
31 return os.path.join(self.root, f)
30 return os.path.join(self.root, f)
@@ -98,8 +97,6 b' class dirstate(object):'
98 '''default match function used by dirstate and
97 '''default match function used by dirstate and
99 localrepository. this honours the repository .hgignore file
98 localrepository. this honours the repository .hgignore file
100 and any other files specified in the [ui] section of .hgrc.'''
99 and any other files specified in the [ui] section of .hgrc.'''
101 if self.blockignore:
102 return False
103 if not self.ignorefunc:
100 if not self.ignorefunc:
104 ignore = self.hgignore()
101 ignore = self.hgignore()
105 allpats = []
102 allpats = []
@@ -379,11 +376,12 b' class dirstate(object):'
379 dc = self.filterfiles(files)
376 dc = self.filterfiles(files)
380
377
381 def imatch(file_):
378 def imatch(file_):
382 file_ = util.pconvert(file_)
379 if file_ not in dc and self.ignore(file_):
383 if not ignored and file_ not in dc and self.ignore(file_):
384 return False
380 return False
385 return match(file_)
381 return match(file_)
386
382
383 if ignored: imatch = match
384
387 # self.root may end with a path separator when self.root == '/'
385 # self.root may end with a path separator when self.root == '/'
388 common_prefix_len = len(self.root)
386 common_prefix_len = len(self.root)
389 if not self.root.endswith('/'):
387 if not self.root.endswith('/'):
@@ -415,7 +413,7 b' class dirstate(object):'
415 # don't trip over symlinks
413 # don't trip over symlinks
416 st = os.lstat(p)
414 st = os.lstat(p)
417 if stat.S_ISDIR(st.st_mode):
415 if stat.S_ISDIR(st.st_mode):
418 ds = os.path.join(nd, f +'/')
416 ds = util.pconvert(os.path.join(nd, f +'/'))
419 if imatch(ds):
417 if imatch(ds):
420 work.append(p)
418 work.append(p)
421 if imatch(np) and np in dc:
419 if imatch(np) and np in dc:
@@ -449,7 +447,7 b' class dirstate(object):'
449 self.ui.warn('%s: %s\n' % (
447 self.ui.warn('%s: %s\n' % (
450 util.pathto(self.getcwd(), ff),
448 util.pathto(self.getcwd(), ff),
451 inst.strerror))
449 inst.strerror))
452 elif badmatch and badmatch(ff) and imatch(ff):
450 elif badmatch and badmatch(ff) and imatch(nf):
453 yield 'b', ff, None
451 yield 'b', ff, None
454 continue
452 continue
455 if stat.S_ISDIR(st.st_mode):
453 if stat.S_ISDIR(st.st_mode):
@@ -462,13 +460,11 b' class dirstate(object):'
462 ff = util.normpath(ff)
460 ff = util.normpath(ff)
463 if seen(ff):
461 if seen(ff):
464 continue
462 continue
465 self.blockignore = True
463 if match(ff):
466 if imatch(ff):
467 if self.supported_type(ff, st, verbose=True):
464 if self.supported_type(ff, st, verbose=True):
468 yield 'f', ff, st
465 yield 'f', ff, st
469 elif ff in dc:
466 elif ff in dc:
470 yield 'm', ff, st
467 yield 'm', ff, st
471 self.blockignore = False
472
468
473 # step two run through anything left in the dc hash and yield
469 # step two run through anything left in the dc hash and yield
474 # if we haven't already seen it
470 # if we haven't already seen it
General Comments 0
You need to be logged in to leave comments. Login now