]> xenbits.xensource.com Git - people/aperard/emesinae.git/commitdiff
control.pl: Implement support for bugid == it
authorIan Campbell <ian.campbell@citrix.com>
Thu, 30 May 2013 10:27:08 +0000 (11:27 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 30 May 2013 10:27:08 +0000 (11:27 +0100)
This is an alias for the most recently referrenced bug

TODO
config/examples/test/control.12.test [new file with mode: 0644]
config/examples/test/control.13.test [new file with mode: 0644]
control.txt
scripts/control.pl

diff --git a/TODO b/TODO
index 641dd922d0026a06181c0a82eb8b647e374c4573..f481dbc104b806631a331971a674a4973d7013f7 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,6 +1,5 @@
 control.pl:
  - followup <BUGID> (shortcut for "graft <BUGID> !")
- - <BUGID> == "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 (file)
index 0000000..0577dce
--- /dev/null
@@ -0,0 +1,14 @@
+From: Ian Campbell <IJC@heLlion.org.uk>
+Subject: Using "it" bug reference
+Message-id: <control.12.test@emesinae.example.com>
+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 (file)
index 0000000..08f1fff
--- /dev/null
@@ -0,0 +1,8 @@
+From: Ian Campbell <IJC@heLlion.org.uk>
+Subject: Non existent "it"
+Message-id: <control.13.test@emesinae.example.com>
+To: emesinae-test@list.example.com
+Cc: ijc@hellion.org.uk, test-control@bugs.xenproject.org
+
+severity it normal
+thanks
index 7b15ed66bf852f29b2a598313a85824711b13f06..164da276ee45ec37d9a61afe3a76db72bfcaa4b1 100644 (file)
@@ -18,7 +18,11 @@ Wherever <BUG> 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 <MSGID>". 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
 ====================
index 53ac69033c52b9013e15447e93fa2b16b5f653bf..9bb216aec1cd02020b7198d409e9db11dd642d68 100755 (executable)
@@ -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 );