chiark / gitweb /
-p option
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 0fb928906f06833c553a8d7fc2c9b47d64f484cc..a158eefde209e76865088d90de19ba03cf57b622 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -346,7 +346,8 @@ sub is_fast_fwd ($$) {
 }
 
 sub git_fetch_us () {
-    runcmd_ordryrun @git, qw(fetch),$remotename,fetchspec();
+    die "cannot dry run with fetch" if $dryrun;
+    runcmd @git, qw(fetch),$remotename,fetchspec();
 }
 
 sub fetch_from_archive () {
@@ -431,6 +432,7 @@ sub pull () {
 sub dopush () {
     runcmd @git, qw(diff --quiet HEAD);
     my $clogp = parsechangelog();
+    die if defined $package;
     $package = $clogp->{Source};
     my $dscfn = "${package}_$clogp->{Version}.dsc";
     stat "../$dscfn" or die "$dscfn $!";
@@ -487,6 +489,7 @@ sub dopush () {
 
 sub cmd_clone {
     my $dstdir;
+    die if defined $package;
     if (@ARGV==1) {
        ($package) = @ARGV;
     } elsif (@ARGV==2 && $ARGV[1] =~ m#^\w#) {
@@ -513,11 +516,16 @@ sub branchsuite () {
 }
 
 sub fetchpullargs () {
-    my $clogp = parsechangelog();
-    $package = $clogp->{Source};
+    if (!defined $package) {
+       my $sourcep = parsecontrol('debian/control');
+       $package = $sourcep->{Source};
+    }
     if (@ARGV==0) {
        $suite = branchsuite();
-       $suite ||= $clogp->{Distribution};
+       if (!$suite) {
+           my $clogp = parsechangelog();
+           $suite = $clogp->{Distribution};
+       }
        canonicalise_suite();
        print "fetching from suite $suite\n";
     } elsif (@ARGV==1) {
@@ -539,6 +547,7 @@ sub cmd_pull {
 }
 
 sub cmd_push {
+    die if defined $package;
     my $clogp = parsechangelog();
     $package = $clogp->{Source};
     if (@ARGV==0) {
@@ -551,6 +560,7 @@ sub cmd_push {
 }
 
 sub cmd_build {
+    die if defined $package;
     my $clogp = parsechangelog();
     $suite = $clogp->{Distribution};
     $package = $clogp->{Source};