allow entering bug numbers as "#<num>" and not only "<num>"

Review Request #407 — Created June 6, 2008 and submitted

Information

Review Board SVN (deprecated)

Reviewers

When creating a review, the "Bugs" field accepts comma-separated list of bug numbers. I've noticed that when you enter the number as e.g. #42, RB will silently accept it, but create invalid URL with "#" included, because it expects the bug numbers to be, well, numbers. But some people are in the habit of entering bug references as #num (such as my colleague who entered it like that into RB couple of days ago), so it would be nice if RB accepted this form too.

This patch does exactly that: when setting bug numbers, leading # is (silently) removed. As a side effect, I also changed the way 'bugs_closed' field is processed to be more robust: it recognizes not only '' as empty, but any whitespace, and is now resistant to typos like "42,,43,".
Tested various combinations of inputs both with and without # and with/without excessive use of "," and whitespace on our test installation of RB.
david
  1. Looks good.  Committed as r1379.  Thanks!
    1. A remark on this: In CMSynergy bug numbers can be from different databases, I think the default is to have # as delimiter. You can forward bugs to other databases and then you'll end up with bug numbers like ve001#10, where ve001 is the database name and 10 is the bug number. So the actual bug number is a 'string' instead of a 'number'. Don't know if this results in problems at other places though.
    2. And JIRA uses bug "numbers" like "LUCENE-1300" (with corresponding URL e.g. https://issues.apache.org/jira/browse/LUCENE-1300), so bug IDs certainly shouldn't be limited to numbers.
      
      For clarity's sake, this patch strips only leading #, so if CMSynergy's bugs can't *start* with #, it should be OK.
    3. Bug IDs aren't limited to just numbers. They can be any character nowadays (as of quite a while ago). We just take the entries between commas and pass it in to the bug URL specified for the repository at the location indicated by "%s".
  2. 
      
Loading...