--- a/lib/update.hg Thu Dec 19 22:00:37 2013 +0200
+++ b/lib/update.hg Thu Dec 19 23:22:12 2013 +0200
@@ -10,7 +10,22 @@
## Does the repo have local modifications?
function hg_modified {
- hg $1 id | grep -q '+'
+ hg $1 id -i | grep -q '+'
+}
+
+## Get the date for the current commit as an unix timestamp
+function hg_time {
+ local repo=$1
+ local hg_unix=
+ local hg_tz=
+
+ local hg_date=$(hg $repo log -r . --template '{date|hgdate}')
+ local hg_unix=${hg_date% *}
+ local hg_tz=${hg_date#* }
+
+ [ -n "$hg_unix" ] || fail "failed to read hg time"
+
+ echo "$hg_unix"
}
## Output possible -u flag for commit.