Skip to content

Commit

Permalink
Add command line 'patches' option to get all ticket info plus patches
Browse files Browse the repository at this point in the history
  • Loading branch information
jafingerhut committed Jan 8, 2015
1 parent ccfcbe8 commit 30fcdd7
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion src/clj_prescreen/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,15 @@ Check it to see if it was created incorrectly."})
(contains? #{"Closed" "Resolved"} (:status att)))


(defn dl-patches-only!
"Download all attachments for selected tickets."
[cur-eval-dir patch-type-list ticket-dir]
(doseq [patch-type patch-type-list]
(let [as1 (->> (xml->attach-info (str cur-eval-dir patch-type ".xml"))
(remove status-closed?))]
(download-attachments! as1 ticket-dir))))


(defn dl-patches-check-ca!
"Download all attachments for selected tickets. Do this once on one
machine, not once for each OS/JDK combo I want to test."
Expand Down Expand Up @@ -2013,8 +2022,9 @@ Project %s tickets
(defn show-usage [prog-name]
(iprintf *err* "usage:
%s [ help | -h | --help ]
%s patches
%s top-tickets <jira-account-name> <jira-password>
" prog-name prog-name))
" prog-name prog-name prog-name))


(def prog-name "lein run")
Expand All @@ -2028,6 +2038,34 @@ Project %s tickets
(let [[action & args] args]
(case action

"patches"
(if (= 0 (count args))
(let [eval-root (str fs/*cwd* "/eval-results/")
yyyy-mm-dd (str (LocalDate/now))
cur-eval-dir (str eval-root yyyy-mm-dd "/")
ticket-dir (str cur-eval-dir "ticket-info")]
(when-not (fs/exists? eval-root)
(die "Directory %s must exist, but does not. Aborting." eval-root))
(when (fs/exists? cur-eval-dir)
(die "Eval directory %s
where all results will go already exists.
Aborting to avoid overwriting any files there. Delete it and rerun if you wish.
"
cur-eval-dir))
(when-not (fs/mkdirs cur-eval-dir)
(die "mkdirs %s failed. Aborting.\n" cur-eval-dir))

(iprintf "Getting info about all tickets for CLJ project...\n")
(dl-all-tickets! (str cur-eval-dir "CLJ-all.xml") :CLJ)
(iprintf "Getting info about all tickets for projects other than CLJ...\n")
(dl-all-tickets! (str cur-eval-dir "non-CLJ-all.xml") :non-CLJ)
(iprintf "Downloading all attachments for open CLJ tickets...\n")
(dl-patches-only! cur-eval-dir ["CLJ-all"] ticket-dir))
(do (iprintf *err* "Wrong number of args %d for '%s' action\n"
(count args) action)
(show-usage prog-name)
(System/exit 1)))

"top-tickets"
(if (= 2 (count args))
(let [[jira-account jira-pw] args
Expand All @@ -2046,7 +2084,9 @@ Aborting to avoid overwriting any files there. Delete it and rerun if you wish.
(when-not (fs/mkdirs cur-eval-dir)
(die "mkdirs %s failed. Aborting.\n" cur-eval-dir))

(iprintf "Getting info about all tickets for CLJ project...\n")
(dl-all-tickets! (str cur-eval-dir "CLJ-all.xml") :CLJ)
(iprintf "Getting info about all tickets for projects other than CLJ...\n")
(dl-all-tickets! (str cur-eval-dir "non-CLJ-all.xml") :non-CLJ)
(let [fname (str cur-eval-dir "votes-on-tickets.clj")
all-users (read-safely "data/all-clojure-jira-users.clj")
Expand Down

0 comments on commit 30fcdd7

Please sign in to comment.