##// END OF EJS Templates
Add a source designator to the walk methods....
Bryan O'Sullivan -
r726:809a870a default
parent child Browse files
Show More
@@ -65,9 +65,9 b' def matchpats(ui, cwd, pats = [], opts ='
65 65 def walk(repo, pats, opts):
66 66 cwd = repo.getcwd()
67 67 if cwd: c = len(cwd) + 1
68 for fn in repo.walk(match = matchpats(repo.ui, cwd, pats, opts)):
69 if cwd: yield fn, fn[c:]
70 else: yield fn, fn
68 for src, fn in repo.walk(match = matchpats(repo.ui, cwd, pats, opts)):
69 if cwd: yield src, fn, fn[c:]
70 else: yield src, fn, fn
71 71
72 72 revrangesep = ':'
73 73
@@ -325,7 +325,7 b' def add(ui, repo, *pats, **opts):'
325 325 '''add the specified files on the next commit'''
326 326 names = []
327 327 q = dict(zip(pats, pats))
328 for abs, rel in walk(repo, pats, opts):
328 for src, abs, rel in walk(repo, pats, opts):
329 329 if rel in q or abs in q:
330 330 names.append(abs)
331 331 elif repo.dirstate.state(abs) == '?':
@@ -715,7 +715,7 b' def locate(ui, repo, *pats, **opts):'
715 715 if opts['print0']: end = '\0'
716 716 else: end = '\n'
717 717 opts['rootless'] = True
718 for abs, rel in walk(repo, pats, opts):
718 for src, abs, rel in walk(repo, pats, opts):
719 719 if repo.dirstate.state(abs) == '?': continue
720 720 if opts['fullpath']:
721 721 ui.write(os.path.join(repo.root, abs), end)
@@ -434,30 +434,30 b' class dirstate:'
434 434 subdirs.remove(sd)
435 435 for fn in fl:
436 436 fn = util.pconvert(os.path.join(d, fn))
437 yield fn
437 yield 'f', fn
438 438 else:
439 yield f[len(self.root) + 1:]
439 yield 'f', f[len(self.root) + 1:]
440 440
441 441 for k in dc.keys():
442 yield k
442 yield 'm', k
443 443
444 444 # yield only files that match: all in dirstate, others only if
445 445 # not in .hgignore
446 446
447 for fn in util.unique(traverse()):
447 for src, fn in util.unique(traverse()):
448 448 if fn in dc:
449 449 del dc[fn]
450 450 elif self.ignore(fn):
451 451 continue
452 452 if match(fn):
453 yield fn
453 yield src, fn
454 454
455 455 def changes(self, files = None, match = util.always):
456 456 self.read()
457 457 dc = self.map.copy()
458 458 lookup, changed, added, unknown = [], [], [], []
459 459
460 for fn in self.walk(files, match):
460 for src, fn in self.walk(files, match):
461 461 try: s = os.stat(os.path.join(self.root, fn))
462 462 except: continue
463 463
@@ -840,11 +840,11 b' class localrepository:'
840 840
841 841 def walk(self, node = None, files = [], match = util.always):
842 842 if node:
843 change = self.changelog.read(node)
844 fns = filter(match, self.manifest.read(change[0]))
843 for fn in self.manifest.read(self.changelog.read(node)[0]):
844 yield 'm', fn
845 845 else:
846 fns = self.dirstate.walk(files, match)
847 for fn in fns: yield fn
846 for src, fn in self.dirstate.walk(files, match):
847 yield src, fn
848 848
849 849 def changes(self, node1 = None, node2 = None, files = [],
850 850 match = util.always):
General Comments 0
You need to be logged in to leave comments. Login now