def publish(output = ABS_OUTPUT_PATH): """ Publishes the current master branch to GH Pages """ src = git.SOURCE_BRANCH live = git.DEPLOY_BRANCH git.change_branch(live) git.merge(src) generate('./') com_stat = git.commit_all() if com_stat: git.push(live) git.change_branch(src)
def publish(output=ABS_OUTPUT_PATH): """ Publishes the current master branch to GH Pages """ src = git.SOURCE_BRANCH live = git.DEPLOY_BRANCH git.change_branch(live) git.merge(src) generate('./') com_stat = git.commit_all() if com_stat: git.push(live) git.change_branch(src)
def mergeShadow(self): print "Merging Shadow" git = self.shadow #checkout a copy of the wiki branch print "Checkout %s" % (self.vcs.get("branch")) self.checkoutBranch(self.vcs.get("branch"),repo=self.shadow) self.shadow.active_branch.pull() #switch back to master print "Checkout %s" % (self.vcs.get("shadow_branch")) self.checkoutBranch(self.vcs.get("shadow_branch"),repo=self.shadow) self.shadow.active_branch.pull() git.merge(self.vcs.get("branch"),self.vcs.get("shadow_master")) git.push()
def mergeShadow(self): print "Merging Shadow" git = self.shadow #checkout a copy of the wiki branch print "Checkout %s" % (self.vcs.get("branch")) self.checkoutBranch(self.vcs.get("branch"), repo=self.shadow) self.shadow.active_branch.pull() #switch back to master print "Checkout %s" % (self.vcs.get("shadow_branch")) self.checkoutBranch(self.vcs.get("shadow_branch"), repo=self.shadow) self.shadow.active_branch.pull() git.merge(self.vcs.get("branch"), self.vcs.get("shadow_master")) git.push()
def _git_merge(branch, local_branches): if branch in local_branches: git.remove_branch(branch) git.checkout(branch) git_master_head_local_done = git.get_head("remotes/origin/master") git_remote_head_local_done = git.get_head(branch) git.get_status() git_merge_status = git.merge() git_branch_head_merged = git.get_head(branch) # sql_info, bsh_info, config_info = git.get_diff() git_sql_info, git_bsh_info, git_config_info = None, None, None dbcon.execute( """update branch set git_master_head_local_done=?, git_remote_head_local_done=?, git_branch_head_merged=?, git_merge_status=?, git_sql_info=?, git_bsh_info=?, git_config_info=?, git_last_update_time=? where branch=?;""", ( git_master_head_local_done, git_remote_head_local_done, git_branch_head_merged, git_merge_status, git_sql_info, git_bsh_info, git_config_info, int(time.time()), branch, ), )
def merge(repo_dir, gaia_url, branch_to, branch_from): git.delete_gaia(repo_dir) t = util.time_start() if os.path.exists(repo_dir): print "Updating Gaia" git.update_gaia(repo_dir, gaia_url) print "Updated Gaia in %0.2f seconds" % util.time_end(t) else: print "Creating Gaia" git.create_gaia(repo_dir, gaia_url) # This is sadly broken print "Created Gaia in %0.2f seconds" % util.time_end(t) print "Merging %s into branch %s" % (branch_from, branch_to) if not branch_to in git.branches(repo_dir): print >> sys.stderr, "Asking to merge into a branch that doesn't exist (%s)" % branch_to return None if not branch_from in git.branches(repo_dir): print >> sys.stderr, "Asking to merge from a branch that doesn't exist (%s)" % branch_from return None git.checkout(repo_dir, branch_to) start_commit = git.get_rev(repo_dir) git.merge(repo_dir, branch_from, strategy="recursive") end_commit = git.get_rev(repo_dir) print "Merge range is %s..%s" % (start_commit[:7], end_commit[:7]) print git.log(repo_dir, "%s..%s" % (start_commit, end_commit), pretty="oneline") print "Dry Run push" git.push(repo_dir, remote="origin", branches=[branch_to], dry_run=True) info = git.push(repo_dir, remote="origin", branches=[branch_to]) print "Would be pusing to %s" % info["url"] for branch in info["branches"].keys(): s, e = info["branches"][branch] print " %s: %s..%s" % (branch, s, e) if util.ask_yn("Push for realises?"): info = git.push(repo_dir, remote="origin", branches=[branch_to], dry_run=False) print "Pushed to %s" % info["url"] for branch in info["branches"].keys(): s, e = info["branches"][branch] print " %s: %s..%s" % (branch, s, e) comment(repo_dir, branch_to, "%s..%s" % (start_commit, end_commit))
from apps import app from git import verify_new_branch, clone, push, merge from k8s import apply_cluster, verify_existed from efs import efs_create_directory import sys emissor = sys.argv[1] ambiente = sys.argv[2] new_branch = sys.argv[3] def create_object(emissor, ambiente, new_branch): app_object = app(name_app = emissor, ambiente = ambiente, new_branch = new_branch) return app_object if __name__ == "__main__": verify_new_branch(new_branch, ambiente) clone(new_branch, ambiente) app_object = create_object(emissor, ambiente, new_branch) NEW_COMMIT = verify_existed(app_object.name_deployment, app_object.name_ingress, app_object.name_app, app_object.ambiente) NEW_PUSH = push(NEW_COMMIT, app_object.ambiente, app_object.new_branch) merge(app_object.ambiente, NEW_PUSH, app_object.new_branch) efs_create_directory(app_object.name_app, app_object.ambiente) apply_cluster(app_object.name_app, app_object.name_deployment, app_object.name_ingress, app_object.ambiente)
def completed_task(self, identifier, partials=False, branch="master"): """Labels a task as completed. Args: identifier: string that uniquely identifies the task. partials: indicates if local commits exist. branch: remote branch to push to. Returns: The recently labeled task is returned. """ task = self._get_task(identifier, "WorkingOn") if task: completed_task_info = dict(zip(labels, task[0])) completed_task_info["completed"] = time.strftime( "%Y-%m-%d %H:%M:%S") completed_task = Task(completed_task_info, "Completed") status = self.add_task_into("Completed", completed_task, True) self.delete_task(identifier) git.make( completed_task.info["description"], "origin", completed_task.info["identifier"], partials ) self.log.add_entry("Pushed to branch: OK", "Successfully pushed" " changes to branch.", time.strftime("%Y-%m-%d %H:%M:%S")) git.merge(completed_task.info["identifier"], branch) self.partials_exist = False self.log.add_entry("Merged with {}: OK".format(branch), "Successfully merged feature branch with " "{}.".format(branch), time.strftime("%Y-%m-%d %H:%M:%S")) if status: if completed_task in self.recent_tasks: self.recent_tasks.update(completed_task, "Completed") print("Information updated.") self.log.add_entry("Updated in Cache after complete: OK.", "Task with id {} successfully" " updated in cache.".format( completed_task.info["identifier"]), time.strftime("%Y-%m-%d %H:%M:%S")) else: self.recent_tasks.push(completed_task) print("Task added to cache.") self.log.add_entry("Add to Cache after complete: OK.", "Task with id {} successfully" " added to cache.".format( completed_task.info["identifier"]), time.strftime("%Y-%m-%d %H:%M:%S")) return completed_task else: print("There were problems when adding the completed task" " to the 'Completed' table.") self.log.add_entry("Label task as compelted: ERROR.", "Task with id {} could not be added to the" " 'Completed' table".format( completed_task.info["identifier"]), time.strftime("%Y-%m-%d %H:%M:%S")) else: print("There is no task with that identifier waiting to be" " completed.")