equal
deleted
inserted
replaced
23 self.map = None |
23 self.map = None |
24 self.pl = None |
24 self.pl = None |
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) |
32 |
31 |
33 def getcwd(self): |
32 def getcwd(self): |
96 |
95 |
97 def ignore(self, fn): |
96 def ignore(self, fn): |
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 = [] |
106 [allpats.extend(patlist) for patlist in ignore.values()] |
103 [allpats.extend(patlist) for patlist in ignore.values()] |
107 if allpats: |
104 if allpats: |
377 dc = self.map.copy() |
374 dc = self.map.copy() |
378 else: |
375 else: |
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_) |
|
382 |
|
383 if ignored: imatch = match |
386 |
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('/'): |
390 common_prefix_len += 1 |
388 common_prefix_len += 1 |
413 continue |
411 continue |
414 p = os.path.join(top, f) |
412 p = os.path.join(top, f) |
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: |
422 yield 'm', np, st |
420 yield 'm', np, st |
423 elif imatch(np): |
421 elif imatch(np): |
447 if not found: |
445 if not found: |
448 if inst.errno != errno.ENOENT or not badmatch: |
446 if inst.errno != errno.ENOENT or not badmatch: |
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): |
456 cmp1 = (lambda x, y: cmp(x[1], y[1])) |
454 cmp1 = (lambda x, y: cmp(x[1], y[1])) |
457 sorted_ = [ x for x in findfiles(f) ] |
455 sorted_ = [ x for x in findfiles(f) ] |
460 yield e |
458 yield e |
461 else: |
459 else: |
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 |
475 ks = dc.keys() |
471 ks = dc.keys() |
476 ks.sort() |
472 ks.sort() |