def test_C_BadPreReviewToNew(self): # can move bad_pre_review -> 'new' states without duplicating branches base, branch_name, branch = self._setup_for_untracked_branch() transition_list = [ branch.mark_ok_new_review, branch.mark_new_bad_in_review ] for do_transition in transition_list: branches = phlgit_branch.get_remote(self.repo_arcyd, 'origin') branch.mark_bad_pre_review() branches_bad_pre = phlgit_branch.get_remote( self.repo_arcyd, 'origin') do_transition(102) branches_new = phlgit_branch.get_remote(self.repo_arcyd, 'origin') # we expect to have gained one branch when starting to track as # 'bad_pre_review'. self.assertEqual(len(branches_bad_pre), len(branches) + 1) # we expect to have the same number of branches after moving with # 'mark_ok_new_review' self.assertEqual(len(branches_bad_pre), len(branches_new)) # remove the tracking branch and make sure the count has gone down branch.clear_mark() branches_cleared = phlgit_branch.get_remote( self.repo_arcyd, 'origin') self.assertEqual(len(branches_cleared), len(branches))
def get_remote_branches(self): """Return a list of string names of remote branches. :returns: list of string names """ return phlgit_branch.get_remote(self._clone, self._remote)
def processUpdatedRepo(conduit, path, remote, mailer): clone = phlsys_git.GitClone(path) remote_branches = phlgit_branch.get_remote(clone, remote) gitContext = abdt_gittypes.GitContext(clone, remote, remote_branches) wbList = abdt_naming.getWorkingBranches(remote_branches) makeRb = abdt_naming.makeReviewBranchNameFromWorkingBranch rbDict = dict((makeRb(wb), wb) for wb in wbList) processAbandonedBranches(conduit, clone, remote, wbList, remote_branches) for b in remote_branches: if abdt_naming.isReviewBranchPrefixed(b): review_branch = abdt_naming.makeReviewBranchFromName(b) if review_branch is None: # TODO: handle this case properly continue review_branch = abdt_gittypes.makeGitReviewBranch( review_branch, remote) working_branch = None if b in rbDict.keys(): working_branch = rbDict[b] working_branch = abdt_gittypes.makeGitWorkingBranch( working_branch, remote) processUpdatedBranch( mailer, conduit, gitContext, review_branch, working_branch)
def get_remote_branches(self): """Return a list of string names of remote branches. :returns: list of string names """ return phlgit_branch.get_remote(self, self._remote)
def _getTheOnlyReviewId(self): with phlsys_fs.chdir_context("phab"): clone = phlsys_git.GitClone(".") branches = phlgit_branch.get_remote(clone, "origin") wbList = abdt_naming.getWorkingBranches(branches) self.assertEqual(len(wbList), 1) wb = wbList[0] return wb.id
def _countPhabBadWorkingBranches(self): with phlsys_fs.chdir_context("phab"): clone = phlsys_git.GitClone(".") branches = phlgit_branch.get_remote(clone, "origin") wbList = abdt_naming.getWorkingBranches(branches) numBadBranches = 0 for wb in wbList: if abdt_naming.isStatusBad(wb): numBadBranches += 1 return numBadBranches
def _countPhabWorkingBranches(self): with phlsys_fs.chdir_context("phab"): clone = phlsys_git.GitClone(".") branches = phlgit_branch.get_remote(clone, "origin") wbList = abdt_naming.getWorkingBranches(branches) return len(wbList)