           match (matches? (rest lines) term)]
       (concat (when match (list fname)) (matchfiles (rest blocks) term)))))
 
-; A wrapper for matchfiles: provides a sequence of blocks from the text diff,
-; each block delineated by an "Index:" tag (either in the first position of
-; the string, or at the start of a line). Returns the sequence of filenames
-; produced recursively by matchfiles.
+;; A wrapper for matchfiles: provides a sequence of blocks from the text diff,
+;; each block delineated by an "Index:" tag (either in the first position of
+;; the string, or at the start of a line). Returns the sequence of filenames
+;; produced recursively by matchfiles.
 
 (defn filediffs [r1 r2 term item]
   (matchfiles (rest (split (:out (txtdiff r1 r2 item)) #"^Index: |\nIndex: ")) term))
 
-; Run "svn diff" on the file/pathname in index. The format of the file/path name
-; following "Index:" in diff's output depends on the argument: If the argument
-; is a filesystem pathname, the index name is absolute, and we can simply use
-; that. If the argument is a uri, the index name is relative to the base item
-; name. If the base item name was the uri to a file (and therefore a complete
-; pathname) we can use item; if it was the uri to a directory, we have to
-; concatenate the item and index to form a complete pathname.
+;; Run "svn diff" on the file/pathname in index. The format of the file/path name
+;; following "Index:" in diff's output depends on the argument: If the argument
+;; is a filesystem pathname, the index name is absolute, and we can simply use
+;; that. If the argument is a uri, the index name is relative to the base item
+;; name. If the base item name was the uri to a file (and therefore a complete
+;; pathname) we can use item; if it was the uri to a directory, we have to
+;; concatenate the item and index to form a complete pathname.
 
 (defn diff [r1 r2 index item]
   (let [r (re-pattern (str "^.*/" index "$"))

  (println "- Your valid svn authentication credentials are not cached.")
  (println))

; A newest-first sequence of revision numbers in which the item changed

(defn revlist [item]
  (for [e (try

        :when (seq (:attrs e))]
    (:revision (:attrs e))))

;; A sequence of revision pairs for potential comparison -- e.g. for the revlist
;; (9 8 6 4 1), return (8 9 6 8 4 6 1 4).

(defn revpairs [revlist item]
  (when (seq (rest revlist))
    (concat (list (first (rest revlist)) (first revlist))
            (revpairs (rest revlist) item))))

;; Is path a uri? If it contains :// assume it is.

(defn uri? [path] (re-matches #".*://.*" path))

;; If item is a uri, the "-rn:m" revision-range format will not work if item is
;; no longer present in the head revision, in which case we have to use the
;; "item@n item@m" revision-specification format. Return the correctly formatted
;; versioned-path(s) string for use by a diff command.

(defn vpaths [r1 r2 path item]
  (if (uri? item)
    (list (str path "@" r1) (str path "@" r2))
    (list (str "-r" r1 ":" r2) path)))
  
;; A string containing the output of "diff" on the two svn revision of item.

(defn txtdiff [r1 r2 item]
  (let [v (vpaths r1 r2 item item)]
    (sh "svn" "diff" "--diff-cmd" "diff" shhh (first v) (second v))))

;; A sequence (possibly nil) of the changed lines (denoted by a leading + or -)
;; from the given text diff, filtered by the filter term, if provided.

(defn matches? [txtdiff term]
  (let [restr (if term (str "[+-][^+-].*" term ".*") ".*")]
    (seq (filter #(re-matches (re-pattern restr) %) txtdiff))))

;; A sequence of files from the revision-pair diff with changed lines matching
;; the filter term. The first line of each block contains the file/path name from
;; the text diff header, with "Index:" stripped off. The rest of the lines
;; contain the +/- changed lines. Process all blocks recursively to produce the
;; list of matching files.

(defn matchfiles [blocks term]
  (when (seq blocks)
