def _setup_for_untracked_branch(self, repo_name='name', branch_url=None): base = abdt_naming.EXAMPLE_REVIEW_BRANCH_BASE naming = abdt_classicnaming.Naming() branch_name = abdt_classicnaming.EXAMPLE_REVIEW_BRANCH_NAME self.repo_dev('checkout', '-b', branch_name) phlgit_push.push(self.repo_dev, branch_name, 'origin') self.repo_arcyd('fetch', 'origin') review_branch = naming.make_review_branch_from_name(branch_name) review_hash = phlgit_revparse.get_sha1_or_none( self.repo_arcyd, review_branch.branch) branch = abdt_branch.Branch( self.repo_arcyd, review_branch, review_hash, None, None, None, repo_name, branch_url) # should not raise branch.verify_review_branch_base() return base, branch_name, branch
def _get_log_raw(repo): """Return the raw contents of the landinglog from the supplied 'repo'. If there is no landinglog then return an empty string. :repo: a callable supporting git commands, e.g. repo("status") :returns: the contents of the landinglog from the supplied 'repo' """ result = "" if phlgit_revparse.get_sha1_or_none(repo, _LOCAL_LANDINGLOG_REF): result = phlgit_show.object_(repo, _LOCAL_LANDINGLOG_REF) return result
def _get_log_raw(clone): """Return the raw contents of the landinglog from the supplied 'clone'. If there is no landinglog then return an empty string. :clone: supports clone.call() for interacting with git :returns: the contents of the landinglog from the supplied 'clone' """ result = "" if phlgit_revparse.get_sha1_or_none(clone, _LOCAL_LANDINGLOG_REF): result = phlgit_show.object_(clone, _LOCAL_LANDINGLOG_REF) return result
def get_any_author_emails(self): """Return a list of emails from the branch. If the branch has an invalid base or has no history against the base then resort to using the whole history. Useful if 'get_author_names_emails' fails. """ if phlgit_revparse.get_sha1_or_none(self._clone, self._review_branch.remote_base) is None: hashes = phlgit_log.get_last_n_commit_hashes_from_ref(self._clone, 1, self._review_branch.remote_branch) else: hashes = self._get_commit_hashes() if not hashes: hashes = phlgit_log.get_last_n_commit_hashes_from_ref(self._clone, 1, self._review_branch.remote_branch) committers = phlgit_log.get_author_names_emails_from_hashes(self._clone, hashes) emails = [committer[1] for committer in committers] return emails
def get_any_author_emails(self): """Return a list of emails from the branch. If the branch has an invalid base or has no history against the base then resort to using the whole history. Useful if 'get_author_names_emails' fails. """ if phlgit_revparse.get_sha1_or_none( self._repo, self._review_branch.remote_base) is None: hashes = phlgit_log.get_last_n_commit_hashes_from_ref( self._repo, 1, self._review_branch.remote_branch) else: hashes = self._get_commit_hashes() if not hashes: hashes = phlgit_log.get_last_n_commit_hashes_from_ref( self._repo, 1, self._review_branch.remote_branch) committers = phlgit_log.get_author_names_emails_from_hashes( self._repo, hashes) emails = [committer[1] for committer in committers] return emails
def _setup_for_untracked_branch(self, repo_name='name', branch_url=None): base = abdt_naming.EXAMPLE_REVIEW_BRANCH_BASE naming = abdt_classicnaming.Naming() branch_name = abdt_classicnaming.EXAMPLE_REVIEW_BRANCH_NAME self.repo_dev('checkout', '-b', branch_name) phlgit_push.push(self.repo_dev, branch_name, 'origin') self.repo_arcyd('fetch', 'origin') review_branch = naming.make_review_branch_from_name(branch_name) review_hash = phlgit_revparse.get_sha1_or_none(self.repo_arcyd, review_branch.branch) branch = abdt_branch.Branch(self.repo_arcyd, review_branch, review_hash, None, None, None, repo_name, branch_url) # should not raise branch.verify_review_branch_base() return base, branch_name, branch