1110
1110
lf.log_revision(lr)
1113
def _get_fileid_to_log(revision, tree, b, fp):
1114
"""Find the file-id to log for a file path in a revision range.
1116
:param revision: the revision range as parsed on the command line
1117
:param tree: the working tree, if any
1118
:param b: the branch
1119
:param fp: file path
1121
if revision is None:
1123
tree = b.basis_tree()
1124
file_id = tree.path2id(fp)
1126
# go back to when time began
1127
rev1 = b.get_rev_id(1)
1128
tree = b.repository.revision_tree(rev1)
1129
file_id = tree.path2id(fp)
1131
elif len(revision) == 1:
1132
# One revision given - file must exist in it
1133
tree = revision[0].as_tree(b)
1134
file_id = tree.path2id(fp)
1136
elif len(revision) == 2:
1137
# Revision range given. Get the file-id from the end tree.
1138
# If that fails, try the start tree.
1139
rev_id = revision[1].as_revision_id(b)
1141
tree = b.basis_tree()
1143
tree = revision[1].as_tree(b)
1144
file_id = tree.path2id(fp)
1146
rev_id = revision[0].as_revision_id(b)
1148
rev1 = b.get_rev_id(1)
1149
tree = b.repository.revision_tree(rev1)
1151
tree = revision[0].as_tree(b)
1152
file_id = tree.path2id(fp)
1154
raise errors.BzrCommandError(
1155
'bzr log --revision takes one or two values.')
1113
1159
properties_handler_registry = registry.Registry()
1114
1160
properties_handler_registry.register_lazy("foreign",
1115
1161
"bzrlib.foreign",