14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
def find_touching_revisions(branch, file_id):
21
"""Yield a description of revisions which affect the file_id.
23
Each returned element is (revno, revision_id, description)
25
This is the list of revisions where the file is either added,
26
modified, renamed or deleted.
28
Revisions are returned in chronological order.
30
TODO: Perhaps some way to limit this to only particular revisions,
31
or to traverse a non-branch set of revisions?
36
for revision_id in branch.revision_history():
37
this_inv = branch.get_revision_inventory(revision_id)
38
if file_id in this_inv:
39
this_ie = this_inv[file_id]
40
this_path = this_inv.id2path(file_id)
42
this_ie = this_path = None
44
# now we know how it was last time, and how it is in this revision.
45
# are those two states effectively the same or not?
47
if not this_ie and not last_ie:
48
# not present in either
50
elif this_ie and not last_ie:
51
yield revno, revision_id, "added " + this_path
52
elif not this_ie and last_ie:
54
yield revno, revision_id, "deleted " + last_path
55
elif this_path != last_path:
56
yield revno, revision_id, ("renamed %s => %s" % (last_path, this_path))
57
elif (this_ie.text_size != last_ie.text_size
58
or this_ie.text_sha1 != last_ie.text_sha1):
59
yield revno, revision_id, "modified " + this_path
17
66
def show_log(branch, show_timezone='original', verbose=False,