/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/git/tree.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-11-16 15:19:49 UTC
  • mfrom: (7141.7.6 no-file-ids)
  • Revision ID: breezy.the.bot@gmail.com-20181116151949-hrmuv6s7ow1cqdhi
Drop file_id argument from read functions in Tree.

Merged from https://code.launchpad.net/~jelmer/brz/no-file-ids/+merge/357984

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
    def supports_rename_tracking(self):
278
278
        return False
279
279
 
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)
287
287
 
288
 
    def get_file_mtime(self, path, file_id=None):
 
288
    def get_file_mtime(self, path):
289
289
        try:
290
 
            revid = self.get_file_revision(path, file_id)
 
290
            revid = self.get_file_revision(path)
291
291
        except KeyError:
292
292
            raise errors.NoSuchFile(path)
293
293
        try:
363
363
        else:
364
364
            return (self.store, mode, hexsha)
365
365
 
366
 
    def is_executable(self, path, file_id=None):
 
366
    def is_executable(self, path):
367
367
        (store, mode, hexsha) = self._lookup_path(path)
368
368
        if mode is None:
369
369
            # the tree root is a directory
370
370
            return False
371
371
        return mode_is_executable(mode)
372
372
 
373
 
    def kind(self, path, file_id=None):
 
373
    def kind(self, path):
374
374
        (store, mode, hexsha) = self._lookup_path(path)
375
375
        if mode is None:
376
376
            # the tree root is a directory
515
515
        """See RevisionTree.get_revision_id."""
516
516
        return self._revision_id
517
517
 
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))
522
522
 
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)
526
526
 
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)
531
531
        return None
532
532
 
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):
538
538
        else:
539
539
            return b""
540
540
 
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):
546
546
        else:
547
547
            return None
548
548
 
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)
605
605
 
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.
609
608
 
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
616
614
            this value.
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)
1120
1118
        else:
1121
1119
            try:
1122
 
                data = self.get_file_text(path, file_id)
 
1120
                data = self.get_file_text(path)
1123
1121
            except errors.NoSuchFile:
1124
1122
                data = None
1125
1123
            except IOError as e:
1169
1167
        self._versioned_dirs = None
1170
1168
        return count
1171
1169
 
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:
1335
1333
        else:
1336
1334
            return (kind, None, None, None)
1337
1335
 
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'))