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

  • Committer: Jelmer Vernooij
  • Date: 2018-03-24 17:48:04 UTC
  • mfrom: (6921 work)
  • mto: This revision was merged to the branch mainline in revision 6923.
  • Revision ID: jelmer@jelmer.uk-20180324174804-xf22o05byoj12x1q
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
from .lock import LogicalLockResult
54
54
from .sixish import (
55
55
    BytesIO,
56
 
    text_type,
57
56
    viewitems,
58
57
    )
59
58
from .trace import mutter, mutter_callsite, note, is_quiet
662
661
            raise errors.UpgradeRequired(self.user_url)
663
662
        self.get_config_stack().set('append_revisions_only', enabled)
664
663
 
665
 
    def set_reference_info(self, tree_path, branch_location, file_id=None):
 
664
    def set_reference_info(self, file_id, tree_path, branch_location):
666
665
        """Set the branch location to use for a tree reference."""
667
666
        raise errors.UnsupportedOperation(self.set_reference_info, self)
668
667
 
669
 
    def get_reference_info(self, path):
 
668
    def get_reference_info(self, file_id):
670
669
        """Get the tree_path and branch_location for a tree reference."""
671
670
        raise errors.UnsupportedOperation(self.get_reference_info, self)
672
671
 
772
771
        # FIXUP this and get_parent in a future branch format bump:
773
772
        # read and rewrite the file. RBC 20060125
774
773
        if url is not None:
775
 
            if isinstance(url, text_type):
 
774
            if isinstance(url, unicode):
776
775
                try:
777
776
                    url = url.encode('ascii')
778
777
                except UnicodeEncodeError:
1201
1200
        return result
1202
1201
 
1203
1202
    def sprout(self, to_controldir, revision_id=None, repository_policy=None,
1204
 
            repository=None, lossy=False):
 
1203
            repository=None):
1205
1204
        """Create a new line of development from the branch, into to_controldir.
1206
1205
 
1207
1206
        to_controldir controls the branch format.
1213
1212
            repository_policy.requires_stacking()):
1214
1213
            to_controldir._format.require_stacking(_skip_repo=True)
1215
1214
        result = to_controldir.create_branch(repository=repository)
1216
 
        if lossy:
1217
 
            raise errors.LossyPushToSameVCS(self, result)
1218
1215
        with self.lock_read(), result.lock_write():
1219
1216
            if repository_policy is not None:
1220
1217
                repository_policy.configure_branch(result)
1269
1266
        old_base = self.base
1270
1267
        new_base = target.base
1271
1268
        target_reference_dict = target._get_all_reference_info()
1272
 
        for tree_path, (branch_location, file_id) in viewitems(reference_dict):
 
1269
        for file_id, (tree_path, branch_location) in viewitems(reference_dict):
1273
1270
            branch_location = urlutils.rebase_url(branch_location,
1274
1271
                                                  old_base, new_base)
1275
1272
            target_reference_dict.setdefault(
1276
 
                tree_path, (branch_location, file_id))
 
1273
                file_id, (tree_path, branch_location))
1277
1274
        target._set_all_reference_info(target_reference_dict)
1278
1275
 
1279
1276
    def check(self, refs):
1392
1389
        basis_tree = tree.basis_tree()
1393
1390
        with basis_tree.lock_read():
1394
1391
            for path, file_id in basis_tree.iter_references():
1395
 
                reference_parent = self.reference_parent(path, file_id)
 
1392
                reference_parent = self.reference_parent(file_id, path)
1396
1393
                reference_parent.create_checkout(tree.abspath(path),
1397
1394
                    basis_tree.get_reference_revision(path, file_id),
1398
1395
                    lightweight)
1406
1403
            reconciler.reconcile()
1407
1404
            return reconciler
1408
1405
 
1409
 
    def reference_parent(self, path, file_id=None, possible_transports=None):
 
1406
    def reference_parent(self, file_id, path, possible_transports=None):
1410
1407
        """Return the parent branch for a tree-reference file_id
1411
1408
 
 
1409
        :param file_id: The file_id of the tree reference
1412
1410
        :param path: The path of the file_id in the tree
1413
 
        :param file_id: Optional file_id of the tree reference
1414
1411
        :return: A branch associated with the file_id
1415
1412
        """
1416
1413
        # FIXME should provide multiple branches, based on config