From fbb9dafbd188e8f41ddb73845fab68f0f9e6a36e Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Tue, 20 Jul 2010 12:39:06 +0530 Subject: [PATCH] gqt -- gitolite quick (re-)test sometimes I want to quickly test a few lines of change within the context of a currently-running/just-ran test, *without* doing the rollback etc. Here's how you do that now: - in your source tree, make the change and then run: cp -a src hooks contrib/adc /some/tmp/place - go to the tester userid and re-run your tests like so: GQT=/some/tmp/place ./test-driver.sh it'll rollback as normal then overwrite src and hooks from $GQT Also, there's now a "dbg" sub that can be used for quick printf-style debugging. --- src/gitolite.pm | 6 ++++++ t/rollback | 2 +- t/rollback.server | 9 +++++++++ t/test-driver.sh | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/gitolite.pm b/src/gitolite.pm index 8eee76c..0ce43bf 100644 --- a/src/gitolite.pm +++ b/src/gitolite.pm @@ -57,6 +57,12 @@ sub wrap_open { return $fh; } +sub dbg { + for my $i (@_) { + print STDERR "DBG: $i\n"; + } +} + sub log_it { my ($ip, $logmsg); open my $log_fh, ">>", $ENV{GL_LOG} or die "open log failed: $!\n"; diff --git a/t/rollback b/t/rollback index 84f3872..43894e3 100755 --- a/t/rollback +++ b/t/rollback @@ -8,4 +8,4 @@ tar xf rollback.tar mkdir td scp -q $TESTDIR/rollback.server gitolite-test@localhost:rollback || { echo scp failed; exit 1; } -ssh gitolite-test@localhost ./rollback +ssh gitolite-test@localhost ./rollback $GQT diff --git a/t/rollback.server b/t/rollback.server index b9c7e45..f8b84ec 100755 --- a/t/rollback.server +++ b/t/rollback.server @@ -3,3 +3,12 @@ cd rm -rf .ssh .gitolite .gitolite.rc repositories gitolite-install tar xf rollback.tar + +# if arg1 is a directory, we have to overwrite sources from there (see commit +# message for details) +if [ -d "$1" ] +then + cd .gitolite + /bin/cp -a $1/{src,hooks} . + cd +fi diff --git a/t/test-driver.sh b/t/test-driver.sh index 8473d5b..3461f9c 100755 --- a/t/test-driver.sh +++ b/t/test-driver.sh @@ -54,6 +54,7 @@ ugc () git push ${1:-gitolite}:gitolite-admin master git fetch origin >/dev/null 2>&1 ) >~/1 2>~/2 + grep DBG: ~/2 >/dev/null && grep . ~/1 ~/2 } mdc()