Skip to content

Instantly share code, notes, and snippets.

@ninjudd
ninjudd / gist:3280370
Created August 7, 2012 01:18
jiraph lein test
amnesia:jiraph develop$ lein test
lein test jiraph.cache-test
lein test jiraph.core-test
FAIL in (multi-layer-transactions) (core_test.clj:273)
expected: (= {:edges {"y" {:times [1]}}} (get-node :sorted "x"))
actual: (not (= {:edges {"y" {:times [1]}}} {:edges {"y" {:times (1 1)}}}))
(defn error [& args]
(binding [*out* *err*]
(apply println "Error:" args)))
(defn- load-hook [hook-ns]
(when-let [hook (try (utils/resolve-symbol (symbol (name hook-ns) "activate"))
(catch Throwable e
(error "problem activating" hook-ns "hook")
(throw e)))]
(try (hook)
(defmacro with-error-header
"Execute the code in body, printing the given error message if something goes wrong."
[message & body]
`(try ~@body
(catch Throwable e
(binding [*out* *err*]
(println message))
(throw e))))

strikethrough

diff --git a/bin/lein b/bin/lein
index ac3cd58..dd06a53 100755
--- a/bin/lein
+++ b/bin/lein
@@ -213,6 +213,8 @@ else
if [ "$OSTYPE" = "cygwin" ]; then
TRAMPOLINE_FILE=`cygpath -w $TRAMPOLINE_FILE`
fi
+ args="$@"
+ args=${args/#:/with-profile }
--- a/src/clj_gedcom/core.clj
+++ b/src/clj_gedcom/core.clj
@@ -67,9 +67,9 @@
"Parses GEDCOM records from a file or reader, returning map of labels to records."
[in]
(reduce (fn [records record]
- (let [label (:label record)]
- (when (contains? records label)
- (throw (Exception. (format "duplicate record in GEDCOM for label %s" label))))
- (assoc records label record)))
src/gedcom_importer/core.clj | 6 +++---
src/gedcom_importer/indi.clj | 13 ++++++++-----
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/gedcom_importer/core.clj b/src/gedcom_importer/core.clj
index 8eaa08f..9ccea9f 100644
--- a/src/gedcom_importer/core.clj
+++ b/src/gedcom_importer/core.clj
@@ -19,8 +19,8 @@
:when (not (contains? (:profiles processing) profile-id))]
WrappedTransactional
(txn-wrap [this f]
(let [f (txn-wrap layer f)]
(fn [^MergeableLayer layer]
(f (.layer layer)))))
(letfn [(exists? [over-layer id exists] (and exists (not (node-deleted? over-layer id))))
(deleted? [over-layer id deleted] (or deleted (node-deleted? over-layer id)))]
(defn mark-edges-deleted [over-layer incoming? keyseq node]
(if-let [ks (edges-keyseq keyseq)]
(update-in* node ks fixing map? map-vals-with-keys
(if incoming?
(partial exists? over-layer)
(fn [id edge]
(update edge :deleted (partial deleted? over-layer id)))))