/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Ian Clatworthy
  • Date: 2009-01-29 07:53:46 UTC
  • mto: (3972.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 3973.
  • Revision ID: ian.clatworthy@canonical.com-20090129075346-4zyjjh9a0yw07t42
review feedback from vila

Show diffs side-by-side

added added

removed removed

Lines of Context:
1110
1110
        lf.log_revision(lr)
1111
1111
 
1112
1112
 
 
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.
 
1115
 
 
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
 
1120
    """
 
1121
    if revision is None:
 
1122
        if tree is None:
 
1123
            tree = b.basis_tree()
 
1124
        file_id = tree.path2id(fp)
 
1125
        if file_id is None:
 
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)
 
1130
 
 
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)
 
1135
 
 
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)
 
1140
        if rev_id is None:
 
1141
            tree = b.basis_tree()
 
1142
        else:
 
1143
            tree = revision[1].as_tree(b)
 
1144
        file_id = tree.path2id(fp)
 
1145
        if file_id is None:
 
1146
            rev_id = revision[0].as_revision_id(b)
 
1147
            if rev_id is None:
 
1148
                rev1 = b.get_rev_id(1)
 
1149
                tree = b.repository.revision_tree(rev1)
 
1150
            else:
 
1151
                tree = revision[0].as_tree(b)
 
1152
            file_id = tree.path2id(fp)
 
1153
    else:
 
1154
        raise errors.BzrCommandError(
 
1155
            'bzr log --revision takes one or two values.')
 
1156
    return file_id
 
1157
 
 
1158
 
1113
1159
properties_handler_registry = registry.Registry()
1114
1160
properties_handler_registry.register_lazy("foreign",
1115
1161
                                          "bzrlib.foreign",