Exemple #1
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)
Exemple #2
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)
Exemple #3
0
class MockRepo:
    git = None
    dir = None
    fb = None

    def __init__(self, dir=None):
        if not dir:
            dir = "%s/mockrepo/" % tempfile.gettempdir()
            if not os.path.exists(dir):
                os.makedirs(dir)
        self.dir = dir
        self.git = GitConnect(self.dir)
        self.fb = FogBugzConnect()

    def createFile(self, name, contents):
        self.editFile(name, contents)

    def editFile(self, name, contents):
        with open(self.dir+name, "w") as file:
            file.write(contents)

    def readFile(self, name):
        with open(self.dir+name, "r") as file:
            return file.read()

    def gitInit(self):
        self.git.statusOutput("git init", self.dir)

    def gitAdd(self, file):
        self.git.add(file)

    def gitCommit(self, message):
        self.git.commitAll(message)

    def gitPush(self, forceful=False):
        if forceful:
            self.git.statusOutput("git push -u -f")
        else:
            self.git.statusOutput("git push -u")

    def gitPull(self):
        self.git.fetch()
        self.git.pull()
        self.git.submoduleUpdate() #Drew would like to document that this is redundant. Bion would like to document that this redundancy is not clear.

    def gitMerge(self, branch):
        self.git.mergeIn(branch)

    def gitCheckout(self, branch):
        self.git.checkoutExistingBranchRaw(branch)

    #is this name really necessary?
    def wipeRepo__INCREDIBLY__DESTRUCTIVE_COMMAND(self):
        self.git.statusOutputExcept("git push -f --all --delete")
        self.git.statusOutput("rm -Rf .git")
        self.git.statusOutputExcept("git init")
        self.git = GetConnect(self.dir)
        self.git.statusOutputExcept("git remote add origin [email protected]:drewcrawford/SampleProject.git")
        self.createFile("README.txt", "test")
        self.gitAdd("README.txt")
        self.gitCommit("First Commit")
        self.gitPush()

    def ticketReactivate(self, ticket):
        if "Closed" in self.fb.getStatuses(ticket):
            self.fb.reactivate(ticket, 7, "Just testing...")

    def ticketResolve(self, ticket):
        self.fb.resolveCase(ticket)

    def ticketClose(self, ticket):
        self.fb.closeCase(ticket)

    def ticketAssign(self, ticket, ixUser):
        self.fb.assignCase(ticket, ixUser)

    def ticketCreate(self, title):
        return self.fb.createCase(title, 1, 1, 7)

    def ticketSetEstimate(self, ticket, estimate):
        self.fb.setEstimate(ticket, estimate)