##// END OF EJS Templates
Convert annotate over to walk interface....
Bryan O'Sullivan -
r733:1966c553 default
parent child Browse files
Show More
@@ -39,7 +39,9 b' def relpath(repo, args):'
39 for x in args]
39 for x in args]
40 return args
40 return args
41
41
42 def matchpats(ui, cwd, pats = [], opts = {}):
42 def matchpats(ui, cwd, pats = [], opts = {}, emptyok = True):
43 if not pats and not emptyok:
44 raise Abort('at least one file name or pattern required')
43 head = ''
45 head = ''
44 if opts.get('rootless'): head = '(?:.*/|)'
46 if opts.get('rootless'): head = '(?:.*/|)'
45 def reify(name, tail):
47 def reify(name, tail):
@@ -65,10 +67,10 b' def matchpats(ui, cwd, pats = [], opts ='
65 return lambda fn: (incmatch(fn) and not excmatch(fn) and
67 return lambda fn: (incmatch(fn) and not excmatch(fn) and
66 (fn.endswith('/') or patmatch(fn)))
68 (fn.endswith('/') or patmatch(fn)))
67
69
68 def walk(repo, pats, opts):
70 def walk(repo, pats, opts, emptyok = True):
69 cwd = repo.getcwd()
71 cwd = repo.getcwd()
70 if cwd: c = len(cwd) + 1
72 if cwd: c = len(cwd) + 1
71 for src, fn in repo.walk(match = matchpats(repo.ui, cwd, pats, opts)):
73 for src, fn in repo.walk(match = matchpats(repo.ui, cwd, pats, opts, emptyok)):
72 if cwd: yield src, fn, fn[c:]
74 if cwd: yield src, fn, fn[c:]
73 else: yield src, fn, fn
75 else: yield src, fn, fn
74
76
@@ -361,7 +363,7 b' def addremove(ui, repo, *files):'
361 repo.add(u)
363 repo.add(u)
362 repo.remove(d)
364 repo.remove(d)
363
365
364 def annotate(ui, repo, file1, *files, **opts):
366 def annotate(ui, repo, *pats, **opts):
365 """show changeset information per file line"""
367 """show changeset information per file line"""
366 def getnode(rev):
368 def getnode(rev):
367 return hg.short(repo.changelog.node(rev))
369 return hg.short(repo.changelog.node(rev))
@@ -392,8 +394,8 b' def annotate(ui, repo, file1, *files, **'
392 node = repo.dirstate.parents()[0]
394 node = repo.dirstate.parents()[0]
393 change = repo.changelog.read(node)
395 change = repo.changelog.read(node)
394 mmap = repo.manifest.read(change[0])
396 mmap = repo.manifest.read(change[0])
395 for f in relpath(repo, (file1,) + files):
397 for src, abs, rel in walk(repo, pats, opts, emptyok = False):
396 lines = repo.file(f).annotate(mmap[f])
398 lines = repo.file(abs).annotate(mmap[abs])
397 pieces = []
399 pieces = []
398
400
399 for o, f in opmap:
401 for o, f in opmap:
General Comments 0
You need to be logged in to leave comments. Login now