Example #1
0
def projectStart(CASE_NO, fromSpec):
    """
    print "Case no: " + str(CASE_NO)
    print "from: " + fromSpec
    """
    #create new gitConnect object to talk to git
    gitConnection = GitConnect()

    #check for unsaved changes to source code
    gitConnection.checkForUnsavedChanges()

    #create new FogBugzConnect object to talk to FBAPI
    fbConnection = FogBugzConnect()
    #check for FogBugz case and clock in
    fbConnection.startCase(CASE_NO)



    #checkout or create branch with CASE_NO
    gitConnection.checkoutBranch(CASE_NO,fromSpec,fbConnection)

    settings = get_setting_dict()
    if not "viewOnStart" in settings or settings["viewOnStart"] == 1:
        fbConnection.view(CASE_NO)

    juche.info("Use work ship to commit your changes")
Example #2
0
 def __init__(self,gitConnect=None):
     if not gitConnect: gitConnect=GitConnect()
     repouser =  gitConnect.getUserRepo()
     self.ghRepo = repouser[1]
     self.ghRepoUser = repouser[0]
     
     self.login()
Example #3
0
def ls():
    gitConnection = GitConnect()
    (user,repo) = gitConnection.getUserRepo()
    fbConnection = FogBugzConnect()
    if repo=="DrewCrawfordApps": repo = "Hackity-Hack"
    elif repo=="Briefcase-wars": repo = "Briefcase Wars"
    fbConnection.listCases(repo)
Example #4
0
def projectFailTest():
    gitConnection = GitConnect()
    gitConnection.checkForUnsavedChanges()

    reasons = {"0":"Failed a unit test.","1":"Failed a UI test"}
    for reason in reasons.keys():
        print reason," ",reasons[reason]
    print "Or just type why it failed."
    reason = raw_input()
    if reason in reasons.keys():
        reason = reasons[reason]
        purgatory = False
    else:
        purgatory = True



    caseno = gitConnection.extractCaseFromBranch()
    gitConnection.pushChangesToOriginBranch(gitConnection.getBranch())
    gitConnection.checkoutMaster()

    fbConnection = FogBugzConnect()
    (parent,test) = fbConnection.getCaseTuple(caseno)
    if purgatory: fbConnection.commentOn(parent,PURGATORY_STMT) #this signals buildbot to fail the case back to the implementer after PURGATORY expires
    #buildbot special-cases Inspect passes to be in PURGATORY, so no signaling is required for the pass case

    fbConnection.fbConnection.assign(ixBug=parent,ixPersonAssignedTo=magic.BUILDBOT_IXPERSON,sEvent="Terribly sorry but your case FAILED a test: %s" % reason)
    fbConnection.stopWork(test)

    # play sounds!
    getstatusoutput ("afplay -v 7 %s/media/dundundun.aiff" % sys.prefix)
Example #5
0
def projectStop():
    #create new gitConnect object to talk to git
    gitConnection = GitConnect()

    #check for unsaved changes to source code
    gitConnection.checkForUnsavedChanges()

    #create new FogBugzConnect object to talk to FBAPI
    fbConnection = FogBugzConnect()

    caseno = gitConnection.extractCaseFromBranch()



    #stop working on case and checkout master
    branch = gitConnection.getBranch()
    gitConnection.pushChangesToOriginBranch(branch)
    gitConnection.checkoutMaster()

    #clock out of project
    fbConnection.stopWork(caseno)
Example #6
0
def projectPassTest():
    gitConnection = GitConnect()
    gitConnection.checkForUnsavedChanges()
    caseno = gitConnection.extractCaseFromBranch()
    gitConnection.pushChangesToOriginBranch(gitConnection.getBranch())
    gitConnection.checkoutMaster()

    fbConnection = FogBugzConnect()
    (parent,test) = fbConnection.getCaseTuple(caseno)
    statuses = fbConnection.getStatuses(test)
    for i in range(0,len(statuses.keys())):
        print i,":  ",statuses[sorted(statuses.keys())[i]]

    print "Choose your adventure: ",
    choice = input()
    ix = sorted(statuses.keys())[choice]

    fbConnection.resolveCase(test,ixstatus=ix)
    fbConnection.closeCase(test)

    fbConnection.fbConnection.assign(ixBug=parent,ixPersonAssignedTo=magic.BUILDBOT_IXPERSON)

    # play sounds!
    getstatusoutput("afplay -v 7 %s/media/longcheer.aiff" % sys.prefix)
Example #7
0
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)
Example #8
0
def network():
    gitConnection = GitConnect()
    gitConnection.githubNetwork()
Example #9
0
def projectIntegrateMake(CASE_NO,fromSpec):
    if not fromSpec:
        juche.critical("Sorry, you have to manually specify a fromspec.  Ask somebody.")
        raise Exception("stacktraceplease")
    gitConnection = GitConnect()
    gitConnection.createNewRawBranch(CASE_NO,fromSpec)
Example #10
0
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)