From: Ian Jackson Date: Tue, 13 Aug 2013 19:49:54 +0000 (+0100) Subject: improve X-Git-Tag: debian/0.1~10 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=9caea34ec7bc7cba966b8a5662e0297a4c2d1736 improve --- diff --git a/dgit b/dgit index 4d9a71a8..4491c967 100755 --- a/dgit +++ b/dgit @@ -13,7 +13,7 @@ open DEBUG, ">&STDERR" or die $!; our $pdo = 'http://packages.debian.org/'; #our $mirror = 'http://mirror.relativity.greenend.org.uk/mirror/debian-ftp/'; our $suite = 'sid'; -our $package = '2vcard'; +our $package; our $aliothname = 'iwj@git.debian.org'; our $aliothpath = '/git/dgit-test'; @@ -221,26 +221,6 @@ sub fetch_from_archive () { } } -#sub combine () { -# if ( - -# runcmd qw(git write-tree - - - runcmd qw(mkdir -p ''); -# chdir '.git/dgit/unpack' or die $!; - - -# with_tmpdir($td,{ - -# }); - -# } - -# open P, "-|", qw(git rev-parse --), $dsc_hash; - -#} - sub clone () { get_archive_dsc(); $dsc_hash = $dsc->{'Vcs-git-master'}; @@ -280,6 +260,25 @@ sub clone () { sub fetch () { } - -#print Dumper(get_archive_dsc()); -clone(); + +sub cmd_clone { + if (@ARGV==1) { + ($package) = @ARGV; + } elsif (@ARGV==2) { + ($package,$suite) = @ARGV; + } else { + die; + } + clone(); +} + +sub parseopts () { + die if @ARGV && $ARGV[0] =~ m/^\-/; +} + +parseopts(); +die unless @ARGV; +my $cmd = shift @ARGV; +parseopts(); + +{ no strict qw(refs); &{"cmd_$cmd"}(); }