From: Joey Hess Date: Sun, 21 Oct 2007 18:08:36 +0000 (-0400) Subject: * hours_since was broken by design, and fixing it involved changing X-Git-Url: https://git.madduck.net/code/myrepos.git/commitdiff_plain/c813041b45599cddd8127f2fa73f11facdcc38e6?ds=sidebyside * hours_since was broken by design, and fixing it involved changing its calling convention. If you used the old version, you'll get errors from the new old. --- diff --git a/debian/changelog b/debian/changelog index 6440ffe..6cef26d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,11 @@ mr (0.6) UNRELEASED; urgency=low * Add to the example mrconfig a "tags" command that lists tags. (Currently only for svn and git.) + * hours_since was broken by design, and fixing it involved changing + its calling convention. If you used the old version, you'll get errors + from the new old. - -- Joey Hess Sun, 21 Oct 2007 01:49:03 -0400 + -- Joey Hess Sun, 21 Oct 2007 13:58:30 -0400 mr (0.5) unstable; urgency=low diff --git a/mr b/mr index 433354b..89f3281 100755 --- a/mr +++ b/mr @@ -229,7 +229,7 @@ mr is run by joey. The second uses the hours_since function been at least 12 hours since the last update. skip = test $(whoami) != joey - skip = [ "$1" = update ] && [ $(hours_since "$1") -lt 12 ] + skip = [ "$1" = update ] && ! hours_since "$1" 12 =item chain @@ -899,6 +899,9 @@ lib = exit 1 } hours_since() { + if [ -z "$1" ] || [ -z "$2" ]; then + error "mr: usage: hours_since action num" + fi for dir in .git .svn .bzr CVS .hg; do if [ -e "$MR_REPO/$dir" ]; then flagfile="$MR_REPO/$dir/.mr_last$1" @@ -908,8 +911,13 @@ lib = if [ -z "$flagfile" ]; then error "cannot determine flag filename" fi - perl -wle 'print -f shift() ? int((-M _) * 24) : 9999' "$flagfile" - touch "$flagfile" + delta=$(perl -wle 'print -f shift() ? int((-M _) * 24) : 9999' "$flagfile") + if [ "$delta" -lt "$2" ]; then + exit 0 + else + touch "$flagfile" + exit 1 + fi } update = diff --git a/mrconfig.complex b/mrconfig.complex index c59c8fe..f8ec25c 100644 --- a/mrconfig.complex +++ b/mrconfig.complex @@ -69,7 +69,7 @@ skip = ! wantsrc [src/linux-2.6] checkout = git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git skip = ! mylaptop || ! wantsrc || - ([ "$1" = update ] && [ $(hours_since "$1") -lt 12 ]) + ([ "$1" = update ] && ! hours_since "$1" 12) [src/dpkg] # A merge of the upstream dpkg git repo and my own personal branch.