/breezy-svn/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy-svn/trunk

« back to all changes in this revision

Viewing changes to branch.py

  • Committer: Jelmer Vernooij
  • Date: 2018-06-09 09:28:31 UTC
  • Revision ID: jelmer@jelmer.uk-20180609092831-fce99rq1m3020ttx
Make svn_transport a separate variable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
252
252
        return self.supports_tags()
253
253
 
254
254
    def check_path(self):
255
 
        return self.repository.transport.check_path(self._branch_path,
 
255
        return self.repository.svn_transport.check_path(self._branch_path,
256
256
            self.repository.get_latest_revnum())
257
257
 
258
258
    def supports_tags(self):
286
286
        if revnum == last_revmeta.metarev.revnum:
287
287
            return last_revmeta.metarev.branch_path
288
288
 
289
 
        locations = self.repository.transport.get_locations(
 
289
        locations = self.repository.svn_transport.get_locations(
290
290
                last_revmeta.metarev.branch_path, last_revmeta.metarev.revnum,
291
291
                [revnum])
292
292
 
384
384
        svn_url, readonly = bzr_to_svn_url(urlutils.join(self.repository.base, bp))
385
385
        wc.ensure_adm(to_path.encode("utf-8"), uuid,
386
386
                      svn_url, bzr_to_svn_url(self.repository.base)[0], revnum)
387
 
        adm = wc.Adm(None, to_path.encode("utf-8"), write_lock=True)
388
 
        try:
389
 
            conn = self.repository.transport.connections.get(svn_url)
 
387
        with wc.Adm(None, to_path.encode("utf-8"), write_lock=True) as adm:
 
388
            conn = self.repository.svn_transport.connections.get(svn_url)
390
389
            try:
391
390
                update_wc(adm, to_path.encode("utf-8"), conn, svn_url, revnum)
392
391
            finally:
393
392
                if not conn.busy:
394
 
                    self.repository.transport.add_connection(conn)
395
 
        finally:
396
 
            adm.close()
 
393
                    self.repository.svn_transport.add_connection(conn)
397
394
 
398
395
        dir = SvnCheckout(transport, SvnWorkingTreeDirFormat())
399
396
        return dir.open_workingtree()
432
429
        raise NoSuchRevision(self, revnum)
433
430
 
434
431
    def get_config(self):
435
 
        return BranchConfig(self.base, self.repository.uuid)
 
432
        return BranchConfig(self.user_url, self.repository.uuid)
436
433
 
437
434
    def get_config_stack(self):
438
 
        return SvnBranchStack(self.base, self.repository.uuid)
 
435
        return SvnBranchStack(self.user_url, self.repository.uuid)
439
436
 
440
437
    def get_append_revisions_only(self):
441
438
        value = self.get_config_stack().get('append_revisions_only')
840
837
                         graph=None, fetch_tags=None,
841
838
                         fetch_non_mainline=None):
842
839
        "See InterBranch.update_revisions."""
843
 
        self.source.lock_read()
844
 
        try:
 
840
        with self.source.lock_read():
845
841
            if stop_revision is None:
846
842
                stop_revision = self.source.last_revision()
847
843
                if is_null(stop_revision):
859
855
            if not overwrite:
860
856
                if graph is None:
861
857
                    graph = self.target.repository.get_graph()
862
 
                self.target.lock_read()
863
 
                try:
 
858
                with self.target.lock_read():
864
859
                    if self.target._check_if_descendant_or_diverged(
865
860
                            stop_revision, last_rev, graph, self.source):
866
861
                        # stop_revision is a descendant of last_rev, but we
867
862
                        # aren't overwriting, so we're done.
868
863
                        return self.target.last_revision_info()
869
 
                finally:
870
 
                    self.target.unlock()
871
864
            self.target._clear_cached_state()
872
865
            self.target.generate_revision_history(stop_revision)
873
866
            return self.target.last_revision_info()
874
 
        finally:
875
 
            self.source.unlock()
876
867
 
877
868
    def _basic_push(self, overwrite=False, stop_revision=None,
878
869
            fetch_non_mainline=False):
1017
1008
        parent_revids = tuple(graph.get_parent_map([revid])[revid])
1018
1009
        if parent_revids != (NULL_REVISION,):
1019
1010
            return False
1020
 
        tree_contents = self.target.repository.transport.get_dir(
 
1011
        tree_contents = self.target.repository.svn_transport.get_dir(
1021
1012
            self.target.get_branch_path(), self.target.get_revnum())[0]
1022
1013
        return tree_contents == {}
1023
1014
 
1024
1015
    def copy_content_into(self, revision_id=None):
1025
1016
        if revision_id is None:
1026
1017
            revision_id = self.source.last_revision()
1027
 
        self.source.lock_read()
1028
 
        try:
1029
 
            self.target.lock_write()
1030
 
            try:
 
1018
        with self.source.lock_read():
 
1019
            with self.target.lock_write():
1031
1020
                self._push(revision_id, overwrite=True, push_metadata=True)
1032
 
            finally:
1033
 
                self.target.unlock()
1034
1021
            try:
1035
1022
                parent = self.source.get_parent()
1036
1023
            except InaccessibleParent, e:
1038
1025
            else:
1039
1026
                if parent:
1040
1027
                    self.target.set_parent(parent)
1041
 
        finally:
1042
 
            self.source.unlock()
1043
1028
 
1044
1029
    def _push(self, stop_revision, overwrite, push_metadata):
1045
1030
        old_last_revid = self.target.last_revision()