92
from .tree import find_previous_path
92
from .tree import InterTree
95
95
def find_touching_revisions(repository, last_revision, last_tree, last_path):
109
109
revno = len(history)
110
110
for revision_id in history:
111
111
this_tree = repository.revision_tree(revision_id)
112
this_path = find_previous_path(last_tree, this_tree, last_path)
112
this_intertree = InterTree.get(this_tree, last_tree)
113
this_path = this_intertree.find_source_path(last_path)
114
115
# now we know how it was last time, and how it is in this revision.
115
116
# are those two states effectively the same or not?
155
155
:param lf: The LogFormatter object showing the output.
157
:param specific_fileid: If not None, list only the commits affecting the
158
specified file, rather than all commits.
160
157
:param verbose: If True show added/changed/deleted/renamed files.
162
159
:param direction: 'reverse' (default) is latest to earliest; 'forward' is
177
174
:param match: Dictionary of search lists to use when matching revision
180
# Convert old-style parameters to new-style parameters
181
if specific_fileid is not None:
182
file_ids = [specific_fileid]
187
delta_type = 'partial'
191
180
delta_type = None
194
diff_type = 'partial'
200
186
if isinstance(start_revision, int):
202
188
start_revision = revisionspec.RevisionInfo(branch, start_revision)
203
except errors.NoSuchRevision:
189
except (errors.NoSuchRevision, errors.RevnoOutOfBounds):
204
190
raise errors.InvalidRevisionNumber(start_revision)
206
192
if isinstance(end_revision, int):
208
194
end_revision = revisionspec.RevisionInfo(branch, end_revision)
209
except errors.NoSuchRevision:
195
except (errors.NoSuchRevision, errors.RevnoOutOfBounds):
210
196
raise errors.InvalidRevisionNumber(end_revision)
212
198
if end_revision is not None and end_revision.revno == 0:
213
199
raise errors.InvalidRevisionNumber(end_revision.revno)
215
201
# Build the request and execute it
216
rqst = make_log_request_dict(direction=direction, specific_fileids=file_ids,
217
start_revision=start_revision, end_revision=end_revision,
218
limit=limit, message_search=search,
219
delta_type=delta_type, diff_type=diff_type)
202
rqst = make_log_request_dict(
204
start_revision=start_revision, end_revision=end_revision,
205
limit=limit, message_search=search,
206
delta_type=delta_type, diff_type=diff_type)
220
207
Logger(branch, rqst).show(lf)
747
734
repo = branch.repository
748
735
graph = repo.get_graph()
749
736
if start_rev_id is None and end_rev_id is None:
751
br_revno, br_rev_id = branch.last_revision_info()
752
except errors.GhostRevisionsHaveNoRevno:
737
if branch._format.stores_revno() or \
738
config.GlobalStack().get('calculate_revnos'):
740
br_revno, br_rev_id = branch.last_revision_info()
741
except errors.GhostRevisionsHaveNoRevno:
742
br_rev_id = branch.last_revision()
753
747
br_rev_id = branch.last_revision()
757
750
graph_iter = graph.iter_lefthand_ancestry(br_rev_id,
758
751
(_mod_revision.NULL_REVISION,))
1024
1017
fileids set once their add or remove entry is detected respectively
1026
1019
if stop_on == 'add':
1027
for item in delta.added:
1028
if item[1] in fileids:
1029
fileids.remove(item[1])
1020
for item in delta.added + delta.copied:
1021
if item.file_id in fileids:
1022
fileids.remove(item.file_id)
1030
1023
elif stop_on == 'delete':
1031
1024
for item in delta.removed:
1032
if item[1] in fileids:
1033
fileids.remove(item[1])
1025
if item.file_id in fileids:
1026
fileids.remove(item.file_id)
1036
1029
def _make_revision_objects(branch, generate_delta, search, log_rev_iterator):
1105
1098
raise TypeError(start_revision)
1106
1099
end_rev_id = end_revision.rev_id
1107
1100
end_revno = end_revision.revno
1108
if end_revno is None:
1110
end_revno = branch.revno()
1111
except errors.GhostRevisionsHaveNoRevno:
1114
1102
if branch.last_revision() != _mod_revision.NULL_REVISION:
1115
1103
if (start_rev_id == _mod_revision.NULL_REVISION
1808
1796
if revision.delta is not None and revision.delta.has_changed():
1809
1797
for c in revision.delta.added + revision.delta.removed + revision.delta.modified:
1798
if c.path[0] is None:
1811
1802
to_file.write('\t* %s:\n' % (path,))
1812
for c in revision.delta.renamed:
1813
oldpath, newpath = c[:2]
1803
for c in revision.delta.renamed + revision.delta.copied:
1814
1804
# For renamed files, show both the old and the new path
1815
to_file.write('\t* %s:\n\t* %s:\n' % (oldpath, newpath))
1805
to_file.write('\t* %s:\n\t* %s:\n' % (c.path[0], c.path[1]))
1816
1806
to_file.write('\n')
1818
1808
if not revision.rev.message:
2034
2023
if new_history != []:
2035
2024
output.write('Added Revisions:\n')
2036
2025
start_revno = new_revno - len(new_history) + 1
2037
show_log(branch, lf, None, verbose=False, direction='forward',
2026
show_log(branch, lf, verbose=False, direction='forward',
2038
2027
start_revision=start_revno)
2052
2041
lf.log_revision(lr)
2055
def _get_info_for_log_files(revisionspec_list, file_list, add_cleanup):
2044
def _get_info_for_log_files(revisionspec_list, file_list, exit_stack):
2056
2045
"""Find file-ids and kinds given a list of files and a revision range.
2058
2047
We search for files at the end of the range. If not found there,
2062
2051
:param file_list: the list of paths given on the command line;
2063
2052
the first of these can be a branch location or a file path,
2064
2053
the remainder must be file paths
2065
:param add_cleanup: When the branch returned is read locked,
2066
an unlock call will be queued to the cleanup.
2054
:param exit_stack: When the branch returned is read locked,
2055
an unlock call will be queued to the exit stack.
2067
2056
:return: (branch, info_list, start_rev_info, end_rev_info) where
2068
2057
info_list is a list of (relative_path, file_id, kind) tuples where
2069
2058
kind is one of values 'directory', 'file', 'symlink', 'tree-reference'.
2072
2061
from breezy.builtins import _get_revision_range
2073
2062
tree, b, path = controldir.ControlDir.open_containing_tree_or_branch(
2075
add_cleanup(b.lock_read().unlock)
2064
exit_stack.enter_context(b.lock_read())
2076
2065
# XXX: It's damn messy converting a list of paths to relative paths when
2077
2066
# those paths might be deleted ones, they might be on a case-insensitive
2078
2067
# filesystem and/or they might be in silly locations (like another branch).