summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2013-08-15 16:06:10 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2013-08-15 16:06:10 +0100
commit22eb2fcd94eda960ada160d142f70c7c0f383720 (patch)
tree153b1b37adfcba11e09604c3598dbd4cc844d63d
parentb8c951bca96af3217b918fd3d0f9abbf9e0b292e (diff)
wip from tests
-rw-r--r--TODO2
-rwxr-xr-xdgit23
2 files changed, 15 insertions, 10 deletions
diff --git a/TODO b/TODO
index 080502d..cff119b 100644
--- 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 a2e1488..12c06eb 100755
--- 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;