278
278
def supports_rename_tracking(self):
281
def get_file_revision(self, path, file_id=None):
281
def get_file_revision(self, path):
282
282
change_scanner = self._repository._file_change_scanner
283
283
if self.commit_id == ZERO_SHA:
284
284
return NULL_REVISION
286
286
path.encode('utf-8'), self.commit_id)
287
287
return self._repository.lookup_foreign_revision_id(commit_id, self.mapping)
289
def get_file_mtime(self, path, file_id=None):
289
def get_file_mtime(self, path):
291
revid = self.get_file_revision(path, file_id)
291
revid = self.get_file_revision(path)
293
293
raise errors.NoSuchFile(path)
365
365
return (self.store, mode, hexsha)
367
def is_executable(self, path, file_id=None):
367
def is_executable(self, path):
368
368
(store, mode, hexsha) = self._lookup_path(path)
370
370
# the tree root is a directory
372
372
return mode_is_executable(mode)
374
def kind(self, path, file_id=None):
374
def kind(self, path):
375
375
(store, mode, hexsha) = self._lookup_path(path)
377
377
# the tree root is a directory
516
516
"""See RevisionTree.get_revision_id."""
517
517
return self._revision_id
519
def get_file_sha1(self, path, file_id=None, stat_value=None):
519
def get_file_sha1(self, path, stat_value=None):
520
520
if self.tree is None:
521
521
raise errors.NoSuchFile(path)
522
return osutils.sha_string(self.get_file_text(path, file_id))
522
return osutils.sha_string(self.get_file_text(path))
524
def get_file_verifier(self, path, file_id=None, stat_value=None):
524
def get_file_verifier(self, path, stat_value=None):
525
525
(store, mode, hexsha) = self._lookup_path(path)
526
526
return ("GIT", hexsha)
528
def get_file_size(self, path, file_id=None):
528
def get_file_size(self, path):
529
529
(store, mode, hexsha) = self._lookup_path(path)
530
530
if stat.S_ISREG(mode):
531
531
return len(store[hexsha].data)
534
def get_file_text(self, path, file_id=None):
534
def get_file_text(self, path):
535
535
"""See RevisionTree.get_file_text."""
536
536
(store, mode, hexsha) = self._lookup_path(path)
537
537
if stat.S_ISREG(mode):
542
def get_symlink_target(self, path, file_id=None):
542
def get_symlink_target(self, path):
543
543
"""See RevisionTree.get_symlink_target."""
544
544
(store, mode, hexsha) = self._lookup_path(path)
545
545
if stat.S_ISLNK(mode):
550
def get_reference_revision(self, path, file_id=None):
550
def get_reference_revision(self, path):
551
551
"""See RevisionTree.get_symlink_target."""
552
552
(store, mode, hexsha) = self._lookup_path(path)
553
553
if S_ISGITLINK(mode):
604
604
return self.store.iter_tree_contents(
605
605
self.tree, include_trees=include_trees)
607
def annotate_iter(self, path, file_id=None,
608
default_revision=CURRENT_REVISION):
607
def annotate_iter(self, path, default_revision=CURRENT_REVISION):
609
608
"""Return an iterator of revision_id, line tuples.
611
610
For working trees (and mutable trees in general), the special
612
611
revision_id 'current:' will be used for lines that are new in this
613
612
tree, e.g. uncommitted changes.
614
:param file_id: The file to produce an annotated version from
615
613
:param default_revision: For lines that don't match a basis, mark them
616
614
with this revision id. Not all implementations will make use of
1115
1113
kind = mode_kind(mode)
1116
1114
ie = entry_factory[kind](file_id, name, parent_id)
1117
1115
if kind == 'symlink':
1118
ie.symlink_target = self.get_symlink_target(path, file_id)
1116
ie.symlink_target = self.get_symlink_target(path)
1119
1117
elif kind == 'tree-reference':
1120
ie.reference_revision = self.get_reference_revision(path, file_id)
1118
ie.reference_revision = self.get_reference_revision(path)
1123
data = self.get_file_text(path, file_id)
1121
data = self.get_file_text(path)
1124
1122
except errors.NoSuchFile:
1126
1124
except IOError as e:
1170
1168
self._versioned_dirs = None
1173
def unversion(self, paths, file_ids=None):
1171
def unversion(self, paths):
1174
1172
with self.lock_tree_write():
1175
1173
for path in paths:
1176
1174
if self._unversion_path(path) == 0:
1337
1335
return (kind, None, None, None)
1339
def kind(self, relpath, file_id=None):
1337
def kind(self, relpath):
1340
1338
kind = osutils.file_kind(self.abspath(relpath))
1341
1339
if kind == 'directory':
1342
1340
(index, index_path) = self._lookup_index(relpath.encode('utf-8'))