def test_shared_import_continue_branch(self): oldrepos = Repository.open(self.repos_url) convert_repository(oldrepos, "e", TrunkLayout(0), create_shared_repo=True) mapping = oldrepos.get_mapping() dc = self.get_commit_editor() trunk = dc.open_dir("trunk") trunk.open_file("trunk/file").modify() dc.close() self.assertEqual( Repository.open(self.repos_url).generate_revision_id( 2, u"trunk", mapping), Branch.open("e/trunk").last_revision()) convert_repository(Repository.open(self.repos_url), "e", TrunkLayout(0), create_shared_repo=True) self.assertEqual( Repository.open(self.repos_url).generate_revision_id( 3, u"trunk", mapping), Branch.open("e/trunk").last_revision())
def test_branch_push_pull_merge_copies_tags(self): t = self.make_branch_and_tree('branch1') t.commit(allow_pointless=True, message='initial commit', rev_id=b'first-revid') b1 = t.branch b1.tags.set_tag('tag1', b'first-revid') # branching copies the tag across self.run_bzr('branch branch1 branch2') b2 = Branch.open('branch2') self.assertEqual(b2.tags.lookup_tag('tag1'), b'first-revid') # make a new tag and pull it b1.tags.set_tag('tag2', b'twa') self.run_bzr('pull -d branch2 branch1') self.assertEqual(b2.tags.lookup_tag('tag2'), b'twa') # make a new tag and push it b1.tags.set_tag('tag3', b'san') self.run_bzr('push -d branch1 branch2') self.assertEqual(b2.tags.lookup_tag('tag3'), b'san') # make a new tag and merge it t.commit(allow_pointless=True, message='second commit', rev_id=b'second-revid') t2 = WorkingTree.open('branch2') t2.commit(allow_pointless=True, message='commit in second') b1.tags.set_tag('tag4', b'second-revid') self.run_bzr('merge -d branch2 branch1') self.assertEqual(b2.tags.lookup_tag('tag4'), b'second-revid') # pushing to a new location copies the tag across self.run_bzr('push -d branch1 branch3') b3 = Branch.open('branch3') self.assertEqual(b3.tags.lookup_tag('tag1'), b'first-revid')
def test_pull_internal(self): repos_url = self.make_repository("a") dc = self.get_commit_editor(repos_url) dc.add_dir("trunk") dc.close() dc = self.get_commit_editor(repos_url) branches = dc.add_dir("branches") branches.add_dir("branches/foo", "trunk", 1) dc.close() otherbranch = Branch.open(urlutils.join(repos_url, "branches", "foo")) branch = Branch.open(urlutils.join(repos_url, "trunk")) old_last_revid = branch.last_revision() result = branch.pull(otherbranch) self.assertEquals(branch.last_revision(), otherbranch.last_revision()) self.assertEquals(result.new_revid, otherbranch.last_revision()) self.assertEquals(result.old_revid, old_last_revid) self.assertEquals(result.old_revno, 1) self.assertEquals(result.new_revno, 2) self.assertEquals(result.master_branch, branch) self.assertEquals(result.source_branch, otherbranch) self.assertEquals(result.target_branch, branch)
def test_revision_history(self): repos_url = self.make_svn_repository('a') branch = Branch.open(repos_url) self.assertEqual((1, branch.generate_revision_id(0)), branch.last_revision_info()) dc = self.get_commit_editor(repos_url) dc.add_file("foo").modify() dc.change_prop(SVN_PROP_BZR_REVISION_ID+"v3-none", "42 mycommit\n") dc.close() branch = Branch.open(repos_url) repos = Repository.open(repos_url) mapping = repos.get_mapping() self.assertEqual((42, repos.generate_revision_id(1, u"", mapping)), branch.last_revision_info()) dc = self.get_commit_editor(repos_url) dc.open_file("foo").modify() dc.close() branch = Branch.open(repos_url) repos = Repository.open(repos_url) mapping = repos.get_mapping() self.assertEqual( (43, repos.generate_revision_id(2, u"", mapping)), branch.last_revision_info())
def push_result( local_branch: Branch, remote_branch: Branch, additional_colocated_branches: Optional[Union[List[str], Dict[str, str]]] = None, tags: Optional[Union[Dict[str, bytes], List[str]]] = None, stop_revision: Optional[bytes] = None, ) -> None: kwargs = {} if tags is not None: kwargs["tag_selector"] = _tag_selector_from_tags(tags) try: local_branch.push( remote_branch, overwrite=False, stop_revision=stop_revision, **kwargs ) except errors.LockFailed as e: # Almost certainly actually a PermissionDenied error.. raise errors.PermissionDenied(path=full_branch_url(remote_branch), extra=e) for from_branch_name in additional_colocated_branches or []: try: add_branch = local_branch.controldir.open_branch(name=from_branch_name) # type: ignore except errors.NotBranchError: pass else: if isinstance(additional_colocated_branches, dict): to_branch_name = additional_colocated_branches[from_branch_name] else: to_branch_name = from_branch_name remote_branch.controldir.push_branch(add_branch, name=to_branch_name, **kwargs) # type: ignore
def test_tag_set_dupe(self): repos_url = self.make_repository('a') dc = self.get_commit_editor(repos_url) dc.add_dir("trunk") dc.add_dir("tags") dc.close() dc = self.get_commit_editor(repos_url) trunk = dc.open_dir("trunk") trunk.add_file("trunk/bla").modify() dc.close() b = Branch.open(repos_url + "/trunk") target = b.repository.generate_revision_id(1, u"trunk", b.repository.get_mapping()) b.tags.set_tag( u"mytag", b.repository.generate_revision_id(1, u"trunk", b.repository.get_mapping())) self.assertEquals( subvertpy.NODE_DIR, b.repository.svn_transport.check_path("tags/mytag", 3)) self.assertEquals(3, b.repository.get_latest_revnum()) b.tags.set_tag(u"mytag", target) self.assertEquals(3, b.repository.get_latest_revnum()) b = Branch.open(repos_url + "/trunk") self.assertEquals({u"mytag": target}, b.tags.get_tag_dict())
def merge_directive_changes( local_branch: Branch, main_branch: Branch, hoster: Hoster, name: str, message: str, include_patch: bool = False, include_bundle: bool = False, overwrite_existing: bool = False, ) -> MergeDirective: from breezy import osutils import time remote_branch, public_branch_url = hoster.publish_derived( local_branch, main_branch, name=name, overwrite=overwrite_existing) public_branch = open_branch(public_branch_url) directive = MergeDirective2.from_objects( local_branch.repository, local_branch.last_revision(), time.time(), osutils.local_time_offset(), main_branch, public_branch=public_branch, include_patch=include_patch, include_bundle=include_bundle, message=message, base_revision_id=main_branch.last_revision(), ) return directive
def check_proposal_diff( other_branch: Branch, main_branch: Branch, stop_revision: Optional[bytes] = None ) -> None: if stop_revision is None: stop_revision = other_branch.last_revision() main_revid = main_branch.last_revision() other_branch.repository.fetch(main_branch.repository, main_revid) with other_branch.lock_read(): main_tree = other_branch.repository.revision_tree(main_revid) revision_graph = other_branch.repository.get_graph() tree_branch = MemoryBranch(other_branch.repository, (None, main_revid), None) merger = _mod_merge.Merger( tree_branch, this_tree=main_tree, revision_graph=revision_graph ) merger.set_other_revision(stop_revision, other_branch) try: merger.find_base() except errors.UnrelatedBranches: merger.set_base_revision(_mod_revision.NULL_REVISION, other_branch) merger.merge_type = _mod_merge.Merge3Merger # type: ignore tree_merger = merger.make_merger() with tree_merger.make_preview_transform() as tt: changes = tt.iter_changes() if not any(changes): raise EmptyMergeProposal(other_branch, main_branch)
def test_export_loom_initial(self): tree = self.get_multi_threaded() root_transport = tree.branch.controldir.root_transport tree.branch.export_threads(root_transport) thread1 = Branch.open_from_transport(root_transport.clone('thread1')) self.assertEqual(b'thread1-id', thread1.last_revision()) thread2 = Branch.open_from_transport(root_transport.clone('thread2')) self.assertEqual(b'thread2-id', thread2.last_revision())
def test_sets_parent_urls(self): convert_repository(Repository.open(self.repos_url), "e", TrunkLayout(0), all=False, create_shared_repo=True) self.assertEquals(self.repos_url + "/trunk", Branch.open("e/trunk").get_parent()) self.assertEquals(self.repos_url + "/branches/abranch", Branch.open("e/branches/abranch").get_parent())
def get_branch_from_branch_location( branch_location, possible_transports=None, revspec=None): """Return the base branch for the branch location. :param branch_location: The URL of the branch to retrieve. """ # Make sure it's actually a branch Branch.open(branch_location) return BaseRecipeBranch( branch_location, None, RecipeParser.NEWEST_VERSION, revspec=revspec)
def test_tags_delete(self): repos_url = self.make_repository("a") dc = self.get_commit_editor(repos_url) tags = dc.add_dir("tags") tags.add_dir("tags/foo") dc.add_dir("trunk") dc.close() b = Branch.open(repos_url + "/trunk") self.assertEquals(["foo"], list(b.tags.get_tag_dict().keys())) b.tags.delete_tag(u"foo") b = Branch.open(repos_url + "/trunk") self.assertEquals([], list(b.tags.get_tag_dict().keys()))
def test_tag_set_existing(self): repos_url = self.make_repository('a') dc = self.get_commit_editor(repos_url) dc.add_dir("trunk") dc.add_dir("tags") dc.close() dc = self.get_commit_editor(repos_url) trunk = dc.open_dir("trunk") trunk.add_file("trunk/bla").modify() dc.close() b = Branch.open(repos_url + "/trunk") b.tags.set_tag( u"mytag", b.repository.generate_revision_id(1, u"trunk", b.repository.get_mapping())) self.assertEquals( subvertpy.NODE_DIR, b.repository.svn_transport.check_path("tags/mytag", 3)) self.assertEquals(3, b.repository.get_latest_revnum()) oldtagrevid = b.repository.generate_revision_id( 1, u"trunk", b.repository.get_mapping()) b = Branch.open(repos_url + "/trunk") self.assertEquals({u"mytag": oldtagrevid}, b.tags.get_tag_dict()) newtagrevid = b.repository.generate_revision_id( 2, u"trunk", b.repository.get_mapping()) b.tags.set_tag(u"mytag", newtagrevid) self.assertEquals( subvertpy.NODE_DIR, b.repository.svn_transport.check_path("tags/mytag", 4)) self.assertEquals(4, b.repository.get_latest_revnum()) b = Branch.open(repos_url + "/trunk") log = self.client_log(repos_url, 4, 0) self.assertEquals(log[0][0], None) self.assertEquals(log[1][0], { u'/tags': ('A', None, -1), u'/trunk': ('A', None, -1) }) self.assertEquals(log[2][0], {u'/trunk/bla': ('A', None, -1)}) self.assertEquals(log[3][0], {u'/tags/mytag': ('A', u'/trunk', 1)}) self.assertEquals(log[4][0], {u'/tags/mytag': ('R', u'/trunk', 2)}) self.assertEquals({u"mytag": newtagrevid}, b.tags.get_tag_dict())
def merge_conflicts( main_branch: Branch, other_branch: Branch, other_revision: Optional[bytes] = None ) -> bool: """Check whether two branches are conflicted when merged. Args: main_branch: Main branch to merge into other_branch: Branch to merge (and use for scratch access, needs write access) other_revision: Other revision to check Returns: boolean indicating whether the merge would result in conflicts """ if other_revision is None: other_revision = other_branch.last_revision() if other_branch.repository.get_graph().is_ancestor( main_branch.last_revision(), other_revision ): return False other_branch.repository.fetch( main_branch.repository, revision_id=main_branch.last_revision() ) # Reset custom merge hooks, since they could make it harder to detect # conflicted merges that would appear on the hosting site. old_file_content_mergers = _mod_merge.Merger.hooks["merge_file_content"] _mod_merge.Merger.hooks["merge_file_content"] = [] other_tree = other_branch.repository.revision_tree(other_revision) try: try: merger = _mod_merge.Merger.from_revision_ids( other_tree, other_branch=other_branch, other=main_branch.last_revision(), tree_branch=other_branch, ) except errors.UnrelatedBranches: # Unrelated branches don't technically *have* to lead to # conflicts, but there's not a lot to be salvaged here, either. return True merger.merge_type = _mod_merge.Merge3Merger tree_merger = merger.make_merger() with tree_merger.make_preview_transform(): return bool(tree_merger.cooked_conflicts) finally: _mod_merge.Merger.hooks["merge_file_content"] = old_file_content_mergers
def test_set_last_revision(self): repos_url = self.make_repository('a') dc = self.get_commit_editor(repos_url) trunk = dc.add_dir("trunk") trunk.add_file('trunk/foo').modify() dc.close() #1 dc = self.get_commit_editor(repos_url) trunk = dc.open_dir("trunk") trunk.add_file('trunk/bla').modify() dc.close() #2 dc = self.get_commit_editor(repos_url) trunk = dc.open_dir("trunk") trunk.add_file('trunk/bar').modify() dc.close() #3 branch = Branch.open(repos_url + "/trunk") orig_last_revid = branch.last_revision() branch.set_last_revision_info( 2, branch.generate_revision_id(2), ) self.assertNotEqual(orig_last_revid, branch.last_revision()) self.assertEqual( branch.last_revision(), branch.repository.generate_revision_id(2, u"trunk", branch.mapping))
def make_upstream_version(self, version, contents, pristine_tar_format=None): upstream = self.make_branch_and_tree("upstream") self.build_tree_contents(contents) upstream.smart_add([upstream.basedir]) revprops = {} if pristine_tar_format is not None: _mod_export.export(upstream, "export") if pristine_tar_format == "gz": tarfile_path = "export.tar.gz" _mod_export.export(upstream, tarfile_path, "tgz") revprops["deb-pristine-delta"] = standard_b64encode( make_pristine_tar_delta("export", "export.tar.gz")) elif pristine_tar_format == "bz2": tarfile_path = "export.tar.bz2" _mod_export.export(upstream, tarfile_path, "tbz2") revprops["deb-pristine-delta-bz2"] = standard_b64encode( make_pristine_tar_delta("export", "export.tar.bz2")) else: raise AssertionError("unknown pristine tar format %s" % pristine_tar_format) else: tarfile_path = "export.tar.gz" _mod_export.export(upstream, tarfile_path, "tgz") tarfile_sha1 = osutils.sha_file_by_name(tarfile_path) revid = upstream.commit("import upstream %s" % version, revprops=revprops) source = Branch.open("source") source.repository.fetch(upstream.branch.repository) source.tags.set_tag("upstream-%s" % version, revid) return tarfile_sha1
def test_getting_existing_text_metadata(self): # Create Mercurial repository and Bazaar branch to import into. hgrepo = mercurial.localrepo.localrepository(hgui(), "hg", create=True) hgbranch = Branch.open("hg") bzrtree = self.make_branch_and_tree("bzr") # Create file 'f1' in Mercurial repository, commit it # and pull commited changeset to Bazaar branch. self.build_tree_contents([("hg/f1", "Initial content")]) hgrepo[None].add(["f1"]) hgrepo.commit("Initial commit") bzrtree.pull(hgbranch) # Change content of file 'f1' in Mercurial repository and commit # change. self.build_tree_contents([("hg/f1", "Changed content")]) hgrepo.commit("Change content of file f1") # Pull commited changeset to Bazaar branch. # # Should not raise KeyError which looked like: # # <...full traceback skipped...> # File "/tmp/hg/fetch.py", line 208, in manifest_to_inventory_delta # (fileid, ie.revision)) # KeyError: ('hg:f1', 'hg-v1:97562cfbcf3b26e7eacf17ca9b6f742f98bd0719') bzrtree.pull(hgbranch) # Self-assurance check that changesets was really pulled in. self.assertFileEqual("Changed content", "bzr/f1")
def test_commit_metadata(self): self.make_checkout(self.repos_url, "dc") wt = WorkingTree.open("dc") self.build_tree({'dc/foo/bla': "data", 'dc/bla': "otherdata"}) wt.add('bla') wt.branch.get_config().set_user_option("allow_metadata_in_file_properties", "True") wt.commit(message="data") branch = Branch.open(self.repos_url) branch.lock_write() self.addCleanup(branch.unlock) builder = branch.get_commit_builder([branch.last_revision()], timestamp=4534.0, timezone=2, committer="fry", revision_id="my-revision-id") tree = branch.repository.revision_tree(branch.last_revision()) list(builder.record_iter_changes(tree, branch.last_revision(), [])) builder.finish_inventory() builder.commit("foo") self.assertEqual("3 my-revision-id\n", self.client_get_prop("dc", "bzr:revision-id:v3-none", 2)) self.assertEqual( "timestamp: 1970-01-01 01:15:36.000000000 +0000\ncommitter: fry\n", self.client_get_prop("dc", "bzr:revision-info", 2))
def _suggested_push_location(self): """Suggest a push location when one is not already defined. @return: a sensible location as a string or '' if none. """ # If this is a feature branch and its parent exists locally, # its grandparent is likely to be the hosted master branch. # If so, suggest a push location, otherwise don't. parent_url = self.branch.get_parent() if parent_url and parent_url.startswith("file://"): from breezy.branch import Branch try: parent_branch = Branch.open(parent_url) except errors.NotBranchError: return '' master_url = (parent_branch.get_parent() or parent_branch.get_bound_location()) if master_url and not master_url.startswith("file://"): if master_url.find("launchpad") >= 0: suggest_url = self._build_lp_push_suggestion(master_url) if suggest_url: return suggest_url # XXX we can hook in there even more specific suggesters # XXX maybe we need registry? suggest_url = self._build_generic_push_suggestion(master_url) if suggest_url: return suggest_url return ''
def test_fileid(self): master_branch = self.make_svn_branch("d") os.mkdir("b") local_dir = master_branch.controldir.sprout("b") local_dir.open_branch().bind(master_branch) wt = local_dir.open_workingtree() self.build_tree({'b/file': 'data'}) rootid = wt.get_root_id() wt.branch.nick = "some-nick" wt.add('file') oldid = wt.path2id("file") revid1 = wt.commit(message="Commit from Bzr") wt.rename_one('file', 'file2') revid2 = wt.commit(message="Commit from Bzr") master_branch = Branch.open(master_branch.base) rm_provider = master_branch.repository._revmeta_provider mapping = master_branch.repository.get_mapping() revmeta1 = rm_provider.get_revision(master_branch.get_branch_path(), 2) self.assertEquals({u'': rootid, u"file": oldid}, revmeta1.get_fileid_overrides(mapping)) revmeta2 = rm_provider.get_revision(master_branch.get_branch_path(), 3) self.assertEquals({u"file2": oldid}, revmeta2.get_fileid_overrides(mapping)) tree1 = master_branch.repository.revision_tree(revid1) tree2 = master_branch.repository.revision_tree(revid2) delta = tree2.changes_from(tree1) mutter("changes %r" % list(rm_provider.iter_reverse_branch_changes(master_branch.get_branch_path(), 3, 0))) self.assertEquals(0, len(delta.added)) self.assertEquals(0, len(delta.removed)) self.assertEquals(1, len(delta.renamed))
def test_fetch_file_from_non_branch(self): repos_url = self.make_svn_repository('d') dc = self.get_commit_editor(repos_url) old_trunk = dc.add_dir("old-trunk") lib = old_trunk.add_dir("old-trunk/lib") lib.add_file("old-trunk/lib/file").modify(b"data") dc.close() dc = self.get_commit_editor(repos_url) trunk = dc.add_dir("trunk") lib = trunk.add_dir("trunk/lib") lib.add_file("trunk/lib/file", "old-trunk/lib/file") dc.close() oldrepos = Repository.open(repos_url) oldrepos.set_layout(TrunkLayout(0)) dir = ControlDir.create("f") newrepos = dir.create_repository() oldrepos.copy_content_into(newrepos) mapping = oldrepos.get_mapping() branch = Branch.open("%s/trunk" % repos_url) self.assertEquals(branch.mapping, mapping) self.assertEqual( (1, oldrepos.generate_revision_id(2, "trunk", mapping)), branch.last_revision_info())
def test_commit_out_of_date(self): branch = self.make_svn_branch('d') dc = self.get_commit_editor(branch.base) somedir = dc.add_dir("somedir") somefile = somedir.add_file("somedir/somefile").modify() dc.close() dc = self.get_commit_editor(branch.repository.base) br = Branch.open(branch.base) br.lock_write() self.addCleanup(br.unlock) br.set_append_revisions_only(False) builder = br.get_commit_builder([br.last_revision()]) builder.finish_inventory() trunk = dc.open_dir("trunk") somedir = trunk.open_dir("trunk/somedir") somefile = somedir.open_file("trunk/somedir/somefile").modify() dc.close() e = self.assertRaises(SubversionException, builder.commit, "foo") self.assertEquals(ERR_FS_TXN_OUT_OF_DATE, e.args[1])
def test_commit_join(self): repos_url = self.make_client('d', 'sc') self.build_tree({'sc/trunk/foo/bla': "data"}) self.client_add("sc/trunk") self.client_commit("sc", "foo") self.olddir = ControlDir.open("sc/trunk") os.mkdir("dc") self.newdir = self.olddir.sprout("dc") dc = self.get_commit_editor(repos_url) branches = dc.add_dir("branches") newdir = branches.add_dir("branches/newbranch") newdir.add_file("branches/newbranch/foob").modify() dc.close() wt = self.newdir.open_workingtree() self.build_tree({"dc/lala": "data"}) wt.add(["lala"]) wt.commit(message="init") joinedwt = ControlDir.create_standalone_workingtree("dc/newdir") joinedwt.pull(Branch.open(repos_url+"/branches/newbranch")) wt.subsume(joinedwt) wt.commit(message="doe") self.olddir.open_branch().pull(self.newdir.open_branch()) paths = self.client_log(repos_url, 4, 0)[4][0] self.assertEquals(('A', "/branches/newbranch", 2), paths["/trunk/newdir"])
def test_dumpfile_open_empty(self): dumpfile = os.path.join(self.test_dir, "dumpfile") open(dumpfile, 'w').write("""SVN-fs-dump-format-version: 2 UUID: 6987ef2d-cd6b-461f-9991-6f1abef3bd59 Revision-number: 0 Prop-content-length: 56 Content-length: 56 K 8 svn:date V 27 2006-07-02T13:14:51.972532Z PROPS-END """) branch_path = os.path.join(self.test_dir, "f") repos = self.load_dumpfile(dumpfile, 'g') convert_repository(repos, branch_path, RootLayout(), remember_parent=False) branch = Repository.open(branch_path) self.assertEqual(len(branch.all_revision_ids()), 1) b = Branch.open(branch_path) self.assertEquals(1, b.revno()) self.assertEquals(None, b.get_parent())
def inventory_add_external(inv, parent_id, path, revid, ref_revnum, url): """Add an svn:externals entry to an inventory as a tree-reference. :param inv: Inventory to add to. :param parent_id: File id of directory the entry was set on. :param path: Path of the entry, relative to entry with parent_id. :param revid: Revision to store in newly created inventory entries. :param ref_revnum: Referenced *svn* revision of tree that's being referenced, or None if no specific revision is being referenced. :param url: URL of referenced tree. """ assert ref_revnum is None or isinstance(ref_revnum, int) assert revid is None or isinstance(revid, str) (dir, name) = os.path.split(path) parent = inv.get_entry(parent_id) if dir != "": for part in dir.split("/"): if parent.children.has_key(part): parent = parent.children[part] else: # Implicitly add directory if it doesn't exist yet # TODO: Generate a file id parent = inv.add(InventoryDirectory('someid', part, parent_id=parent.file_id)) parent.revision = revid # FIXME: This can only be a svn branch, so use that fact. reference_branch = Branch.open(url) file_id = reference_branch.get_root_id() ie = TreeReference(file_id, name, parent.file_id, revision=revid) if ref_revnum is not None: ie.reference_revision = reference_branch.generate_revision_id(ref_revnum) else: ie.reference_revision = CURRENT_REVISION inv.add(ie)
def probe_upstream_branch_url(url: str, version=None): parsed = urlparse(url) if parsed.scheme in ('git+ssh', 'ssh', 'bzr+ssh'): # Let's not probe anything possibly non-public. return None import breezy.ui from breezy.branch import Branch old_ui = breezy.ui.ui_factory breezy.ui.ui_factory = breezy.ui.SilentUIFactory() try: b = Branch.open(url) b.last_revision() if version is not None: version = version.split('+git')[0] tag_names = b.tags.get_tag_dict().keys() if not tag_names: # Uhm, hmm return True if _version_in_tags(version, tag_names): return True return False else: return True except Exception: # TODO(jelmer): Catch more specific exceptions? return False finally: breezy.ui.ui_factory = old_ui
def test_open_non_ascii_url(self): repos_url = self.make_repository("a") dc = self.get_commit_editor(repos_url) dc.add_dir('\xd0\xb4\xd0\xbe\xd0\xbc') dc.close() branch = Branch.open(repos_url + "/%D0%B4%D0%BE%D0%BC")
def test_tags_delete_nonexistent(self): repos_url = self.make_repository("a") dc = self.get_commit_editor(repos_url) dc.add_dir("trunk") dc.close() b = Branch.open(repos_url + "/trunk") self.assertRaises(NoSuchTag, b.tags.delete_tag, u"foo")
def test_get_branch_path_subdir(self): repos_url = self.make_repository("a") dc = self.get_commit_editor(repos_url) dc.add_dir("trunk") dc.close() branch = Branch.open(repos_url + "/trunk") self.assertEqual("trunk", branch.get_branch_path())
def open_packaging_branch(location, possible_transports=None): """Open a packaging branch from a location string. location can either be a package name or a full URL """ if '/' not in location: pkg_source = get_source_package(location) vcs_type, location = source_package_vcs_url(pkg_source) return Branch.open(location, possible_transports=possible_transports)