1
*** modified file 'bzrlib/commands.py'
6
takes_args = ["filename"]
7
def run(self, filename):
8
+ from bzrlib.log import find_touching_revisions
9
b = Branch(filename, lock_mode='r')
10
inv = b.read_working_inventory()
11
file_id = inv.path2id(b.relpath(filename))
12
- for revno, revision_id, what in bzrlib.log.find_touching_revisions(b, file_id):
13
- print "%6d %s" % (revno, what)
14
+ rh = b.revision_history()
15
+ for revision_id, what in find_touching_revisions(b, file_id, rh):
16
+ print "%-40s %s" % (revision_id, what)
19
class cmd_ls(Command):
21
*** modified file 'bzrlib/log.py'
28
-def find_touching_revisions(branch, file_id):
29
+def find_touching_revisions(branch, file_id, revisions):
30
"""Yield a description of revisions which affect the file_id.
32
Each returned element is (revno, revision_id, description)
34
This is the list of revisions where the file is either added,
35
modified, renamed or deleted.
37
- TODO: Perhaps some way to limit this to only particular revisions,
38
- or to traverse a non-mainline set of revisions?
46
+ Sequence of revisions to search, can be
47
+ branch.revision_history() or a filtered version of that
48
+ or some sequence of non-mailine revisions.
53
- for revision_id in branch.revision_history():
54
+ for revision_id in revisions:
55
this_inv = branch.get_revision_inventory(revision_id)
56
if file_id in this_inv:
57
this_ie = this_inv[file_id]
59
# not present in either
61
elif this_ie and not last_ie:
62
- yield revno, revision_id, "added " + this_path
63
+ yield revision_id, "added " + this_path
64
elif not this_ie and last_ie:
66
- yield revno, revision_id, "deleted " + last_path
67
+ yield revision_id, "deleted " + last_path
68
elif this_path != last_path:
69
- yield revno, revision_id, ("renamed %s => %s" % (last_path, this_path))
70
+ yield revision_id, ("renamed %s => %s" % (last_path, this_path))
71
elif (this_ie.text_size != last_ie.text_size
72
or this_ie.text_sha1 != last_ie.text_sha1):
73
- yield revno, revision_id, "modified " + this_path
74
+ yield revision_id, "modified " + this_path