summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2013-08-17 16:51:31 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2013-08-17 16:51:31 +0100
commit00a244b9078b88e899fc00c6d799bdd601c40c70 (patch)
treeea9334a222ef4656126c31c5b87efce31119e2d6
parent106d8b9024555a2be827da0ae7f862e8c6891259 (diff)
better printing for dry run
-rwxr-xr-xdgit15
1 files changed, 12 insertions, 3 deletions
diff --git a/dgit b/dgit
index 0953129..be77694 100755
--- a/dgit
+++ b/dgit
@@ -104,6 +104,14 @@ sub runcmd {
die "@_ $! $?" if system @_;
}
+sub printdone {
+ if (!$dryrun) {
+ print "dgit ok: @_\n";
+ } else {
+ print "would be ok: @_ (but dry run only)\n";
+ }
+}
+
sub cmdoutput_errok {
die Dumper(\@_)." ?" if grep { !defined } @_;
printcmd(\*DEBUG,"|",@_) if $debug>0;
@@ -524,7 +532,7 @@ sub clone ($) {
}
fetch_from_archive() or die;
runcmd @git, qw(reset --hard), lrref();
- print "dgit ok: ready for work in $dstdir\n";
+ printdone "ready for work in $dstdir";
}
sub fetch () {
@@ -532,7 +540,7 @@ sub fetch () {
git_fetch_us();
}
fetch_from_archive() or die;
- print "dgit ok: fetched into ".lrref()."\n";
+ printdone "fetched into ".lrref();
}
sub pull () {
@@ -595,7 +603,7 @@ sub dopush () {
my $host = access_cfg('upload-host');
my @hostarg = defined($host) ? ($host,) : ();
runcmd_ordryrun @dput, @hostarg, $changesfile;
- print "dgit ok: pushed and uploaded $dsc->{Version}\n";
+ printdone "pushed and uploaded $dsc->{Version}";
}
sub cmd_clone {
@@ -740,6 +748,7 @@ sub parseopts () {
}
parseopts();
+print STDERR "DRY RUN ONLY\n" if $dryrun;
die unless @ARGV;
my $cmd = shift @ARGV;