/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 10:24:48 UTC
  • mfrom: (6910 work)
  • mto: This revision was merged to the branch mainline in revision 6913.
  • Revision ID: jelmer@jelmer.uk-20180324102448-132p8l8t5ogdzhhu
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    config as _mod_config,
27
27
    debug,
28
28
    fetch,
 
29
    memorytree,
29
30
    repository,
30
31
    revision as _mod_revision,
31
32
    tag as _mod_tag,
96
97
        self._revision_id_to_revno_cache = None
97
98
        self._partial_revision_id_to_revno_cache = {}
98
99
        self._partial_revision_history_cache = []
99
 
        self._tags_bytes = None
100
100
        self._last_revision_info_cache = None
101
101
        self._master_branch_cache = None
102
102
        self._merge_sorted_revisions_cache = None
258
258
        a_branch = Branch.open(url, possible_transports=possible_transports)
259
259
        return a_branch.repository
260
260
 
261
 
    def _get_tags_bytes(self):
262
 
        """Get the bytes of a serialised tags dict.
263
 
 
264
 
        Note that not all branches support tags, nor do all use the same tags
265
 
        logic: this method is specific to BasicTags. Other tag implementations
266
 
        may use the same method name and behave differently, safely, because
267
 
        of the double-dispatch via
268
 
        format.make_tags->tags_instance->get_tags_dict.
269
 
 
270
 
        :return: The bytes of the tags file.
271
 
        :seealso: Branch._set_tags_bytes.
272
 
        """
273
 
        with self.lock_read():
274
 
            if self._tags_bytes is None:
275
 
                self._tags_bytes = self._transport.get_bytes('tags')
276
 
            return self._tags_bytes
277
 
 
278
261
    def _get_nick(self, local=False, possible_transports=None):
279
262
        config = self.get_config()
280
263
        # explicit overrides master, but don't look for master if local is True
908
891
                    if_present_ids=tags_to_fetch, find_ghosts=True).execute()
909
892
                self.repository.fetch(old_repository, fetch_spec=fetch_spec)
910
893
 
911
 
    def _set_tags_bytes(self, bytes):
912
 
        """Mirror method for _get_tags_bytes.
913
 
 
914
 
        :seealso: Branch._get_tags_bytes.
915
 
        """
916
 
        with self.lock_write():
917
 
            self._tags_bytes = bytes
918
 
            return self._transport.put_bytes('tags', bytes)
919
 
 
920
894
    def _cache_revision_history(self, rev_history):
921
895
        """Set the cached revision history to rev_history.
922
896
 
952
926
        self._merge_sorted_revisions_cache = None
953
927
        self._partial_revision_history_cache = []
954
928
        self._partial_revision_id_to_revno_cache = {}
955
 
        self._tags_bytes = None
956
929
 
957
930
    def _gen_revision_history(self):
958
931
        """Return sequence of revision hashes on to this branch.
1245
1218
            self.copy_content_into(result, revision_id=revision_id)
1246
1219
            master_url = self.get_bound_location()
1247
1220
            if master_url is None:
1248
 
                result.set_parent(self.controldir.root_transport.base)
 
1221
                result.set_parent(self.user_url)
1249
1222
            else:
1250
1223
                result.set_parent(master_url)
1251
1224
        return result
1513
1486
        if_present_fetch.discard(_mod_revision.NULL_REVISION)
1514
1487
        return must_fetch, if_present_fetch
1515
1488
 
 
1489
    def create_memorytree(self):
 
1490
        """Create a memory tree for this branch.
 
1491
 
 
1492
        :return: An in-memory MutableTree instance
 
1493
        """
 
1494
        return memorytree.MemoryTree.create_on_branch(self)
 
1495
 
1516
1496
 
1517
1497
class BranchFormat(controldir.ControlComponentFormat):
1518
1498
    """An encapsulation of the initialization and open routines for a format.