def get_parented_branch(self): wt_a = self.make_branch_and_tree('a') self.build_tree(['a/one']) wt_a.add(['one']) rev1 = wt_a.commit('commit one') branch_b = wt_a.branch.controldir.sprout( 'b', revision_id=rev1).open_branch() self.assertEqual( urlutils.strip_segment_parameters(wt_a.branch.user_url), urlutils.strip_segment_parameters(branch_b.get_parent())) return branch_b
def probe_transport(klass, transport): try: external_url = transport.external_url() except errors.InProcessTransport: raise errors.NotBranchError(path=transport.base) scheme = external_url.split(":")[0] if scheme not in klass._supported_schemes: raise errors.NotBranchError(path=transport.base) from breezy import urlutils external_url = urlutils.strip_segment_parameters(external_url) # Explicitly check for .hg directories here, so we avoid # loading foreign branches through Mercurial. if (external_url.startswith("http:") or external_url.startswith("https:")): if klass._has_hg_http_smart_server(transport, external_url): return SmartHgDirFormat() raise errors.NotBranchError(path=transport.base)
def test_sprout_branch_parent(self): source = self.make_branch('source') target = source.controldir.sprout(self.get_url('target')).open_branch() self.assertEqual( urlutils.strip_segment_parameters(source.user_url), urlutils.strip_segment_parameters(target.get_parent()))