277
277
def supports_rename_tracking(self):
280
def get_file_revision(self, path, file_id=None):
280
def get_file_revision(self, path):
281
281
change_scanner = self._repository._file_change_scanner
282
282
if self.commit_id == ZERO_SHA:
283
283
return NULL_REVISION
285
285
path.encode('utf-8'), self.commit_id)
286
286
return self._repository.lookup_foreign_revision_id(commit_id, self.mapping)
288
def get_file_mtime(self, path, file_id=None):
288
def get_file_mtime(self, path):
290
revid = self.get_file_revision(path, file_id)
290
revid = self.get_file_revision(path)
292
292
raise errors.NoSuchFile(path)
364
364
return (self.store, mode, hexsha)
366
def is_executable(self, path, file_id=None):
366
def is_executable(self, path):
367
367
(store, mode, hexsha) = self._lookup_path(path)
369
369
# the tree root is a directory
371
371
return mode_is_executable(mode)
373
def kind(self, path, file_id=None):
373
def kind(self, path):
374
374
(store, mode, hexsha) = self._lookup_path(path)
376
376
# the tree root is a directory
515
515
"""See RevisionTree.get_revision_id."""
516
516
return self._revision_id
518
def get_file_sha1(self, path, file_id=None, stat_value=None):
518
def get_file_sha1(self, path, stat_value=None):
519
519
if self.tree is None:
520
520
raise errors.NoSuchFile(path)
521
return osutils.sha_string(self.get_file_text(path, file_id))
521
return osutils.sha_string(self.get_file_text(path))
523
def get_file_verifier(self, path, file_id=None, stat_value=None):
523
def get_file_verifier(self, path, stat_value=None):
524
524
(store, mode, hexsha) = self._lookup_path(path)
525
525
return ("GIT", hexsha)
527
def get_file_size(self, path, file_id=None):
527
def get_file_size(self, path):
528
528
(store, mode, hexsha) = self._lookup_path(path)
529
529
if stat.S_ISREG(mode):
530
530
return len(store[hexsha].data)
533
def get_file_text(self, path, file_id=None):
533
def get_file_text(self, path):
534
534
"""See RevisionTree.get_file_text."""
535
535
(store, mode, hexsha) = self._lookup_path(path)
536
536
if stat.S_ISREG(mode):
541
def get_symlink_target(self, path, file_id=None):
541
def get_symlink_target(self, path):
542
542
"""See RevisionTree.get_symlink_target."""
543
543
(store, mode, hexsha) = self._lookup_path(path)
544
544
if stat.S_ISLNK(mode):
549
def get_reference_revision(self, path, file_id=None):
549
def get_reference_revision(self, path):
550
550
"""See RevisionTree.get_symlink_target."""
551
551
(store, mode, hexsha) = self._lookup_path(path)
552
552
if S_ISGITLINK(mode):
603
603
return self.store.iter_tree_contents(
604
604
self.tree, include_trees=include_trees)
606
def annotate_iter(self, path, file_id=None,
607
default_revision=CURRENT_REVISION):
606
def annotate_iter(self, path, default_revision=CURRENT_REVISION):
608
607
"""Return an iterator of revision_id, line tuples.
610
609
For working trees (and mutable trees in general), the special
611
610
revision_id 'current:' will be used for lines that are new in this
612
611
tree, e.g. uncommitted changes.
613
:param file_id: The file to produce an annotated version from
614
612
:param default_revision: For lines that don't match a basis, mark them
615
613
with this revision id. Not all implementations will make use of
1114
1112
kind = mode_kind(mode)
1115
1113
ie = entry_factory[kind](file_id, name, parent_id)
1116
1114
if kind == 'symlink':
1117
ie.symlink_target = self.get_symlink_target(path, file_id)
1115
ie.symlink_target = self.get_symlink_target(path)
1118
1116
elif kind == 'tree-reference':
1119
ie.reference_revision = self.get_reference_revision(path, file_id)
1117
ie.reference_revision = self.get_reference_revision(path)
1122
data = self.get_file_text(path, file_id)
1120
data = self.get_file_text(path)
1123
1121
except errors.NoSuchFile:
1125
1123
except IOError as e:
1169
1167
self._versioned_dirs = None
1172
def unversion(self, paths, file_ids=None):
1170
def unversion(self, paths):
1173
1171
with self.lock_tree_write():
1174
1172
for path in paths:
1175
1173
if self._unversion_path(path) == 0:
1336
1334
return (kind, None, None, None)
1338
def kind(self, relpath, file_id=None):
1336
def kind(self, relpath):
1339
1337
kind = osutils.file_kind(self.abspath(relpath))
1340
1338
if kind == 'directory':
1341
1339
(index, index_path) = self._lookup_index(relpath.encode('utf-8'))