900
901
self._get_submit_location(context_branch))
904
class RevisionSpec_annotate(RevisionIDSpec):
908
help_txt = """Select the revision that last modified the specified line.
910
Select the revision that last modified the specified line. Line is
911
specified as path:number. Path is a relative path to the file. Numbers
912
start at 1, and are relative to the current version, not the last-
913
committed version of the file.
916
def _raise_invalid(self, numstring, context_branch):
917
raise errors.InvalidRevisionSpec(self.user_spec, context_branch,
918
'No such line: %s' % numstring)
920
def _as_revision_id(self, context_branch):
921
path, numstring = self.spec.rsplit(':', 1)
923
index = int(numstring) - 1
925
self._raise_invalid(numstring, context_branch)
926
tree, file_path = workingtree.WorkingTree.open_containing(path)
929
file_id = tree.path2id(file_path)
931
raise errors.InvalidRevisionSpec(self.user_spec,
932
context_branch, "File '%s' is not versioned." %
934
revision_ids = [r for (r, l) in tree.annotate_iter(file_id)]
938
revision_id = revision_ids[index]
940
self._raise_invalid(numstring, context_branch)
941
if revision_id == revision.CURRENT_REVISION:
942
raise errors.InvalidRevisionSpec(self.user_spec, context_branch,
943
'Line %s has not been committed.' % numstring)
903
947
class RevisionSpec_mainline(RevisionIDSpec):
905
949
help_txt = """Select mainline revision that merged the specified revision.
948
992
_register_revspec(RevisionSpec_ancestor)
949
993
_register_revspec(RevisionSpec_branch)
950
994
_register_revspec(RevisionSpec_submit)
995
_register_revspec(RevisionSpec_annotate)
951
996
_register_revspec(RevisionSpec_mainline)
953
998
# classes in this list should have a "prefix" attribute, against which