From 48f60f1504b18632444fc115890205783de0fd49 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 23 Jan 2012 01:41:38 +0000 Subject: [PATCH] list: support -c --- tb-list.pl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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; -- 2.30.2