           revision (re-find #"https:\/\/hg\.mozilla.*([0-9a-f]{12})$" revision-file)]
       (second revision))))
 
-(defn find-build-revision [buildid channel]
+(defn- find-build-revision
+  "Finds the hg revision of associated with the buildid `buildid` on channel `channel`."
+  [buildid channel]
   (let [p (split-buildid buildid)
         build-dir-url (format "http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/%02d/%02d/%02d-%02d-%02d-%02d-%02d-%02d-%s/"
                     (:y p) (:m p) (:y p) (:m p) (:d p) (:hour p) (:min p) (:sec p) channel)]
     (find-build-dir-revision build-dir-url)))
 
-(defn find-preceding-build-revision [buildid channel]
+(defn- find-preceding-build-revision
+  "Find the first build made before buildid `buildid` on channel `channel`, and get its associated revision."
+  [buildid channel]
   (let [p (split-buildid buildid)
 
         ;; Obtain a list of links to build directories in the desired channel

              build-dir-url (str build-dirs-url (:href (second target-link)))]
          (find-build-dir-revision build-dir-url)))))

(defn find-build-changeset [buildid channel]
  (let [from-revision (find-preceding-build-revision buildid channel)
        to-revision (find-build-revision buildid channel)]
    (format "https://hg.mozilla.org/%s/pushloghtml?fromchange=%s&tochange=%s"
            channel from-revision to-revision)))

(defn find-date-buildid [date channel] ; date should be of the form yyyy-MM-dd
  (let [[_ year month day] (re-find #"^(\d{4})-(\d{2})-(\d{2})$" date)
        build-dirs-suffix (format "-%s/" channel)
        build-dirs-url (format "https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/%s/%s/" year month)

        target-link (first (filter #(.startsWith (get % 2) date) build-dirs-links))
        [_ hour minute second] (re-find #"^\d{4}-\d{2}-\d{2}-(\d{2})-(\d{2})-(\d{2})" (get target-link 2))]
    (str year month day hour minute second)))
