def projectStartTest(CASE_NO): gitConnection = GitConnect() gitConnection.checkForUnsavedChanges() fbConnection = FogBugzConnect() #get the appropriate cases out of FogBugz (parent,test) = fbConnection.getCaseTuple(CASE_NO) if not fbConnection.isReadyForTest(parent): print "This doesn't look ready to be tested (resolved/implemented)... are you sure about this? (press Enter to continue)" raw_input() gitConnection.fetch() gitConnection.checkoutBranch(parent,None,fbConnection) fbConnection.startCase(test,enforceNoTestCases=False) gitHubConnection = GitHubConnect() gitHubConnection.openPullRequestByName("work-%d" % CASE_NO)
def projectIntegrate(CASE_NO,defaultgitConnection=GitConnect()): if not defaultgitConnection: interactive = True else: interactive = False gitConnection = defaultgitConnection gitConnection.checkForUnsavedChanges() #see referencing note on line 369 fbConnection = FogBugzConnect() #still open here # make sure integration is even worth it... fbConnection.ensureReadyForTest(CASE_NO) gitConnection.checkoutExistingBranch(CASE_NO) integrate_to = fbConnection.getIntegrationBranch(CASE_NO) gitConnection.checkoutExistingBranchRaw(integrate_to) gitConnection.resetHard_INCREDIBLY_DESTRUCTIVE_COMMAND() #this is safe because we check for unsafe changes on line 357. gitHubConnection = GitHubConnect(gitConnect=gitConnection) gitHubConnection.closePullRequestbyName("work-%d" % CASE_NO) #check for test case try: (parent, test) = fbConnection.getCaseTuple(CASE_NO,oldTestCasesOK=True) except: if interactive: juche.warn("no test case! Press enter to continue") raw_input() if not interactive: if not gitConnection.mergeIn("work-%d" % CASE_NO,pretend=True): return False gitConnection.mergeIn("work-%d" % CASE_NO) fbConnection.commentOn(CASE_NO,"Merged into %s" % integrate_to) fbConnection.closeCase(CASE_NO) if not interactive: gitConnection.pushChangesToOriginBranch(branch=integrate_to) return True
def projectShip(): if lint_loaded: try: result = lint.Lint.analyze() except Exception as e: juche.exception(e) print "Lint sunk the ship, but we still have a liferaft!" else: if not result: while True: cont = raw_input("Your code failed lint analyses. Continue anyway? (Y/n)") if cont == "n": exit() if cont == "Y": break #create new gitConnect object to talk to git gitConnection = GitConnect() gitConnection.checkForUnsavedChanges(); #create new FogBugzConnect object to talk to FBAPI fbConnection = FogBugzConnect() #check if we're in a git repo branch = gitConnection.getBranch(); # check if branch is the right branch caseno = gitConnection.extractCaseFromBranch() gitConnection.pushChangesToOriginBranch(branch) gitConnection.checkoutMaster() #create the pull request gitHubConnect = GitHubConnect() if not gitHubConnect.pullRequestAlreadyExists("work-%d" % caseno): body = "Ticket at %s/default.asp?%d\n%s" % (fbConnection.getFBURL(),caseno,raw_input("Type a note: ")) list = gitConnection.getUserRepo() integrationBranch = fbConnection.getIntegrationBranch(caseno) if integrationBranch=="Undecided": raise Exception("Come on now, you've implemented the ticket before you decided what mielstone it was? You have to decide!") pullURL = gitHubConnect.createPullRequest("work-%d" % caseno,body,integrationBranch,"work-%d" % caseno) fbConnection.commentOn(caseno,"Pull request at %s\n%s" %(pullURL,body)) #is there a test case? try: (parent,child) = fbConnection.getCaseTuple(caseno) fbConnection.resolveCase(caseno,isTestCase_CASENO=child) except: fbConnection.resolveCase(caseno) pass print """There's about an 80% chance that whatever you just did was work that rightfully belongs to some other (possibly closed) case. Recharging is a way to signify to EBS that your work should be counted against a different case. Ex 1: You're fixing a somewhat-forseeable bug in a feature that was implemented and estimated in another case, but for some reason a new bug has been filed instead of the old feature reactivated. Recharge to the original feature, as whoever estimated that should have accounted for a relatively bug-free implementation. Ex 2: You're implementing a feature that was originally estimated in some other case. Maybe it was a parent case that was broken down into child cases, or maybe somebody carved out a feature of a larger something for you to implement. When there are multiple candidates for a recharge, use your judgment. Pick the newer case where reasonable. DO NOT RECHARGE 1) Things that are legitimately and substantially new features 2) Test cases, inquiries, or fake tickets 3) Build feedback / ship tickets """ print "recharge to: (case#)", TO_CASE = raw_input() if TO_CASE: to = int(TO_CASE) recharge(caseno,to)