chiark / gitweb /
code motion and separators
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 9 Oct 2013 00:42:16 +0000 (01:42 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 9 Oct 2013 00:42:16 +0000 (01:42 +0100)
debian/changelog
dgit

index 482011040a9ff0a0e0ff7f7e95536dcfbba4f882..16119b95eeb11cf849df6e76bec7a589c4f2adba 100644 (file)
@@ -1,6 +1,7 @@
 dgit (0.16~experimental2) experimental; urgency=low
 
   * WIP remote functionality.  Untested, do not use.
+  * Some code motion and cleanups.
   * push actually takes an optional suite, like it says in the synopsis.
   * Command execution reports from --dry-run go to stderr.
 
diff --git a/dgit b/dgit
index 66f08c1d87eb6ed1b71c7c1941742cf146ad29da..848238134d5de95ba0b8ab3c5f4981300923bf67 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -125,7 +125,7 @@ sub fetchspec () {
     return  "+".rrref().":".lrref();
 }
 
-our $ua;
+#---------- remote protocol support, common ----------
 
 # remote push initiator/responder protocol:
 #  < dgit-remote-push-ready [optional extra info ignored by old initiators]
@@ -160,24 +160,6 @@ our $ua;
 #
 #  > complete
 
-sub responder_send_command ($) {
-    my ($command) = @_;
-    return unless $we_are_responder;
-    # called even without $we_are_responder
-    print DEBUG "<< $command\n";
-    print $command, "\n" or die $!;
-}    
-
-sub progress {
-    if ($we_are_responder) {
-       my $m = join '', @_;
-       responder_send_command "progress ".length($m) or die $!;
-       print $m or die $!;
-    } else {
-       print @_, "\n";
-    }
-}
-
 sub badproto ($$) {
     my ($fh, $m) = @_;
     fail "connection lost: $!" if $fh->error;
@@ -222,6 +204,16 @@ sub protocol_receive_file ($$) {
     }
 }
 
+#---------- remote protocol support, responder ----------
+
+sub responder_send_command ($) {
+    my ($command) = @_;
+    return unless $we_are_responder;
+    # called even without $we_are_responder
+    print DEBUG "<< $command\n";
+    print $command, "\n" or die $!;
+}    
+
 sub responder_send_file ($$) {
     my ($keyword, $ourfn) = @_;
     return unless $we_are_responder;
@@ -239,6 +231,24 @@ sub responder_receive_files ($@) {
     protocol_expect \*STDIN, { m/^files-end$/ };
 }
 
+#---------- remote protocol support, initiator ----------
+
+
+
+#---------- end remote code ----------
+
+sub progress {
+    if ($we_are_responder) {
+       my $m = join '', @_;
+       responder_send_command "progress ".length($m) or die $!;
+       print $m or die $!;
+    } else {
+       print @_, "\n";
+    }
+}
+
+our $ua;
+
 sub url_get {
     if (!$ua) {
        $ua = LWP::UserAgent->new();
@@ -1325,6 +1335,8 @@ sub cmd_push {
     dopush();
 }
 
+#---------- remote commands' implementation ----------
+
 sub cmd_remote_push_responder {
     my ($nrargs) = shift @ARGV;
     my (@rargs) = @ARGV[0..$nrargs-1];
@@ -1365,6 +1377,8 @@ sub cmd_rpush {
     }
 }
 
+#---------- building etc. ----------
+
 our $version;
 our $sourcechanges;
 our $dscfn;
@@ -1533,6 +1547,8 @@ sub cmd_quilt_fixup {
     build_maybe_quilt_fixup();
 }
 
+#---------- argument parsing and main program ----------
+
 sub cmd_version {
     print "dgit version $our_version\n" or die $!;
     exit 0;