From: Ian Jackson Date: Mon, 23 Jan 2012 01:41:38 +0000 (+0000) Subject: list: support -c X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;ds=inline;h=48f60f1504b18632444fc115890205783de0fd49;p=topbloke.git list: support -c --- diff --git a/tb-list.pl b/tb-list.pl index e88b17d..1e95270 100755 --- a/tb-list.pl +++ b/tb-list.pl @@ -15,13 +15,21 @@ Getopt::Long::Configure(qw(bundling)); our $deleted=0; our $deleted_only=0; our $current=0; -our $relatedto=0; +our $relatedto; our $leaves=0; our $sort=''; GetOptions("d|deleted!" => \$deleted, # including deleted patches "deleted-only!" => \$deleted_only, # only deleted patches - "r|related=s" => \$relatedto, # only patches related to this one + "r|related=s" => sub { # only patches related to that + $relatedto = parse_patch_spec($_[1]); + }, + "c|related-current" => sub { # only patches related to current + my $current_branch = current_branch(); + die "-c only permitted when on a topbloke branch\n" + unless $current_branch->{Kind} =~ m/^(?:tip|base)$/; + $relatedto = $current_branch; + }, "l|last|leaf|leaves" => \$leaves, # only leaf patches "sort=s" => \$sort, ) or die "bad options\n"; @@ -45,8 +53,6 @@ foreach $sort (@sort) { $toposort=1 if $sort eq $toposort; } -$relatedto = $relatedto ? parse_patch_spec($relatedto) : undef; - #----- list patches ----- our %patches;