def testApplyAndPush(self): clone(self.repodir, self.wc) def c(repo, attempt): run_cmd(['hg', 'tag', '-f', 'TEST'], cwd=repo) apply_and_push(self.wc, self.repodir, c) self.assertEquals(getRevisions(self.wc), getRevisions(self.repodir))
def testApplyAndPush(self): clone(self.repodir, self.wc) def c(repo, attempt): run_cmd(["hg", "tag", "-f", "TEST"], cwd=repo) apply_and_push(self.wc, self.repodir, c) self.assertEquals(getRevisions(self.wc), getRevisions(self.repodir))
def tag_repo(workdir, branch, tags, pushRepo, hg_username, hg_ssh_key): def tag_and_push(repo, attempt): update(workdir, branch) tag(workdir, tags, rev=branch, force=True, user=hg_username) log.info("Tagged %s, attempt #%s" % (repo, attempt)) apply_and_push(workdir, pushRepo, tag_and_push, ssh_username=hg_username, ssh_key=hg_ssh_key)
def testApplyAndPushRebaseFails(self): clone(self.repodir, self.wc) def c(repo, attempt, remote): run_cmd(['hg', 'tag', '-f', 'TEST'], cwd=repo) if attempt in (1,2): run_cmd(['hg', 'tag', '-f', 'CONFLICTING_TAG'], cwd=remote) apply_and_push(self.wc, self.repodir, lambda r, a: c(r, a, self.repodir), max_attempts=3) self.assertEquals(getRevisions(self.wc), getRevisions(self.repodir))
def testApplyAndPushWithRebase(self): clone(self.repodir, self.wc) def c(repo, attempt, remote): run_cmd(['hg', 'tag', '-f', 'TEST'], cwd=repo) if attempt == 1: run_cmd(['hg', 'rm', 'hello.txt'], cwd=remote) run_cmd(['hg', 'commit', '-m', 'test'], cwd=remote) apply_and_push(self.wc, self.repodir, lambda r, a: c(r, a, self.repodir), max_attempts=2) self.assertEquals(getRevisions(self.wc), getRevisions(self.repodir))
def testApplyAndPushWithRebase(self): clone(self.repodir, self.wc) def c(repo, attempt, remote): run_cmd(["hg", "tag", "-f", "TEST"], cwd=repo) if attempt == 1: run_cmd(["hg", "rm", "hello.txt"], cwd=remote) run_cmd(["hg", "commit", "-m", "test"], cwd=remote) apply_and_push(self.wc, self.repodir, lambda r, a: c(r, a, self.repodir), max_attempts=2) self.assertEquals(getRevisions(self.wc), getRevisions(self.repodir))
def testApplyAndPushForce(self): clone(self.repodir, self.wc) def c(repo, attempt, remote, local): run_cmd(['touch', 'newfile'], cwd=remote) run_cmd(['hg', 'add', 'newfile'], cwd=remote) run_cmd(['hg', 'commit', '-m', '"add newfile"'], cwd=remote) run_cmd(['touch', 'newfile'], cwd=local) run_cmd(['hg', 'add', 'newfile'], cwd=local) run_cmd(['hg', 'commit', '-m', '"re-add newfile"'], cwd=local) apply_and_push(self.wc, self.repodir, (lambda r, a: c(r, a, self.repodir, self.wc)), force=True)
def testApplyAndPushForce(self): clone(self.repodir, self.wc) def c(repo, attempt, remote, local): run_cmd(["touch", "newfile"], cwd=remote) run_cmd(["hg", "add", "newfile"], cwd=remote) run_cmd(["hg", "commit", "-m", '"add newfile"'], cwd=remote) run_cmd(["touch", "newfile"], cwd=local) run_cmd(["hg", "add", "newfile"], cwd=local) run_cmd(["hg", "commit", "-m", '"re-add newfile"'], cwd=local) apply_and_push(self.wc, self.repodir, (lambda r, a: c(r, a, self.repodir, self.wc)), force=True)
def testApplyAndPushRebaseFails(self): clone(self.repodir, self.wc) def c(repo, attempt, remote): run_cmd(['hg', 'tag', '-f', 'TEST'], cwd=repo) if attempt in (1, 2): run_cmd(['hg', 'tag', '-f', 'CONFLICTING_TAG'], cwd=remote) apply_and_push(self.wc, self.repodir, lambda r, a: c(r, a, self.repodir), max_attempts=3) self.assertEquals(getRevisions(self.wc), getRevisions(self.repodir))
def import_and_push(repo, bug, branch_name, patch_ids, patches_dir, add_try_commit, try_syntax, pull_repo, push_repo, ssh_username, ssh_key): def changer(repo, attempt): log.debug("Importing patches, attemp #%s", attempt) import_patches(bug=bug, branch_name=branch_name, patch_ids=patch_ids, patches_dir=patches_dir, repo=repo, add_try_commit=add_try_commit, pull_repo=pull_repo, try_syntax=try_syntax) setup_repo(repo=repo, pull_repo=pull_repo) apply_and_push(localrepo=repo, remote=push_repo, changer=changer, max_attempts=10, ssh_username=ssh_username, ssh_key=ssh_key, force=False) return get_revision(repo)
rs_args = get_release_sanity_args(configs_workdir, release, cfgFile, masters_json, buildbot_configs_branch) release_sanity_script = "%s/buildbot-helpers/release_sanity.py" % tools_workdir run_cmd(['python', release_sanity_script] + rs_args + ['--dry-run']) rr.update_status( release, 'Waiting for other releases to run release sanity' ) try: # Pushing doesn't happen until _after_ release sanity has been run # for all releases to minimize the chance of bad configs being # pushed. apply_and_push calls process_configs, and if it returns # successfully, it pushes all of the changes that it made. apply_and_push(configs_workdir, configs_pushRepo, process_configs, ssh_username=hg_username, ssh_key=hg_ssh_key) # Now that we know that all of the configs are good, we can tag # the other repositories for release in rr.new_releases: rr.update_status(release, 'Tagging other repositories') tag_repo(workdir=custom_workdir, branch=buildbotcustom_branch, tags=tags, pushRepo=custom_pushRepo, hg_username=hg_username, hg_ssh_key=hg_ssh_key) tag_repo(workdir=tools_workdir, branch=tools_branch, tags=tags, pushRepo=tools_pushRepo, hg_username=hg_username, hg_ssh_key=hg_ssh_key) for release in rr.new_releases: rr.update_status(release, 'Reconfiging masters') # Reconfig the masters and configure the warning callback, if present.
cfgFile, masters_json, buildbot_configs_branch) release_sanity_script = "%s/buildbot-helpers/release_sanity.py" % tools_workdir run_cmd(['python', release_sanity_script] + rs_args + ['--dry-run']) rr.update_status( release, 'Waiting for other releases to run release sanity') try: # Pushing doesn't happen until _after_ release sanity has been run # for all releases to minimize the chance of bad configs being # pushed. apply_and_push calls process_configs, and if it returns # successfully, it pushes all of the changes that it made. apply_and_push(configs_workdir, configs_pushRepo, process_configs, ssh_username=hg_username, ssh_key=hg_ssh_key) # Now that we know that all of the configs are good, we can tag # the other repositories for release in rr.new_releases: rr.update_status(release, 'Tagging other repositories') tag_repo(workdir=custom_workdir, branch=buildbotcustom_branch, tags=tags, pushRepo=custom_pushRepo, hg_username=hg_username, hg_ssh_key=hg_ssh_key) tag_repo(workdir=tools_workdir, branch=tools_branch,