def push_delete(self, branch): """Delete 'branch' from the remote. :branch: string name of the branch :returns: None """ phlgit_push.delete(self._clone, branch, self._remote)
def push_delete(self, branch, *args): """Delete 'branch' from the remote. :branch: string name of the branch :*args: (optional) more string names of branches :returns: None """ phlgit_push.delete(self, self._remote, branch, *args)
def remove_landinglog(repo): """Remove the legacy landing log ref for the 'origin' of 'repo'. Behaviour is undefined if the landing log ref is not present, use 'is_legacy_landinglog_branch_present' to determine this first. :repo: a callable supporting git commands, e.g. repo("status") :returns: None """ legacy_landinglog_name = phlgitu_ref.Name(_LEGACY_LANDINGLOG_NAME) phlgit_push.delete(repo, 'origin', legacy_landinglog_name.fq)
def processUpdatedBranch( mailer, conduit, gitContext, review_branch, working_branch): abdte = abdt_exception if working_branch is None: print "create review for " + review_branch.branch tryCreateReview( mailer, conduit, gitContext, review_branch, mail_on_fail=True) else: commenter = abdcmnt_commenter.Commenter(conduit, working_branch.id) if abdt_naming.isStatusBadPreReview(working_branch): hasChanged = not phlgit_branch.is_identical( gitContext.clone, review_branch.remote_branch, working_branch.remote_branch) print "try again to create review for " + review_branch.branch phlgit_push.delete( gitContext.clone, working_branch.branch, gitContext.remote) tryCreateReview( mailer, conduit, gitContext, review_branch, mail_on_fail=hasChanged) else: print "update review for " + review_branch.branch revision = phlcon_differential.query( conduit, [working_branch.id])[0] author_user = phlcon_user.query_usernames_from_phids( conduit, [revision.authorPHID])[0] try: updateReview( conduit, gitContext, review_branch, working_branch, author_user) except abdte.LandingException as e: print "landing exception" abdt_workingbranch.pushBadLand( gitContext, review_branch, working_branch) commenter.exception(e) with phlsys_conduit.act_as_user_context(conduit, author_user): phlcon_differential.create_comment( conduit, working_branch.id, action=phlcon_differential.Action.rethink) except abdte.AbdUserException as e: print "user exception" abdt_workingbranch.pushBadInReview( gitContext, review_branch, working_branch) commenter.exception(e)
def processAbandonedBranches(conduit, clone, remote, wbList, remote_branches): for wb in wbList: rb = abdt_naming.makeReviewBranchNameFromWorkingBranch(wb) if rb not in remote_branches: print "delete abandoned branch: " + wb.branch try: revisionid = int(wb.id) except ValueError: pass else: commenter = abdcmnt_commenter.Commenter(conduit, revisionid) commenter.abandonedBranch(rb) # TODO: abandon the associated revision if not already phlgit_push.delete(clone, wb.branch, remote)
def land(conduit, wb, gitContext, branch): clone = gitContext.clone print "landing " + wb.remote_branch + " onto " + wb.remote_base name, email, user = abdt_conduitgit.getPrimaryNameEmailAndUserFromBranch( clone, conduit, wb.remote_base, wb.remote_branch) d = phlcon_differential with phlsys_conduit.act_as_user_context(conduit, user): phlgit_checkout.new_branch_force_based_on( clone, wb.base, wb.remote_base) # compose the commit message message = d.get_commit_message(conduit, wb.id) try: with phlsys_fs.nostd(): squashMessage = phlgit_merge.squash( clone, wb.remote_branch, message, name + " <" + email + ">") except phlsys_subprocess.CalledProcessError as e: clone.call("reset", "--hard") # fix the working copy raise abdt_exception.LandingException( '\n' + e.stdout, branch, wb.base) print "- pushing " + wb.remote_base phlgit_push.push(clone, wb.base, gitContext.remote) print "- deleting " + wb.branch phlgit_push.delete(clone, wb.branch, gitContext.remote) print "- deleting " + branch phlgit_push.delete(clone, branch, gitContext.remote) print "- commenting on revision " + str(wb.id) commenter = abdcmnt_commenter.Commenter(conduit, wb.id) commenter.landedReview(branch, wb.base, squashMessage) authorPHID = d.query(conduit, [wb.id])[0].authorPHID authorUser = phlcon_user.query_usernames_from_phids( conduit, [authorPHID])[0] # TODO: there's a potential race condition on the author here with phlsys_conduit.act_as_user_context(conduit, authorUser): d.close(conduit, wb.id)