chiark / gitweb /
Unwanted dep removal search - difficulties
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 6 Feb 2012 13:44:42 +0000 (13:44 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 6 Feb 2012 13:44:42 +0000 (13:44 +0000)
DESIGN
tb-update.pl

diff --git a/DESIGN b/DESIGN
index 09cea32e66551b45d24848671b94e2251662db94..a5c7ee6039431b35161ff50faa27205b574de27c 100644 (file)
--- a/DESIGN
+++ b/DESIGN
@@ -259,18 +259,18 @@ Unwanted removal search subgraphs:
 inc  inc..
 /  ???   \
 
-   rm          
+    rm         
 inc..  rm..    merge of a removal, search down the rm path
 /  [inc]  \
 
   inc          ??? call it an inclusion, terminate the search
   rm
 
-  inc          merge of an inclusion, terminates search
+   inc         merge of an inclusion, terminates search
 inc..  rm..
 /  [rm]  \
 
-  inc          ??? call it an inclusion, terminate search
+   inc         ??? call it an inclusion, terminate search
 rm..  rm..
 /  ???    \
   
index cd4e177ab00ca0ef7895429648d369ff13dc8d77..d5eed35a5f52c796af1a2d918c4d48bc1379df94 100755 (executable)
@@ -145,15 +145,41 @@ sub update_base ($) {
                next if $source_inc{$dep};
                unless unless $anc_inc{$dep};
                my $unw_dr = { Name => $dep };
+               my @prune;
+               my $pruned = sub {
+                   my ($commit) = @_;
+                   return grep { commit_has_ancestor($_, $cand) } @prune;
+               };
+               my $prune = sub {
+                   my ($commit) = @_;
+                   return if $pruned->($commit);
+                   push @prune, $commit;
+               };
                run_git(sub {
                    my ($cand, @parents) = split;
+                   if (dep_included_in($dep, $cand)) {
+                       $prune->($cand);
+                       return;
+                   }
+                   my @parents_with =
+                       grep { dep_included_in($dep, $_) } @parents;
+                   return if !@parents_with; # irrelevant merge
+                   return if $pruned->($cand); # not interesting any more
+                   $prune->($_) foreach @parents_with;
+                   
+
+                   PROBLEM @prune is bad we want to know why
+                       we have found thing not just whether found
+                   
+                       # 
                    return if dep_included_in($dep, $cand);
-                   return if grep { !dep_included_in($dep, $_) } @parents;
+                   return if 
                    # OK, it's missing from $cand but included in
                    # all of $cand's parents.
                    
                    },
-                       qw(git-rev-list --date-order --remove-empty)
+                       qw(git-rev-list --date-order --full-history 
+                           --remove-empty)
                        '--pretty=format:%H %P%n',
                        $dep, '--', '.topbloke/+included');