diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2013-10-09 01:42:16 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2013-10-09 01:42:16 +0100 |
commit | 219d507eed2b5958a6938423d244177b3fef8ae1 (patch) | |
tree | 37173d020d3f4071290f2e9c2523813905eb0f5f | |
parent | 01da2f9b6a9eec44d0072b281bf011e74ab22605 (diff) |
code motion and separators
-rw-r--r-- | debian/changelog | 1 | ||||
-rwxr-xr-x | dgit | 54 |
2 files changed, 36 insertions, 19 deletions
diff --git a/debian/changelog b/debian/changelog index 4820110..16119b9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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. @@ -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; |