chiark / gitweb /
git-debrebase: wip gitattrs dealt with
[dgit.git] / git-debrebase
index ba990e7471637f2e79febf8fe74bd877aa706b27..d5203877e21a519be2cc7c0508e83051e5a7b7f9 100755 (executable)
@@ -115,10 +115,10 @@ sub get_commit ($) {
     return ($`,$');
 }
 
-sub D_DEB ()     { return 0x1; }
-sub D_UPS ()     { return 0x2; }
-sub D_PAT_ADD () { return 0x4; }
-sub D_PAT_OTH () { return 0x8; }
+sub D_DEB ()     { return 0x1; } # debian/ (not including debian/patches/)
+sub D_UPS ()     { return 0x2; } # upstream files
+sub D_PAT_ADD () { return 0x4; } # debian/patches/ extra patches at end
+sub D_PAT_OTH () { return 0x8; } # debian/patches other changes
 
 our $rd = ".git/git-debrebase";
 our $ud = "$rd/work";
@@ -130,12 +130,48 @@ sub commit_pr_info ($) {
 
 sub calculate_committer_authline () {
     my $c = cmdoutput @git, qw(commit-tree --no-gpg-sign -m),
-       'XXX DUMMY COMMIT (git-debrebase)', "$basis:";
+       'DUMMY COMMIT (git-debrebase)', "$basis:";
     my ($h,$m) = get_commit $c;
     $h =~ m/^committer .*$/m or confess "($h) ?";
     return $&;
 }
 
+# classify returns an info hash like this
+#   CommitId => $objid
+#   Hdr => # commit headers, including 1 final newline
+#   Msg => # commit message (so one newline is dropped)
+#   Tree => $treeobjid
+#   Type => (see below)
+#   Parents = [ {
+#       Ix => $index # ie 0, 1, 2, ...
+#       CommitId
+#       Differs => return value from get_differs
+#       IsOrigin
+#       IsDggitImport => 'orig' 'tarball' 'unpatched' 'package' (as from dgit)
+#     } ...]
+#   NewMsg => # commit message, but with any [dgit import ...] edited
+#             # to say "[was: ...]"
+#
+# Types:
+#   Packaging
+#   Upstream
+#   AddPatches
+#   Mixed
+#   Unknown
+#
+#   Pseudomerge
+#     has additional entres in classification result
+#       Overwritten = [ subset of Parents ]
+#       Contributor = $the_remaining_Parent
+#
+#   DgitImportUnpatched
+#     has additional entry in classification result
+#       OrigParents = [ subset of Parents ]
+#
+#   BreakwaterUpstreamMerge
+#     has additional entry in classification result
+#       OrigParents = [ subset of Parents ]
+
 sub classify ($) {
     my ($objid) = @_;
 
@@ -243,8 +279,9 @@ sub classify ($) {
        !($p[0]{Differs} & ~D_DEB) &&
        !($p[1]{Differs} & ~D_UPS)) {
        return $classify->(qw(BreakwaterUpstreamMerge),
-                          Upstream => $p[1]);
+                          OrigParents => [ $p[1] ]);
     }
+    # xxx multi-.orig upstreams
 
     return $unknown->("complex merge");
 }
@@ -303,7 +340,13 @@ sub launder ($$$) {
            next;
        } elsif ($ty eq 'Pseudomerge') {
            if (defined $pseudos_must_overwrite_this) {
-               confess 'xxx actually check this';
+               grep {
+                   is_fast_fwd $pseudos_must_overwrite_this, $_->{CommitId}
+               },
+                   @{ $cl->{Overwritten} }
+               or
+                   die "Pseudomerge $cl->{CommitId} does not overwrite ".
+                       "$pseudos_must_overwrite_this as expected.";
            }
            push @pseudomerges, $cl;
            $rewrite_from_here->();
@@ -347,7 +390,6 @@ sub launder ($$$) {
     # Now we build it back up again
 
     workarea_fresh();
-    in_workarea sub { xxx attributes xxx };
 
     my $rewriting = 1;