1222
1222
lf.log_revision(lr)
1225
def _get_fileid_to_log(revision, tree, b, fp):
1226
"""Find the file-id to log for a file path in a revision range.
1228
:param revision: the revision range as parsed on the command line
1229
:param tree: the working tree, if any
1230
:param b: the branch
1231
:param fp: file path
1233
if revision is None:
1235
tree = b.basis_tree()
1236
file_id = tree.path2id(fp)
1238
# go back to when time began
1240
rev1 = b.get_rev_id(1)
1241
except errors.NoSuchRevision:
1245
tree = b.repository.revision_tree(rev1)
1246
file_id = tree.path2id(fp)
1248
elif len(revision) == 1:
1249
# One revision given - file must exist in it
1250
tree = revision[0].as_tree(b)
1251
file_id = tree.path2id(fp)
1253
elif len(revision) == 2:
1254
# Revision range given. Get the file-id from the end tree.
1255
# If that fails, try the start tree.
1256
rev_id = revision[1].as_revision_id(b)
1258
tree = b.basis_tree()
1260
tree = revision[1].as_tree(b)
1261
file_id = tree.path2id(fp)
1263
rev_id = revision[0].as_revision_id(b)
1265
rev1 = b.get_rev_id(1)
1266
tree = b.repository.revision_tree(rev1)
1268
tree = revision[0].as_tree(b)
1269
file_id = tree.path2id(fp)
1271
raise errors.BzrCommandError(
1272
'bzr log --revision takes one or two values.')
1225
1276
properties_handler_registry = registry.Registry()
1226
1277
properties_handler_registry.register_lazy("foreign",
1227
1278
"bzrlib.foreign",