On Oct 9, 2013, at 3:54 PM, Mike Duigou <mike.dui...@oracle.com> wrote:

> Hello all;
> 
> This changeset revisits webrev's integration with bugs.openjdk.java.net to 
> correct problems with the scraping of bug titles from jbs html. I also 
> eliminated the now obsolete "-O" option since bugs are now all visible on the 
> preferred bugs.openjdk.java.net system. 
> 
> While I was at it I finally eliminated the obsolete teamware, sac and wxfile 
> support with the hopes that cruft removal may lower the bar to others 
> contributing to webrev (yeah, it's not glamourous but we still need it).
> 
> http://cr.openjdk.java.net/~mduigou/JDK-8026062/0

Great deletions!

Here's my "private reserve" version of webrev's html_quote, some of which you 
may want to use:

 #
 # Make a piece of source code safe for display in an HTML <pre> block.
+# If the line appears to start with an HTML tag, assume it is markup and don't 
quote on it.
 #
 html_quote()
 {
-       sed -e "s/&/\&amp;/g" -e "s/</\&lt;/g" -e "s/>/\&gt;/g" "$@" | expand
+       sed -e '/^<[a-zA-Z][^<]*[a-zA-Z_0-9\/"'\'']>/{p;d;}' \
+           -e '/^&#*[a-zA-Z_0-9]*;/{p;d;}' \
+           -e "s/&/\&amp;/g" -e "s/</\&lt;/g" -e "s/>/\&gt;/g" \
+           "$@" \
+       | expand
 }
 
A few points about it:

If a line appears to already have HTML in it (heuristically!), it goes 
completely unquoted.  (This makes it easy to add markup to "include" files.)
The sed code for & handles consecutive rewrites, as "&&" or "<&>", which yours 
does not appear to do.
My Mac's version of sed does not appear to rewrite "&" to "&amp;" using your 
code.

— John

P.S.  Like most folks, I have other tweaks in my webrev, but they would be out 
of scope for this change.

Here is the way I use webrev (in the setting of a workflow script):
  webrev-from-openjdk $force_mercurial -u $WEBREV_USER -o $WEBREV_DIR -N -r -2

The "off by one" revision is very important.  It selects the parent of the 
revision I want to review.  I use mq to manage changes all the way through 
review, so "hg outgoing" is irrelevant to me.  Instead, I "hg qgoto" the change 
I want to review, to make it the tip, and then review against -2.  This seems 
to me far safer and more flexible (and with fewer Merge changesets) than the 
alternatives.

I also have a push-button workflow script which can generate the next (00, 01, 
02, ...) minor webrev version for a given bug and push it to cr.ojn.  It seems 
like that should be easy to do with an OpenJDK savvy webrev.

Reply via email to