chiark / gitweb /
fix $want handling
[topbloke.git] / tb-list.pl
index e1fea3981c919b894943e03a36492730a8131025..e88b17d93d9c0c691ae472770251f498176bf85c 100755 (executable)
@@ -8,6 +8,8 @@ use strict;
 use Getopt::Long;
 use Topbloke;
 
+#----- option parsing -----
+
 Getopt::Long::Configure(qw(bundling));
 
 our $deleted=0;
@@ -45,6 +47,8 @@ foreach $sort (@sort) {
 
 $relatedto = $relatedto ? parse_patch_spec($relatedto) : undef;
 
+#----- list patches -----
+
 our %patches;
 
 foreach_patch($relatedto || $leaves || !$spec ? { } : $spec, 
@@ -56,11 +60,16 @@ foreach_patch($relatedto || $leaves || !$spec ? { } : $spec,
                  $patches{$patch}{ParsedName} = $parsedname;
              });
 
+#----- selection -----
+
 if ($leaves) {
+    debug("leaves");
     foreach my $p (keys %patches) {
+       debug("leaves $p");
        my $v = $patches{$p};
        next if $v->{Info}[0]{Deleted};
        foreach my $dep (keys %{ $v->{Info}[1] }) {
+           debug("leaves $p $dep");
            next unless exists $patches{$dep};
            $patches{$dep}{NotLeaf} = 1;
        }
@@ -102,6 +111,8 @@ foreach my $p (keys %patches) {
     push @output, $p;
 }
 
+#----- sorting -----
+
 sub sortsub () {
     my $txt = "sub sort_cmp {\n    my \$r;\n";
     debug("@sort");
@@ -148,7 +159,7 @@ eval sortsub()." 1;" or die "$@ ?";
 
 @output = sort sort_cmp @output;
 
-use Data::Dumper;
+#----- printing -----
 
 my $current_branch = current_branch();
 my $current_patch = $current_branch->{Kind} eq 'tip'