chiark
/
gitweb
/
~ianmdlvl
/
dgit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
106d8b9
)
better printing for dry run
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 17 Aug 2013 15:51:31 +0000
(16:51 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 17 Aug 2013 15:51:31 +0000
(16:51 +0100)
dgit
patch
|
blob
|
history
diff --git
a/dgit
b/dgit
index 0953129efad8af753b362b690a6269b1bc112d5f..be7769400a8f643071fd077a4c91ef8e18e23c5c 100755
(executable)
--- a/
dgit
+++ b/
dgit
@@
-104,6
+104,14
@@
sub runcmd {
die "@_ $! $?" if system @_;
}
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;
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();
}
fetch_from_archive() or die;
runcmd @git, qw(reset --hard), lrref();
- print
"dgit ok: ready for work in $dstdir\n
";
+ print
done "ready for work in $dstdir
";
}
sub fetch () {
}
sub fetch () {
@@
-532,7
+540,7
@@
sub fetch () {
git_fetch_us();
}
fetch_from_archive() or die;
git_fetch_us();
}
fetch_from_archive() or die;
- print
"dgit ok: fetched into ".lrref()."\n"
;
+ print
done "fetched into ".lrref()
;
}
sub pull () {
}
sub pull () {
@@
-595,7
+603,7
@@
sub dopush () {
my $host = access_cfg('upload-host');
my @hostarg = defined($host) ? ($host,) : ();
runcmd_ordryrun @dput, @hostarg, $changesfile;
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
";
+ print
done "pushed and uploaded $dsc->{Version}
";
}
sub cmd_clone {
}
sub cmd_clone {
@@
-740,6
+748,7
@@
sub parseopts () {
}
parseopts();
}
parseopts();
+print STDERR "DRY RUN ONLY\n" if $dryrun;
die unless @ARGV;
my $cmd = shift @ARGV;
die unless @ARGV;
my $cmd = shift @ARGV;