def fetch_all(self,deploy=True): juche.dictate(task="fetch-all") projects = get_config()["Projects"] #print projects for project in projects: juche.dictate(fetch=project["url"]) git = self.clone_or_get(project["url"],WORK_DIR+project["name"]) git.fetch() #Iterate over milestones for the current project for sFixFor in self.f.listFixFors(sProject=project["name"],onlyProjectMilestones=True): sFixFor = sFixFor.sfixfor.contents[0].encode('utf-8') if sFixFor.endswith("-test"): continue try: git.resetHard_INCREDIBLY_DESTRUCTIVE_COMMAND() # I'm still against this, but it might make things work for this week git.checkoutExistingBranchRaw(sFixFor) except: juche.warning("Can't check out branch %s in project %s, perhaps it doesn't exist?" % (sFixFor,project["name"])) continue if git.needsPull(): juche.info("Pulling %s in project %s" % (sFixFor,project["name"])) git.pull() self.integrate_changed(git,git.getBranch(),project["name"]) if deploy: try: self.deploy(git,sFixFor,project) except Exception as e: juche.error("Can't deploy") juche.exception(e)
def __mergeInPretend(self,BRANCH_NAME): #http://stackoverflow.com/questions/501407/is-there-a-git-merge-dry-run-option/6283843#6283843 self.checkForUnsavedChanges() (status,output) = self.statusOutput("git merge --no-commit --no-ff %s" % BRANCH_NAME) if status: juche.dictate(output=output) juche.warning("gitConnect __mergeInPretend: merge %s will not apply cleanly. " % BRANCH_NAME) self.resetHard_INCREDIBLY_DESTRUCTIVE_COMMAND() #if you see an exception on the line below, we failed to roll back the merge self.checkForUnsavedChanges() return status==0
def closePullRequestbyName(self,name): #this is kind of a hack url = self.pullRequestAlreadyExists(name) if not url: juche.warning("There does not appear to be any such pull request %s" % name) return import re id = re.search("\d+$",url).group() data = json.dumps({"state":"closed"}) req = self.Request("https://api.github.com/repos/%s/%s/pulls/%s" % (self.ghRepoUser,self.ghRepo,id),data) req.get_method = lambda: 'PATCH' #functional ftw response = urllib2.urlopen(req)
def _fixFors_to_EBS_dates(abbreviatedTest=False): juche.dictate(fixing_dates_per_ebs=1) fbConnection = FogBugzConnect() fixfors = fbConnection.dependencyOrder(fbConnection.listFixFors()) if abbreviatedTest: fixfors = fixfors[:5] for item in fixfors: name = fbConnection.nameForFixFor(fbConnection.fixForDetail(item)) if name.startswith("Never"): continue juche.info("processing %s %s" % (name,item)) date = fbConnection.getShipDate(item) from dateutil.parser import parse if not abbreviatedTest: fbConnection.editFixForShipDate(item,parse(date)) #It's bad to leave EBS in a partially-edited state. Therefore we simply log the output and don't actually write any changes when in abbreviated test mode. else: juche.warning("Not editing the ship date in %s to %s because this is an abbreviated test." % (item,date))
def test_annoyables(self): if not self.f.amIAdministrator(): juche.warning("NOT RUNNING test_annoyables BECAUSE YOU ARE NOT AN ADMINISTRATOR") return juche.info(self.f.annoyableIxPeople())
import os from JucheLog.juchelog import juche try: import simplejson as json except: import json try: import keyring except: juche.warning("Could not import keyring API") #raise Exception("stacktraceplease") try: from fogbugz import FogBugz from fogbugz import FogBugzAPIError except Exception as e: juche.error("Could not import FogBugz API because: ", e) juche.exception(e) #raise Exception("stacktraceplease") from xml.dom.minidom import parseString TEST_IXCATEGORY=6 TEST_TAG="GLaDOS_default_tag" class FogBugzConnect: