my $lastupl_ref = "refs/remotes/$remotename/upload/$suite";
+sub rev_parse ($) {
+ return cmdoutput qw(git rev-parse --), "$_[0]~0";
+}
+
+sub is_fast_fwd ($$) {
+ my ($ancestor,$child) = @_;
+ my $mb = cmdoutput qw(git merge-base), $dsc_hash, $lastupl_hash;
+ return rev_parse($mb) eq rev_parse($ancestor);
+}
+
sub fetch_from_archive () {
# ensures that $lastupl_ref is what is actually in the archive,
# one way or another
$hash = generate_commit_from_dsc();
}
if ($lastupl_hash) {
- my $mb = cmdoutput qw(git merge-base), $dsc_hash, $lastupl_hash;
die "not fast forward on last upload branch!".
" (archive's version left in DGIT_ARCHIVE)"
- unless $mb eq $lastupl_hash;
+ unless is_fast_fwd($lastupl_hash, $dsc_hash);
}
if ($lastupl_ref ne $hash) {
cmdoutput qw(git update-ref -m), 'dgit fetch', $lastupl_ref, $hash;
my $tree = mktree_in_ud_from_only_subdir();
chdir '../../../..' or die $!;
runcmd qw(git diff --exit-code), $tree;
-
+ runcmd qw(git fetch), $alioth_git,
+ map { "$_:refs/remotes/$remotename/$_" }
+ (mainbranch(), uploadbranch());
die <<END;
+ if (!is_fast_fwd(mainbranch
+xxx introduce remote_lref
+xxx use remote_lref everywhere
+
fetch from alioth
do fast forward check and maybe fake merge
push to uploading