def land(self, author_name, author_email, message): """Integrate the branch into the base and remove the review branch.""" review_hash = phlgit_revparse.get_sha1(self._clone, self._tracking_branch.remote_branch) self._clone.checkout_forced_new_branch(self._tracking_branch.base, self._tracking_branch.remote_base) try: result = self._lander(self._clone, self._tracking_branch.remote_branch, author_name, author_email, message) except abdt_lander.LanderException as e: self._clone.call("reset", "--hard") # fix the working copy raise abdt_exception.LandingException(str(e), self.review_branch_name(), self._tracking_branch.base) landing_hash = phlgit_revparse.get_sha1(self._clone, self._tracking_branch.base) # don't tryloop here as it's more expected that we can't push the base # due to permissioning or some other error try: self._clone.push(self._tracking_branch.base) except Exception as e: raise abdt_exception.LandingPushBaseException(str(e), self.review_branch_name(), self._tracking_branch.base) self._tryloop( lambda: self._clone.push_delete(self._tracking_branch.branch, self.review_branch_name()), "push-delete-landed", ) abdt_landinglog.prepend(self._clone, review_hash, self.review_branch_name(), landing_hash) # push the landing log, don't care if it fails to push try: def push_landinglog(): abdt_landinglog.push_log(self._clone, self._clone.get_remote()) self._tryloop(push_landinglog, "push-landinglog") except Exception: # XXX: don't worry if we can't push the landinglog, this is most # likely a permissioning issue but not a showstopper. # we should probably nag on the review instead. pass self._review_branch = None self._tracking_branch = None return result
def land(self, author_name, author_email, message): """Integrate the branch into the base and remove the review branch.""" self._repo.checkout_forced_new_branch( self._tracking_branch.base, self._tracking_branch.remote_base) try: result = self._lander(self._repo, self._tracking_branch.remote_branch, author_name, author_email, message) except abdt_lander.LanderException as e: self._repo("reset", "--hard") # fix the working copy raise abdt_exception.LandingException(str(e), self.review_branch_name(), self._tracking_branch.base) landing_hash = phlgit_revparse.get_sha1(self._repo, self._tracking_branch.base) # don't tryloop here as it's more expected that we can't push the base # due to permissioning or some other error try: self._repo.push(self._tracking_branch.base) except Exception as e: raise abdt_exception.LandingPushBaseException( str(e), self.review_branch_name(), self._tracking_branch.base) self._tryloop( lambda: self._repo.push_delete(self._tracking_branch.branch, self.review_branch_name()), abdt_errident.PUSH_DELETE_LANDED) self._repo.archive_to_landed(self._tracking_hash, self.review_branch_name(), self._tracking_branch.base, landing_hash, message) # push the landing archive, don't escalate if it fails to push try: # XXX: oddly pylint complains if we call push_landed() directly: # "Using method (_tryloop) as an attribute (not invoked)" def push_landed(): self._repo.push_landed() self._tryloop(push_landed, abdt_errident.PUSH_LANDING_ARCHIVE) except Exception: # XXX: don't worry if we can't push the landed, this is most # likely a permissioning issue but not a showstopper. # we should probably nag on the review instead. pass self._review_branch = None self._review_hash = None self._tracking_branch = None self._tracking_hash = None return result
def land(self, author_name, author_email, message): """Integrate the branch into the base and remove the review branch.""" self._repo.checkout_forced_new_branch( self._tracking_branch.base, self._tracking_branch.remote_base) try: result = self._lander( self._repo, self._tracking_branch.remote_branch, author_name, author_email, message) except abdt_lander.LanderException as e: self._repo("reset", "--hard") # fix the working copy raise abdt_exception.LandingException( str(e), self.review_branch_name(), self._tracking_branch.base) landing_hash = phlgit_revparse.get_sha1( self._repo, self._tracking_branch.base) # don't tryloop here as it's more expected that we can't push the base # due to permissioning or some other error try: self._repo.push(self._tracking_branch.base) except Exception as e: raise abdt_exception.LandingPushBaseException( str(e), self.review_branch_name(), self._tracking_branch.base) self._tryloop( lambda: self._repo.push_delete( self._tracking_branch.branch, self.review_branch_name()), abdt_errident.PUSH_DELETE_LANDED) self._repo.archive_to_landed( self._tracking_hash, self.review_branch_name(), self._tracking_branch.base, landing_hash, message) # push the landing archive, don't escalate if it fails to push try: # XXX: oddly pylint complains if we call push_landed() directly: # "Using method (_tryloop) as an attribute (not invoked)" def push_landed(): self._repo.push_landed() self._tryloop( push_landed, abdt_errident.PUSH_LANDING_ARCHIVE) except Exception: # XXX: don't worry if we can't push the landed, this is most # likely a permissioning issue but not a showstopper. # we should probably nag on the review instead. pass self._review_branch = None self._review_hash = None self._tracking_branch = None self._tracking_hash = None return result