/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-25 00:39:16 UTC
  • mfrom: (6926 work)
  • mto: This revision was merged to the branch mainline in revision 6928.
  • Revision ID: jelmer@jelmer.uk-20180325003916-mqa5uj4uq55hrjq9
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,
97
98
        self._revision_id_to_revno_cache = None
98
99
        self._partial_revision_id_to_revno_cache = {}
99
100
        self._partial_revision_history_cache = []
100
 
        self._tags_bytes = None
101
101
        self._last_revision_info_cache = None
102
102
        self._master_branch_cache = None
103
103
        self._merge_sorted_revisions_cache = None
259
259
        a_branch = Branch.open(url, possible_transports=possible_transports)
260
260
        return a_branch.repository
261
261
 
262
 
    def _get_tags_bytes(self):
263
 
        """Get the bytes of a serialised tags dict.
264
 
 
265
 
        Note that not all branches support tags, nor do all use the same tags
266
 
        logic: this method is specific to BasicTags. Other tag implementations
267
 
        may use the same method name and behave differently, safely, because
268
 
        of the double-dispatch via
269
 
        format.make_tags->tags_instance->get_tags_dict.
270
 
 
271
 
        :return: The bytes of the tags file.
272
 
        :seealso: Branch._set_tags_bytes.
273
 
        """
274
 
        with self.lock_read():
275
 
            if self._tags_bytes is None:
276
 
                self._tags_bytes = self._transport.get_bytes('tags')
277
 
            return self._tags_bytes
278
 
 
279
262
    def _get_nick(self, local=False, possible_transports=None):
280
263
        config = self.get_config()
281
264
        # explicit overrides master, but don't look for master if local is True
834
817
 
835
818
        Don't call this directly, use set_stacked_on_url(None).
836
819
        """
837
 
        pb = ui.ui_factory.nested_progress_bar()
838
 
        try:
 
820
        with ui.ui_factory.nested_progress_bar() as pb:
839
821
            pb.update(gettext("Unstacking"))
840
822
            # The basic approach here is to fetch the tip of the branch,
841
823
            # including all available ghosts, from the existing stacked
909
891
                    old_repository, required_ids=[self.last_revision()],
910
892
                    if_present_ids=tags_to_fetch, find_ghosts=True).execute()
911
893
                self.repository.fetch(old_repository, fetch_spec=fetch_spec)
912
 
        finally:
913
 
            pb.finished()
914
 
 
915
 
    def _set_tags_bytes(self, bytes):
916
 
        """Mirror method for _get_tags_bytes.
917
 
 
918
 
        :seealso: Branch._get_tags_bytes.
919
 
        """
920
 
        with self.lock_write():
921
 
            self._tags_bytes = bytes
922
 
            return self._transport.put_bytes('tags', bytes)
923
894
 
924
895
    def _cache_revision_history(self, rev_history):
925
896
        """Set the cached revision history to rev_history.
956
927
        self._merge_sorted_revisions_cache = None
957
928
        self._partial_revision_history_cache = []
958
929
        self._partial_revision_id_to_revno_cache = {}
959
 
        self._tags_bytes = None
960
930
 
961
931
    def _gen_revision_history(self):
962
932
        """Return sequence of revision hashes on to this branch.
1249
1219
            self.copy_content_into(result, revision_id=revision_id)
1250
1220
            master_url = self.get_bound_location()
1251
1221
            if master_url is None:
1252
 
                result.set_parent(self.controldir.root_transport.base)
 
1222
                result.set_parent(self.user_url)
1253
1223
            else:
1254
1224
                result.set_parent(master_url)
1255
1225
        return result
1517
1487
        if_present_fetch.discard(_mod_revision.NULL_REVISION)
1518
1488
        return must_fetch, if_present_fetch
1519
1489
 
 
1490
    def create_memorytree(self):
 
1491
        """Create a memory tree for this branch.
 
1492
 
 
1493
        :return: An in-memory MutableTree instance
 
1494
        """
 
1495
        return memorytree.MemoryTree.create_on_branch(self)
 
1496
 
1520
1497
 
1521
1498
class BranchFormat(controldir.ControlComponentFormat):
1522
1499
    """An encapsulation of the initialization and open routines for a format.