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 setup_tree(self): wt = ControlDir.create_standalone_workingtree('.') a = wt.commit("base A", allow_pointless=True) b = wt.commit("base B", allow_pointless=True) c = wt.commit("base C", allow_pointless=True) return wt, [a, b, c]
def setup_tree(self): wt = ControlDir.create_standalone_workingtree('.') wt.commit("base A", allow_pointless=True, rev_id=b'A') wt.commit("base B", allow_pointless=True, rev_id=b'B') wt.commit("base C", allow_pointless=True, rev_id=b'C') return wt
def test_push_unnecessary_merge(self): from breezy.debug import debug_flags debug_flags.add("commit") debug_flags.add("fetch") repos_url = self.make_svn_repository("a") bzrwt = ControlDir.create_standalone_workingtree("c") self.build_tree({'c/registry/generic.c': b"Tour"}) bzrwt.add("registry") bzrwt.add("registry/generic.c") revid1 = bzrwt.commit("Add initial directory + file", rev_id=b"initialrevid") # Push first branch into Subversion newdir = ControlDir.open(repos_url + "/trunk") config = BranchConfig(repos_url + "/trunk", newdir.find_repository().uuid) config.set_user_option("allow_metadata_in_file_properties", "True") newbranch = newdir.import_branch(bzrwt.branch) c = ra.RemoteAccess(repos_url) self.assertTrue( c.check_path("trunk/registry/generic.c", c.get_latest_revnum()) == subvertpy.NODE_FILE) dc = self.get_commit_editor(repos_url) trunk = dc.open_dir("trunk") registry = trunk.open_dir("trunk/registry") registry.open_file("trunk/registry/generic.c").modify(b"BLA") dc.close() mapping = newdir.find_repository().get_mapping() merge_revid = newdir.find_repository().generate_revision_id( 2, u"trunk", mapping) # Merge self.build_tree({'c/registry/generic.c': b"DE"}) bzrwt.add_pending_merge(merge_revid) self.assertEquals(bzrwt.get_parent_ids()[1], merge_revid) revid2 = bzrwt.commit("Merge something", rev_id=b"mergerevid") bzr_parents = bzrwt.branch.repository.get_revision(revid2).parent_ids trunk = Branch.open(repos_url + "/trunk") self.assertRaises(AppendRevisionsOnlyViolation, trunk.pull, bzrwt.branch) trunk.set_append_revisions_only(False) trunk.pull(bzrwt.branch) self.assertEquals(tuple(bzr_parents), trunk.repository.get_revision(revid2).parent_ids) self.assertEquals((2, revid2), trunk.last_revision_info()) self.assertEquals( b'1 initialrevid\n2 mergerevid\n', self.client_get_prop(repos_url + "/trunk", SVN_PROP_BZR_REVISION_ID + "v3-trunk0", c.get_latest_revnum()))
def test_import_branch(self): repos_url = self.make_svn_repository("d") x = ControlDir.open(repos_url+"/trunk") origb = ControlDir.create_standalone_workingtree("origb") self.build_tree({'origb/twin': 'bla', 'origb/peaks': 'bloe'}) origb.add(["twin", "peaks"]) origb.commit("Message") b = x.import_branch(source=origb.branch) self.assertEquals(origb.branch.last_revision_info(), b.last_revision_info()) self.assertEquals(origb.branch.last_revision_info(), Branch.open(repos_url+"/trunk").last_revision_info())
def test_resign_directory(self): """Test --directory option""" wt = ControlDir.create_standalone_workingtree('a') a = wt.commit("base A", allow_pointless=True) b = wt.commit("base B", allow_pointless=True) c = wt.commit("base C", allow_pointless=True) repo = wt.branch.repository self.monkey_patch_gpg() self.run_bzr('re-sign --directory=a -r revid:' + a.decode('utf-8')) self.assertEqualSignature(repo, a) self.run_bzr('re-sign -d a %s' % b.decode('utf-8')) self.assertEqualSignature(repo, b)
def test_resign_directory(self): """Test --directory option""" wt = ControlDir.create_standalone_workingtree('a') wt.commit("base A", allow_pointless=True, rev_id=b'A') wt.commit("base B", allow_pointless=True, rev_id=b'B') wt.commit("base C", allow_pointless=True, rev_id=b'C') repo = wt.branch.repository self.monkey_patch_gpg() self.run_bzr('re-sign --directory=a -r revid:A') self.assertEqualSignature(repo, b'A') self.run_bzr('re-sign -d a B') self.assertEqualSignature(repo, b'B')
def test_non_svn_branch(self): revspec = RevisionSpec.from_string("svn:0") branch = ControlDir.create_standalone_workingtree("a").branch self.assertRaises(BzrError, revspec._match_on, branch, None)