From: Ian Campbell Date: Thu, 30 May 2013 10:27:08 +0000 (+0100) Subject: control.pl: Implement support for bugid == it X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=461786c8a1a938a127cc81f5b0d731e06db4d658;p=people%2Faperard%2Femesinae.git control.pl: Implement support for bugid == it This is an alias for the most recently referrenced bug --- diff --git a/TODO b/TODO index 641dd92..f481dbc 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,5 @@ control.pl: - followup (shortcut for "graft !") - - == "it" (most recently mentioned bug in this message) - way to reference the root of the thread. (From iwj) - nicks for owners? (e.g. ijc => ian.campbell@citrix.com) (From gwd) - quiet control messages (From tjd) diff --git a/config/examples/test/control.12.test b/config/examples/test/control.12.test new file mode 100644 index 0000000..0577dce --- /dev/null +++ b/config/examples/test/control.12.test @@ -0,0 +1,14 @@ +From: Ian Campbell +Subject: Using "it" bug reference +Message-id: +To: emesinae-test@list.example.com +Cc: ijc@hellion.org.uk, test-control@bugs.xenproject.org + +create ! +severity it critical +title it This is a critical bug + +create ! +severity it wishlist +title it This is a wishlist bug +thanks diff --git a/config/examples/test/control.13.test b/config/examples/test/control.13.test new file mode 100644 index 0000000..08f1fff --- /dev/null +++ b/config/examples/test/control.13.test @@ -0,0 +1,8 @@ +From: Ian Campbell +Subject: Non existent "it" +Message-id: +To: emesinae-test@list.example.com +Cc: ijc@hellion.org.uk, test-control@bugs.xenproject.org + +severity it normal +thanks diff --git a/control.txt b/control.txt index 7b15ed6..164da27 100644 --- a/control.txt +++ b/control.txt @@ -18,7 +18,11 @@ Wherever is used below any of the following is acceptable: -[0-9]* -- A back reference to a bug created by a previous command, e.g. via a preceeding "create ". The first such bug is - -1, the second is -2, etc. + -1, the second is -2, etc. (Note: -1 is the first bug created in this + mail, not the previous one, -2 is the second bug not the second last + one). + +it -- The literal string "it" refers to the most recently referenced bug. Identifying a person ==================== diff --git a/scripts/control.pl b/scripts/control.pl index 53ac690..9bb216a 100755 --- a/scripts/control.pl +++ b/scripts/control.pl @@ -176,7 +176,7 @@ sub validate_from ($) { our @reply; -our $MATCH_BUGID = "-?[0-9]+"; +our $MATCH_BUGID = "(?:-?[0-9]+|it)"; sub parse_address ($) { my $a = shift; @@ -229,6 +229,15 @@ sub lookup_msgid ($) { sub lookup_bugid ($) { my $b = shift; + if ( $b eq "it" ) { + die "No previous bug found" unless @bugs; + print "bugs array: " . join(" ",@bugs) . ": $#bugs\n"; + my $it = $bugs [ $#bugs ]; + print "it is $it\n"; + $bugs{$it} = 0 unless $bugs{$it}; + return Emesinae::Bug->new( $dbh, ID => $it ); + } + if ( $b > 0 ) { $bugs{$b} = 0 unless $bugs{$b}; return Emesinae::Bug->new( $dbh, ID => $b );