282
282
def supports_rename_tracking(self):
285
def get_file_revision(self, path, file_id=None):
285
def get_file_revision(self, path):
286
286
change_scanner = self._repository._file_change_scanner
287
287
if self.commit_id == ZERO_SHA:
288
288
return NULL_REVISION
291
291
return self._repository.lookup_foreign_revision_id(
292
292
commit_id, self.mapping)
294
def get_file_mtime(self, path, file_id=None):
294
def get_file_mtime(self, path):
296
revid = self.get_file_revision(path, file_id)
296
revid = self.get_file_revision(path)
298
298
raise errors.NoSuchFile(path)
370
370
return (self.store, mode, hexsha)
372
def is_executable(self, path, file_id=None):
372
def is_executable(self, path):
373
373
(store, mode, hexsha) = self._lookup_path(path)
375
375
# the tree root is a directory
377
377
return mode_is_executable(mode)
379
def kind(self, path, file_id=None):
379
def kind(self, path):
380
380
(store, mode, hexsha) = self._lookup_path(path)
382
382
# the tree root is a directory
531
531
"""See RevisionTree.get_revision_id."""
532
532
return self._revision_id
534
def get_file_sha1(self, path, file_id=None, stat_value=None):
534
def get_file_sha1(self, path, stat_value=None):
535
535
if self.tree is None:
536
536
raise errors.NoSuchFile(path)
537
return osutils.sha_string(self.get_file_text(path, file_id))
537
return osutils.sha_string(self.get_file_text(path))
539
def get_file_verifier(self, path, file_id=None, stat_value=None):
539
def get_file_verifier(self, path, stat_value=None):
540
540
(store, mode, hexsha) = self._lookup_path(path)
541
541
return ("GIT", hexsha)
543
def get_file_size(self, path, file_id=None):
543
def get_file_size(self, path):
544
544
(store, mode, hexsha) = self._lookup_path(path)
545
545
if stat.S_ISREG(mode):
546
546
return len(store[hexsha].data)
549
def get_file_text(self, path, file_id=None):
549
def get_file_text(self, path):
550
550
"""See RevisionTree.get_file_text."""
551
551
(store, mode, hexsha) = self._lookup_path(path)
552
552
if stat.S_ISREG(mode):
557
def get_symlink_target(self, path, file_id=None):
557
def get_symlink_target(self, path):
558
558
"""See RevisionTree.get_symlink_target."""
559
559
(store, mode, hexsha) = self._lookup_path(path)
560
560
if stat.S_ISLNK(mode):
565
def get_reference_revision(self, path, file_id=None):
565
def get_reference_revision(self, path):
566
566
"""See RevisionTree.get_symlink_target."""
567
567
(store, mode, hexsha) = self._lookup_path(path)
568
568
if S_ISGITLINK(mode):
620
620
return self.store.iter_tree_contents(
621
621
self.tree, include_trees=include_trees)
623
def annotate_iter(self, path, file_id=None,
624
default_revision=CURRENT_REVISION):
623
def annotate_iter(self, path, default_revision=CURRENT_REVISION):
625
624
"""Return an iterator of revision_id, line tuples.
627
626
For working trees (and mutable trees in general), the special
628
627
revision_id 'current:' will be used for lines that are new in this
629
628
tree, e.g. uncommitted changes.
630
:param file_id: The file to produce an annotated version from
631
629
:param default_revision: For lines that don't match a basis, mark them
632
630
with this revision id. Not all implementations will make use of
1149
1147
kind = mode_kind(mode)
1150
1148
ie = entry_factory[kind](file_id, name, parent_id)
1151
1149
if kind == 'symlink':
1152
ie.symlink_target = self.get_symlink_target(path, file_id)
1150
ie.symlink_target = self.get_symlink_target(path)
1153
1151
elif kind == 'tree-reference':
1154
ie.reference_revision = self.get_reference_revision(path, file_id)
1152
ie.reference_revision = self.get_reference_revision(path)
1157
data = self.get_file_text(path, file_id)
1155
data = self.get_file_text(path)
1158
1156
except errors.NoSuchFile:
1160
1158
except IOError as e:
1204
1202
self._versioned_dirs = None
1207
def unversion(self, paths, file_ids=None):
1205
def unversion(self, paths):
1208
1206
with self.lock_tree_write():
1209
1207
for path in paths:
1210
1208
if self._unversion_path(path) == 0:
1376
1374
return (kind, None, None, None)
1378
def kind(self, relpath, file_id=None):
1376
def kind(self, relpath):
1379
1377
kind = osutils.file_kind(self.abspath(relpath))
1380
1378
if kind == 'directory':
1381
1379
(index, index_path) = self._lookup_index(relpath.encode('utf-8'))