chiark / gitweb /
Test suite: Make t-archive-none idempotent
[dgit.git] / dgit
diff --git a/dgit b/dgit
index e05c57436d7f06d9c6f298d5039436e4d1544601..4c80280523bd9f3506220622d61eef2a847a9cdb 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1711,8 +1711,11 @@ sub generate_commits_from_dsc () {
     my $clogp;
     my $r1clogp;
 
+    printdebug "import clog search...\n";
+
     for (;;) {
        my $stanzatext = do { local $/=""; <CLOGS>; };
+       printdebug "import clogp ".Dumper($stanzatext) if $debuglevel>1;
        last if !defined $stanzatext;
 
        my $desc = "package changelog, entry no.$.";
@@ -1720,6 +1723,8 @@ sub generate_commits_from_dsc () {
        my $thisstanza = parsecontrolfh $stanzafh, $desc, 1;
        $clogp //= $thisstanza;
 
+       printdebug "import clog $thisstanza->{version} $desc...\n";
+
        last if !$any_orig; # we don't need $r1clogp
 
        # We look for the first (most recent) changelog entry whose
@@ -1744,8 +1749,12 @@ sub generate_commits_from_dsc () {
        # versions were created in a non-monotic order rather than
        # that the changelog entries have been misordered.
 
+       printdebug "import clog $thisstanza->{version} vs $upstreamv...\n";
+
        last if version_compare($thisstanza->{version}, $upstreamv) < 0;
        $r1clogp = $thisstanza;
+
+       printdebug "import clog $r1clogp->{version} becomes r1\n";
     }
     die $! if CLOGS->error;
     close CLOGS or $?==(SIGPIPE<<8) or failedcmd @clogcmd;
@@ -1762,7 +1771,12 @@ sub generate_commits_from_dsc () {
        # Strictly, r1authline might now be wrong if it's going to be
        # unused because !$any_orig.  Whatever.
 
+       printdebug "import tartrees authline   $authline\n";
+       printdebug "import tartrees r1authline $r1authline\n";
+
        foreach my $tt (@tartrees) {
+           printdebug "import tartree $tt->{F} $tt->{Tree}\n";
+
            $tt->{Commit} = make_commit_text($tt->{Orig} ? <<END_O : <<END_T);
 tree $tt->{Tree}
 author $r1authline
@@ -1783,6 +1797,8 @@ END_T
        }
     }
 
+    printdebug "import main commit\n";
+
     open C, ">../commit.tmp" or die $!;
     print C <<END or die $!;
 tree $tree
@@ -1803,6 +1819,8 @@ END
     my $rawimport_hash = make_commit qw(../commit.tmp);
 
     if (madformat $dsc->{format}) {
+       printdebug "import apply patches...\n";
+
        # regularise the state of the working tree so that
        # the checkout of $rawimport_hash works nicely.
        my $dappliedcommit = make_commit_text(<<END);
@@ -1812,9 +1830,9 @@ committer $authline
 
 [dgit dummy commit]
 END
-       runcmd @git, qw(checkout -b dapplied), $dappliedcommit;
+       runcmd @git, qw(checkout -q -b dapplied), $dappliedcommit;
 
-       runcmd @git, qw(checkout -b unpa), $rawimport_hash;
+       runcmd @git, qw(checkout -q -b unpa), $rawimport_hash;
        runcmd shell_cmd 'exec >/dev/null', @gbp, qw(pq import);
        my $gapplied = git_rev_parse('HEAD');
        my $gappliedtree = cmdoutput @git, qw(rev-parse HEAD:);
@@ -2387,7 +2405,7 @@ END
     } else {
        $hash = $mergeinputs[0]{Commit};
     }
-    progress "fetch hash=$hash\n";
+    printdebug "fetch hash=$hash\n";
 
     my $chkff = sub {
        my ($lasth, $what) = @_;