/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/tree.py

  • Committer: Jelmer Vernooij
  • Date: 2017-11-12 20:07:32 UTC
  • mto: This revision was merged to the branch mainline in revision 6819.
  • Revision ID: jelmer@jelmer.uk-20171112200732-ehxgen03s9jphe8n
Swap arguments for get_symlink_target and kind/stored_kind.

Show diffs side-by-side

added added

removed removed

Lines of Context:
231
231
                if entry.kind == 'tree-reference':
232
232
                    yield path, entry.file_id
233
233
 
234
 
    def kind(self, file_id):
 
234
    def kind(self, path, file_id=None):
235
235
        raise NotImplementedError("Tree subclass %s must implement kind"
236
236
            % self.__class__.__name__)
237
237
 
238
 
    def stored_kind(self, file_id):
 
238
    def stored_kind(self, path, file_id=None):
239
239
        """File kind stored for this file_id.
240
240
 
241
241
        May not match kind on disk for working trees.  Always available
242
242
        for versioned files, even when the file itself is missing.
243
243
        """
244
 
        return self.kind(file_id)
 
244
        return self.kind(path, file_id)
245
245
 
246
246
    def path_content_summary(self, path):
247
247
        """Get a summary of the information about path.
413
413
            cur_file = (self.get_file_text(path, file_id),)
414
414
            yield identifier, cur_file
415
415
 
416
 
    def get_symlink_target(self, file_id, path=None):
 
416
    def get_symlink_target(self, path, file_id=None):
417
417
        """Get the target for a given file_id.
418
418
 
419
419
        It is assumed that the caller already knows that file_id is referencing
447
447
    def _get_plan_merge_data(self, file_id, other, base):
448
448
        from .bzr import versionedfile
449
449
        vf = versionedfile._PlanMergeVersionedFile(file_id)
450
 
        last_revision_a = self._get_file_revision(file_id, vf, 'this:')
451
 
        last_revision_b = other._get_file_revision(file_id, vf, 'other:')
 
450
        last_revision_a = self._get_file_revision(
 
451
                self.id2path(file_id), file_id, vf, 'this:')
 
452
        last_revision_b = other._get_file_revision(
 
453
                other.id2path(file_id), file_id, vf, 'other:')
452
454
        if base is None:
453
455
            last_revision_base = None
454
456
        else:
455
 
            last_revision_base = base._get_file_revision(file_id, vf, 'base:')
 
457
            last_revision_base = base._get_file_revision(
 
458
                    base.id2path(file_id), file_id, vf, 'base:')
456
459
        return vf, last_revision_a, last_revision_b, last_revision_base
457
460
 
458
461
    def plan_file_merge(self, file_id, other, base=None):
489
492
            except errors.NoSuchRevisionInTree:
490
493
                yield self.repository.revision_tree(revision_id)
491
494
 
492
 
    def _get_file_revision(self, file_id, vf, tree_revision):
 
495
    def _get_file_revision(self, path, file_id, vf, tree_revision):
493
496
        """Ensure that file_id, tree_revision is in vf to plan the merge."""
494
 
        path= self.id2path(file_id)
495
497
        if getattr(self, '_repository', None) is None:
496
498
            last_revision = tree_revision
497
499
            parent_keys = [(file_id, t.get_file_revision(path, file_id)) for t in
855
857
                    target_path, source_stat, target_stat):
856
858
                changed_content = True
857
859
        elif source_kind == 'symlink':
858
 
            if (self.source.get_symlink_target(file_id) !=
859
 
                self.target.get_symlink_target(file_id)):
 
860
            if (self.source.get_symlink_target(source_path, file_id) !=
 
861
                self.target.get_symlink_target(target_path, file_id)):
860
862
                changed_content = True
861
863
        elif source_kind == 'tree-reference':
862
864
            if (self.source.get_reference_revision(source_path, file_id)
1185
1187
        """
1186
1188
        with self.lock_read():
1187
1189
            if source_path is None:
1188
 
                source_path = self.id2path(source_file_id)
 
1190
                source_path = self.source.id2path(source_file_id)
1189
1191
            if target_path is None:
1190
 
                target_path = self.id2path(target_file_id)
 
1192
                target_path = self.target.id2path(target_file_id)
1191
1193
            source_verifier_kind, source_verifier_data = (
1192
1194
                    self.source.get_file_verifier(
1193
1195
                        source_path, source_file_id, source_stat))