chiark / gitweb /
cmd_push: Factor out all prep code
authorSean Whitton <spwhitton@spwhitton.name>
Fri, 3 Feb 2017 04:15:15 +0000 (21:15 -0700)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 26 Jul 2017 21:52:28 +0000 (22:52 +0100)
Will be re-used by cmd_push_source.

Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index c344d31ea2dba92e699fb9006ae39f0781c6f842..c17b42a967645446189383765216bce9a61ddb46 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -4492,9 +4492,9 @@ END
     pull();
 }
 
-sub cmd_push {
+sub prep_push () {
     parseopts();
-    badusage "-p is not allowed with dgit push" if defined $package;
+    badusage "-p is not allowed with dgit $subcommand" if defined $package;
     check_not_dirty();
     my $clogp = parsechangelog();
     $package = getfield $clogp, 'Source';
@@ -4503,7 +4503,7 @@ sub cmd_push {
     } elsif (@ARGV==1) {
        ($specsuite) = (@ARGV);
     } else {
-       badusage "incorrect arguments to dgit push";
+       badusage "incorrect arguments to dgit $subcommand";
     }
     $isuite = getfield $clogp, 'Distribution';
     pushing();
@@ -4516,9 +4516,13 @@ sub cmd_push {
     if (defined $specsuite &&
        $specsuite ne $isuite &&
        $specsuite ne $csuite) {
-           fail "dgit push: changelog specifies $isuite ($csuite)".
+           fail "dgit $subcommand: changelog specifies $isuite ($csuite)".
                " but command line specifies $specsuite";
     }
+}
+
+sub cmd_push {
+    prep_push();
     dopush();
 }