45
45
self._rules_searcher = None
47
47
def supports_tree_reference(self):
48
return getattr(self._repository._format, "supports_tree_reference",
51
50
def get_parent_ids(self):
52
51
"""See Tree.get_parent_ids.
87
86
default_revision=revision.CURRENT_REVISION):
88
87
"""See Tree.annotate_iter"""
89
88
text_key = (file_id, self.inventory[file_id].revision)
90
annotator = self._repository.texts.get_annotator()
91
annotations = annotator.annotate_flat(text_key)
89
annotations = self._repository.texts.annotate(text_key)
92
90
return [(key[-1], line) for key, line in annotations]
94
92
def get_file_size(self, file_id):
104
102
def get_file_mtime(self, file_id, path=None):
105
103
ie = self._inventory[file_id]
107
revision = self._repository.get_revision(ie.revision)
108
except errors.NoSuchRevision:
109
raise errors.FileTimestampUnavailable(self.id2path(file_id))
104
revision = self._repository.get_revision(ie.revision)
110
105
return revision.timestamp
112
107
def is_executable(self, file_id, path=None):
118
113
def has_filename(self, filename):
119
114
return bool(self.inventory.path2id(filename))
121
def list_files(self, include_root=False, from_dir=None, recursive=True):
116
def list_files(self, include_root=False):
122
117
# The only files returned by this are those from the version
127
from_dir_id = inv.path2id(from_dir)
128
if from_dir_id is None:
129
# Directory not versioned
131
entries = inv.iter_entries(from_dir=from_dir_id, recursive=recursive)
132
if inv.root is not None and not include_root and from_dir is None:
118
entries = self.inventory.iter_entries()
119
# skip the root for compatability with the current apis.
120
if self.inventory.root is not None and not include_root:
133
121
# skip the root for compatability with the current apis.
135
123
for path, entry in entries:
138
126
def get_symlink_target(self, file_id):
139
127
ie = self._inventory[file_id]
140
# Inventories store symlink targets in unicode
141
return ie.symlink_target
128
return ie.symlink_target;
143
130
def get_reference_revision(self, file_id, path=None):
144
131
return self.inventory[file_id].reference_revision
245
232
lookup_trees = [self.source]
247
234
lookup_trees.extend(extra_trees)
248
# The ids of items we need to examine to insure delta consistency.
249
precise_file_ids = set()
250
discarded_changes = {}
251
235
if specific_files == []:
252
236
specific_file_ids = []
254
238
specific_file_ids = self.target.paths2ids(specific_files,
255
239
lookup_trees, require_versioned=require_versioned)
256
241
# FIXME: It should be possible to delegate include_unchanged handling
257
242
# to CHKInventory.iter_changes and do a better job there -- vila
259
changed_file_ids = set()
244
if include_unchanged:
245
changed_file_ids = []
260
246
for result in self.target.inventory.iter_changes(self.source.inventory):
261
if specific_file_ids is not None:
263
if file_id not in specific_file_ids:
264
# A change from the whole tree that we don't want to show yet.
265
# We may find that we need to show it for delta consistency, so
267
discarded_changes[result[0]] = result
269
new_parent_id = result[4][1]
270
precise_file_ids.add(new_parent_id)
247
if (specific_file_ids is not None
248
and not result[0] in specific_file_ids):
249
# CHKMap.iter_changes is clean and fast. Better filter out
250
# the specific files *after* it did its job.
272
changed_file_ids.add(result[0])
273
if specific_file_ids is not None:
274
for result in self._handle_precise_ids(precise_file_ids,
275
changed_file_ids, discarded_changes=discarded_changes):
253
if include_unchanged:
254
# Keep track of yielded results (cheaper than building the
256
changed_file_ids.append(result[0])
277
257
if include_unchanged:
278
258
# CHKMap avoid being O(tree), so we go to O(tree) only if