chiark / gitweb /
wip from tests
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 15 Aug 2013 15:06:10 +0000 (16:06 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 15 Aug 2013 15:06:10 +0000 (16:06 +0100)
TODO
dgit

diff --git a/TODO b/TODO
index 080502d9038b014bf2a670a77c6731e766fd36b1..cff119beda3c0126d6776bd81b634ce2180c02bf 100644 (file)
--- a/TODO
+++ b/TODO
@@ -4,6 +4,8 @@ Cope with non-Debian archives
 
 Make it possible to do dgit clone / fetch anonymously
 
+Suite name canonicalisation/mapping
+
 Archive agility.  Archive needs to specify (a) way to get versions
 and paths in archive for dscs (b) unpriv pull location (c) priv
 push location
diff --git a/dgit b/dgit
index a2e148898c2b7d22ce532ffeeab0c3f4eb4f31ef..12c06eb182112b0e3f7cc812ab09b61c70695d17 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -46,8 +46,9 @@ our (@gpg_opts);
 
 our $remotename = 'dgit';
 our $ourdscfield = 'Vcs-git-master';
+our $branchprefix = 'dgit';
 
-sub uploadbranch () { return "dgit/$suite"; }
+sub uploadbranch () { return "$branchprefix/$suite"; }
 sub lref ($) { return "refs/heads/$_[0]"; }
 sub rref ($) { return "refs/remotes/$remotename/$_[0]"; }
 sub debiantag ($) { return "debian/$_[0]"; }
@@ -126,7 +127,7 @@ sub check_for_git () {
     # returns 0 or 1
     my $cmd= 
        "ssh $alioth_sshtestbodge->[0] '".
-       " set -e; cd /git/dgit-test;".
+       " set -e; cd $aliothpath;".
        " if test -d $package.git; then echo 1; else echo 0; fi".
        "'";
     #print DEBUG "$cmd\n";
@@ -205,7 +206,7 @@ sub generate_commit_from_dsc () {
     $authline =~ m/^[^<>]+ \<\S+\> \d+ [-+]\d+$/ or die $authline;
     open C, ">../commit.tmp" or die $!;
     print C "tree $tree\n" or die $!;
-    print C "parent $upload_hash\n" or die $! if defined $upload_hash;
+    print C "parent $upload_hash\n" or die $! if $upload_hash;
     print C <<END or die $!;
 author $authline
 committer $authline
@@ -223,7 +224,7 @@ END
     cmdoutput qw(git log -n2), $commithash;
     # ... gives git a chance to complain if our commit is malformed
     my $outputhash = $commithash;
-    if (defined $upload_hash) {
+    if ($upload_hash) {
        chdir "$ud/$dir" or die $!;
        runcmd qw(git reset --hard), $upload_hash;
        runcmd qw(sh -ec), 'dpkg-parsechangelog >>../changelogold.tmp';
@@ -288,13 +289,13 @@ sub fetch_from_archive () {
     my $hash;
     if (defined $dsc_hash) {
        die "missing git history even though dsc has hash"
-           unless length $upload_hash;
+           unless $upload_hash;
        $hash = $dsc_hash;
        ensure_we_have_orig();
     } else {
        $hash = generate_commit_from_dsc();
     }
-    if (length $upload_hash) {
+    if ($upload_hash) {
        die "not fast forward on last upload branch!".
            " (archive's version left in DGIT_ARCHIVE)"
            unless is_fast_fwd($dsc_hash, $upload_hash);
@@ -315,9 +316,10 @@ sub clone () {
        print "last upload to archive has NO git hash\n";
     }
     my $dstdir = "$package";
+    my $branch = uploadbranch();
     if (check_for_git()) {
        print "cloning existing git history\n";
-       runcmd qw(git clone --origin),$remotename, qw(-b), $suite, '--',
+       runcmd qw(git clone --origin),$remotename, qw(-b), $branch, '--',
            $alioth_git, $dstdir;
        chdir "$dstdir" or die "$dstdir $!";
        fetch_from_archive();
@@ -331,8 +333,8 @@ sub clone () {
        print H "ref: ".lref(uploadbranch())."\n" or die $!;
        close H or die $!;
        runcmd qw(git remote add), $remotename, $alioth_git;
-       runcmd "git config branch.$suite.remote $remotename";
-       runcmd "git config branch.$suite.merge ".lref(uploadbranch());
+       runcmd "git config branch.$branch.remote $remotename";
+       runcmd "git config branch.$branch.merge ".lref(uploadbranch());
        my $newhash = generate_commit_from_dsc();
        runcmd qw(git reset --hard), $newhash;
     }
@@ -340,6 +342,7 @@ sub clone () {
 }
 
 sub fetch () {
+    get_archive_dsc();
     if (check_for_git()) {
        runcmd qw(git fetch -p),$remotename,
            '+refs/heads/*:refs/remotes/origin/*';
@@ -401,7 +404,7 @@ sub cmd_clone {
 
 sub branchsuite () {
     my $branch = `git-symbolic-ref HEAD`;
-    if ($branch =~ m#^refs/heads/dgit/([^/.]+)$#) {
+    if ($branch =~ m#^refs/heads/$branchprefix/([^/.]+)$#o) {
        return $1;
     } else {
        return undef;