8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
Reviewed-by: weijun, dsamersoff, darcy, jrose, tbell
This commit is contained in:
parent
f1ff8b5c67
commit
4f5a89a546
@ -27,7 +27,7 @@
|
|||||||
# Documentation is available via 'webrev -h'.
|
# Documentation is available via 'webrev -h'.
|
||||||
#
|
#
|
||||||
|
|
||||||
WEBREV_UPDATED=24.1-hg+openjdk.java.net
|
WEBREV_UPDATED=25.0-hg+openjdk.java.net
|
||||||
|
|
||||||
HTML='<?xml version="1.0"?>
|
HTML='<?xml version="1.0"?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
@ -39,7 +39,8 @@ FRAMEHTML='<?xml version="1.0"?>
|
|||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n'
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n'
|
||||||
|
|
||||||
STDHEAD='<meta http-equiv="cache-control" content="no-cache" />
|
STDHEAD='<meta charset="utf-8">
|
||||||
|
<meta http-equiv="cache-control" content="no-cache" />
|
||||||
<meta http-equiv="Pragma" content="no-cache" />
|
<meta http-equiv="Pragma" content="no-cache" />
|
||||||
<meta http-equiv="Expires" content="-1" />
|
<meta http-equiv="Expires" content="-1" />
|
||||||
<!--
|
<!--
|
||||||
@ -136,7 +137,19 @@ span.new {
|
|||||||
#
|
#
|
||||||
html_quote()
|
html_quote()
|
||||||
{
|
{
|
||||||
sed -e "s/&/\&/g" -e "s/</\</g" -e "s/>/\>/g" "$@" | expand
|
sed -e "s/&/\&/g" -e "s/&#\([x]*[0-9A-Fa-f]\{2,5\}\);/\&#\1;/g" -e "s/</\</g" -e "s/>/\>/g" "$@" | expand
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# input_cmd | html_quote | output_cmd
|
||||||
|
# or
|
||||||
|
# html_dequote filename | output_cmd
|
||||||
|
#
|
||||||
|
# Replace HTML entities with literals
|
||||||
|
#
|
||||||
|
html_dequote()
|
||||||
|
{
|
||||||
|
sed -e "s/"/\"/g" -e "s/'/\'/g" -e "s/&/\&/g" -e "s/</<'/g" -e "s/>/>/g" "$@" | expand
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -149,23 +162,6 @@ bug2url()
|
|||||||
sed -e 's|[0-9]\{5,\}|<a href=\"'$BUGURL$IDPREFIX'&\">&</a>|g'
|
sed -e 's|[0-9]\{5,\}|<a href=\"'$BUGURL$IDPREFIX'&\">&</a>|g'
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# input_cmd | sac2url | output_cmd
|
|
||||||
#
|
|
||||||
# Scan for ARC cases and insert <a> links to the relevent SAC database.
|
|
||||||
# This is slightly complicated because inside the SWAN, SAC cases are
|
|
||||||
# grouped by ARC: PSARC/2006/123. But on OpenSolaris.org, they are
|
|
||||||
# referenced as 2006/123 (without labelling the ARC).
|
|
||||||
#
|
|
||||||
sac2url()
|
|
||||||
{
|
|
||||||
if [[ -z $Oflag ]]; then
|
|
||||||
sed -e 's|\([A-Z]\{1,2\}ARC\)[ /]\([0-9]\{4\}\)/\([0-9]\{3\}\)|<a href=\"'$SACURL'\1/\2/\3\">\1 \2/\3</a>|g'
|
|
||||||
else
|
|
||||||
sed -e 's|\([A-Z]\{1,2\}ARC\)[ /]\([0-9]\{4\}\)/\([0-9]\{3\}\)|<a href=\"'$SACURL'/\2/\3\">\1 \2/\3</a>|g'
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# strip_unchanged <infile> | output_cmd
|
# strip_unchanged <infile> | output_cmd
|
||||||
#
|
#
|
||||||
@ -1055,79 +1051,6 @@ source_to_html()
|
|||||||
print "</pre></body></html>"
|
print "</pre></body></html>"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# teamwarecomments {text|html} parent-file child-file
|
|
||||||
#
|
|
||||||
# Find the first delta in the child that's not in the parent. Get the
|
|
||||||
# newest delta from the parent, get all deltas from the child starting
|
|
||||||
# with that delta, and then get all info starting with the second oldest
|
|
||||||
# delta in that list (the first delta unique to the child).
|
|
||||||
#
|
|
||||||
# This code adapted from Bill Shannon's "spc" script
|
|
||||||
#
|
|
||||||
comments_from_teamware()
|
|
||||||
{
|
|
||||||
fmt=$1
|
|
||||||
pfile=$PWS/$2
|
|
||||||
cfile=$CWS/$3
|
|
||||||
|
|
||||||
psid=$($SCCS prs -d:I: $pfile 2>/dev/null)
|
|
||||||
if [[ -z "$psid" ]]; then
|
|
||||||
psid=1.1
|
|
||||||
fi
|
|
||||||
|
|
||||||
set -A sids $($SCCS prs -l -r$psid -d:I: $cfile 2>/dev/null)
|
|
||||||
N=${#sids[@]}
|
|
||||||
|
|
||||||
nawkprg='
|
|
||||||
/^COMMENTS:/ {p=1; next}
|
|
||||||
/^D [0-9]+\.[0-9]+/ {printf "--- %s ---\n", $2; p=0; }
|
|
||||||
NF == 0u { next }
|
|
||||||
{if (p==0) next; print $0 }'
|
|
||||||
|
|
||||||
if [[ $N -ge 2 ]]; then
|
|
||||||
sid1=${sids[$((N-2))]} # Gets 2nd to last sid
|
|
||||||
|
|
||||||
if [[ $fmt == "text" ]]; then
|
|
||||||
$SCCS prs -l -r$sid1 $cfile 2>/dev/null | \
|
|
||||||
$AWK "$nawkprg"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
$SCCS prs -l -r$sid1 $cfile 2>/dev/null | \
|
|
||||||
html_quote | bug2url | sac2url | $AWK "$nawkprg"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# wxcomments {text|html} filepath
|
|
||||||
#
|
|
||||||
# Given the pathname of a file, find its location in a "wx" active file
|
|
||||||
# list and print the following sccs comment. Output is either text or
|
|
||||||
# HTML; if the latter, embedded bugids (sequence of 5 or more digits) are
|
|
||||||
# turned into URLs.
|
|
||||||
#
|
|
||||||
comments_from_wx()
|
|
||||||
{
|
|
||||||
typeset fmt=$1
|
|
||||||
typeset p=$2
|
|
||||||
|
|
||||||
comm=`$AWK '
|
|
||||||
$1 == "'$p'" {
|
|
||||||
do getline ; while (NF > 0)
|
|
||||||
getline
|
|
||||||
while (NF > 0) { print ; getline }
|
|
||||||
exit
|
|
||||||
}' < $wxfile`
|
|
||||||
|
|
||||||
if [[ $fmt == "text" ]]; then
|
|
||||||
print "$comm"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
print "$comm" | html_quote | bug2url | sac2url
|
|
||||||
}
|
|
||||||
|
|
||||||
comments_from_mercurial()
|
comments_from_mercurial()
|
||||||
{
|
{
|
||||||
fmt=$1
|
fmt=$1
|
||||||
@ -1161,7 +1084,7 @@ comments_from_mercurial()
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
print "$comm" | html_quote | bug2url | sac2url
|
print "$comm" | html_quote | bug2url
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -1178,15 +1101,7 @@ getcomments()
|
|||||||
typeset p=$2
|
typeset p=$2
|
||||||
typeset pp=$3
|
typeset pp=$3
|
||||||
|
|
||||||
if [[ -n $wxfile ]]; then
|
|
||||||
comments_from_wx $fmt $p
|
|
||||||
else
|
|
||||||
if [[ $SCM_MODE == "teamware" ]]; then
|
|
||||||
comments_from_teamware $fmt $pp $p
|
|
||||||
elif [[ $SCM_MODE == "mercurial" ]]; then
|
|
||||||
comments_from_mercurial $fmt $pp $p
|
comments_from_mercurial $fmt $pp $p
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1333,74 +1248,6 @@ function difflines
|
|||||||
print "</span>"
|
print "</span>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# flist_from_wx
|
|
||||||
#
|
|
||||||
# Sets up webrev to source its information from a wx-formatted file.
|
|
||||||
# Sets the global 'wxfile' variable.
|
|
||||||
#
|
|
||||||
function flist_from_wx
|
|
||||||
{
|
|
||||||
typeset argfile=$1
|
|
||||||
if [[ -n ${argfile%%/*} ]]; then
|
|
||||||
#
|
|
||||||
# If the wx file pathname is relative then make it absolute
|
|
||||||
# because the webrev does a "cd" later on.
|
|
||||||
#
|
|
||||||
wxfile=$PWD/$argfile
|
|
||||||
else
|
|
||||||
wxfile=$argfile
|
|
||||||
fi
|
|
||||||
|
|
||||||
$AWK '{ c = 1; print;
|
|
||||||
while (getline) {
|
|
||||||
if (NF == 0) { c = -c; continue }
|
|
||||||
if (c > 0) print
|
|
||||||
}
|
|
||||||
}' $wxfile > $FLIST
|
|
||||||
|
|
||||||
print " Done."
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# flist_from_teamware [ <args-to-putback-n> ]
|
|
||||||
#
|
|
||||||
# Generate the file list by extracting file names from a putback -n. Some
|
|
||||||
# names may come from the "update/create" messages and others from the
|
|
||||||
# "currently checked out" warning. Renames are detected here too. Extract
|
|
||||||
# values for CODEMGR_WS and CODEMGR_PARENT from the output of the putback
|
|
||||||
# -n as well, but remove them if they are already defined.
|
|
||||||
#
|
|
||||||
function flist_from_teamware
|
|
||||||
{
|
|
||||||
if [[ -n $codemgr_parent ]]; then
|
|
||||||
if [[ ! -d $codemgr_parent/Codemgr_wsdata ]]; then
|
|
||||||
print -u2 "parent $codemgr_parent doesn't look like a" \
|
|
||||||
"valid teamware workspace"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
parent_args="-p $codemgr_parent"
|
|
||||||
fi
|
|
||||||
|
|
||||||
print " File list from: 'putback -n $parent_args $*' ... \c"
|
|
||||||
|
|
||||||
putback -n $parent_args $* 2>&1 |
|
|
||||||
$AWK '
|
|
||||||
/^update:|^create:/ {print $2}
|
|
||||||
/^Parent workspace:/ {printf("CODEMGR_PARENT=%s\n",$3)}
|
|
||||||
/^Child workspace:/ {printf("CODEMGR_WS=%s\n",$3)}
|
|
||||||
/^The following files are currently checked out/ {p = 1; next}
|
|
||||||
NF == 0 {p=0 ; next}
|
|
||||||
/^rename/ {old=$3}
|
|
||||||
$1 == "to:" {print $2, old}
|
|
||||||
/^"/ {next}
|
|
||||||
p == 1 {print $1}' |
|
|
||||||
sort -r -k 1,1 -u | sort > $FLIST
|
|
||||||
|
|
||||||
print " Done."
|
|
||||||
}
|
|
||||||
|
|
||||||
function outgoing_from_mercurial_forest
|
function outgoing_from_mercurial_forest
|
||||||
{
|
{
|
||||||
hg foutgoing --template 'rev: {rev}\n' $OUTPWS | $FILTER | $AWK '
|
hg foutgoing --template 'rev: {rev}\n' $OUTPWS | $FILTER | $AWK '
|
||||||
@ -1710,47 +1557,13 @@ function env_from_flist
|
|||||||
#
|
#
|
||||||
function detect_scm
|
function detect_scm
|
||||||
{
|
{
|
||||||
#
|
if hg root >/dev/null ; then
|
||||||
# If CODEMGR_WS is specified in the flist file, we assume teamware.
|
|
||||||
#
|
|
||||||
if [[ -r $FLIST ]]; then
|
|
||||||
egrep '^CODEMGR_WS=' $FLIST > /dev/null 2>&1
|
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
print "teamware"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# The presence of $CODEMGR_WS and a Codemgr_wsdata directory
|
|
||||||
# is our clue that this is a teamware workspace.
|
|
||||||
# Same if true if current directory has a Codemgr_wsdata sub-dir
|
|
||||||
#
|
|
||||||
if [[ -z "$CODEMGR_WS" ]]; then
|
|
||||||
CODEMGR_WS=`workspace name 2>/dev/null`
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n $CODEMGR_WS && -d "$CODEMGR_WS/Codemgr_wsdata" ]]; then
|
|
||||||
print "teamware"
|
|
||||||
elif [[ -d $PWD/Codemgr_wsdata ]]; then
|
|
||||||
print "teamware"
|
|
||||||
elif hg root >/dev/null ; then
|
|
||||||
print "mercurial"
|
print "mercurial"
|
||||||
else
|
else
|
||||||
print "unknown"
|
print "unknown"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Extract the parent workspace from the Codemgr_wsdata/parent file
|
|
||||||
#
|
|
||||||
function parent_from_teamware
|
|
||||||
{
|
|
||||||
if [[ -f "$1/Codemgr_wsdata/parent" ]]; then
|
|
||||||
tail -1 "$1/Codemgr_wsdata/parent"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function look_for_prog
|
function look_for_prog
|
||||||
{
|
{
|
||||||
typeset path
|
typeset path
|
||||||
@ -1777,48 +1590,6 @@ function look_for_prog
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_old_new_teamware
|
|
||||||
{
|
|
||||||
# If the child's version doesn't exist then
|
|
||||||
# get a readonly copy.
|
|
||||||
|
|
||||||
if [[ ! -f $F && -f SCCS/s.$F ]]; then
|
|
||||||
$SCCS get -s $F
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Snag new version of file.
|
|
||||||
#
|
|
||||||
rm -f $newdir/$DIR/$F
|
|
||||||
cp $F $newdir/$DIR/$F
|
|
||||||
|
|
||||||
#
|
|
||||||
# Get the parent's version of the file. First see whether the
|
|
||||||
# child's version is checked out and get the parent's version
|
|
||||||
# with keywords expanded or unexpanded as appropriate.
|
|
||||||
#
|
|
||||||
if [ -f $PWS/$PDIR/SCCS/s.$PF -o \
|
|
||||||
-f $PWS/$PDIR/SCCS/p.$PF ]; then
|
|
||||||
rm -f $olddir/$PDIR/$PF
|
|
||||||
if [ -f SCCS/p.$F ]; then
|
|
||||||
$SCCS get -s -p -k $PWS/$PDIR/$PF \
|
|
||||||
> $olddir/$PDIR/$PF
|
|
||||||
else
|
|
||||||
$SCCS get -s -p $PWS/$PDIR/$PF \
|
|
||||||
> $olddir/$PDIR/$PF
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [[ -f $PWS/$PDIR/$PF ]]; then
|
|
||||||
# Parent is not a real workspace, but just a raw
|
|
||||||
# directory tree - use the file that's there as
|
|
||||||
# the old file.
|
|
||||||
|
|
||||||
rm -f $olddir/$DIR/$F
|
|
||||||
cp $PWS/$PDIR/$PF $olddir/$DIR/$F
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Find the parent for $1
|
# Find the parent for $1
|
||||||
#
|
#
|
||||||
@ -1938,10 +1709,6 @@ function build_old_new_mercurial
|
|||||||
|
|
||||||
function build_old_new
|
function build_old_new
|
||||||
{
|
{
|
||||||
if [[ $SCM_MODE == "teamware" ]]; then
|
|
||||||
build_old_new_teamware $@
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $SCM_MODE == "mercurial" ]]; then
|
if [[ $SCM_MODE == "mercurial" ]]; then
|
||||||
build_old_new_mercurial $@
|
build_old_new_mercurial $@
|
||||||
fi
|
fi
|
||||||
@ -1953,37 +1720,31 @@ function build_old_new
|
|||||||
#
|
#
|
||||||
function usage
|
function usage
|
||||||
{
|
{
|
||||||
print "Usage:\twebrev [common-options]
|
print "Usage:\twebrev [options]
|
||||||
webrev [common-options] ( <file> | - )
|
webrev [options] ( <file> | - )
|
||||||
webrev [common-options] -w <wx file>
|
|
||||||
webrev [common-options] -l [arguments to 'putback']
|
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-v: Print the version of this tool.
|
-v: Print the version of this tool.
|
||||||
-b: Do not ignore changes in the amount of white space.
|
-b: Do not ignore changes in the amount of white space.
|
||||||
-c <CR#>: Include link to CR (aka bugid) in the main page.
|
-c <CR#>: Include link to CR (aka bugid) in the main page.
|
||||||
-O: Print bugids/arc cases suitable for OpenJDK.
|
|
||||||
-i <filename>: Include <filename> in the index.html file.
|
-i <filename>: Include <filename> in the index.html file.
|
||||||
-o <outdir>: Output webrev to specified directory.
|
-o <outdir>: Output webrev to specified directory.
|
||||||
-p <compare-against>: Use specified parent wkspc or basis for comparison
|
-p <compare-against>: Use specified parent wkspc or basis for comparison
|
||||||
-w <wxfile>: Use specified wx active file.
|
|
||||||
-u <username>: Use that username instead of 'guessing' one.
|
-u <username>: Use that username instead of 'guessing' one.
|
||||||
-m: Forces the use of Mercurial
|
-m: Forces the use of Mercurial
|
||||||
-t: Forces the use of Teamware
|
|
||||||
|
|
||||||
Mercurial only options:
|
Mercurial only options:
|
||||||
-r rev: Compare against a specified revision
|
-r rev: Compare against a specified revision
|
||||||
-N: Skip 'hg outgoing', use only 'hg status'
|
-N: Skip 'hg outgoing', use only 'hg status'
|
||||||
-f: Use the forest extension
|
-f: Use the forest extension
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
<file>: Optional file containing list of files to include in webrev
|
||||||
|
-: read list of files to include in webrev from standard input
|
||||||
|
|
||||||
Environment:
|
Environment:
|
||||||
WDIR: Control the output directory.
|
WDIR: Control the output directory.
|
||||||
WEBREV_BUGURL: Control the URL prefix for bugids.
|
WEBREV_BUGURL: Control the URL prefix for bugids.
|
||||||
WEBREV_SACURL: Control the URL prefix for ARC cases.
|
|
||||||
|
|
||||||
SCM Environment:
|
|
||||||
Teamware: CODEMGR_WS: Workspace location.
|
|
||||||
Teamware: CODEMGR_PARENT: Parent workspace location.
|
|
||||||
|
|
||||||
"
|
"
|
||||||
|
|
||||||
@ -2003,7 +1764,6 @@ trap "rm -f /tmp/$$.* ; exit" 0 1 2 3 15
|
|||||||
set +o noclobber
|
set +o noclobber
|
||||||
|
|
||||||
[[ -z $WDIFF ]] && WDIFF=`look_for_prog wdiff`
|
[[ -z $WDIFF ]] && WDIFF=`look_for_prog wdiff`
|
||||||
[[ -z $WX ]] && WX=`look_for_prog wx`
|
|
||||||
[[ -z $CODEREVIEW ]] && CODEREVIEW=`look_for_prog codereview`
|
[[ -z $CODEREVIEW ]] && CODEREVIEW=`look_for_prog codereview`
|
||||||
[[ -z $PS2PDF ]] && PS2PDF=`look_for_prog ps2pdf`
|
[[ -z $PS2PDF ]] && PS2PDF=`look_for_prog ps2pdf`
|
||||||
[[ -z $PERL ]] && PERL=`look_for_prog perl`
|
[[ -z $PERL ]] && PERL=`look_for_prog perl`
|
||||||
@ -2011,7 +1771,6 @@ set +o noclobber
|
|||||||
[[ -z $AWK ]] && AWK=`look_for_prog nawk`
|
[[ -z $AWK ]] && AWK=`look_for_prog nawk`
|
||||||
[[ -z $AWK ]] && AWK=`look_for_prog gawk`
|
[[ -z $AWK ]] && AWK=`look_for_prog gawk`
|
||||||
[[ -z $AWK ]] && AWK=`look_for_prog awk`
|
[[ -z $AWK ]] && AWK=`look_for_prog awk`
|
||||||
[[ -z $WSPACE ]] && WSPACE=`look_for_prog workspace`
|
|
||||||
[[ -z $JAR ]] && JAR=`look_for_prog jar`
|
[[ -z $JAR ]] && JAR=`look_for_prog jar`
|
||||||
[[ -z $ZIP ]] && ZIP=`look_for_prog zip`
|
[[ -z $ZIP ]] && ZIP=`look_for_prog zip`
|
||||||
[[ -z $GETENT ]] && GETENT=`look_for_prog getent`
|
[[ -z $GETENT ]] && GETENT=`look_for_prog getent`
|
||||||
@ -2033,8 +1792,6 @@ fi
|
|||||||
|
|
||||||
#
|
#
|
||||||
# These aren't fatal, but we want to note them to the user.
|
# These aren't fatal, but we want to note them to the user.
|
||||||
# We don't warn on the absence of 'wx' until later when we've
|
|
||||||
# determined that we actually need to try to invoke it.
|
|
||||||
#
|
#
|
||||||
# [[ ! -x $CODEREVIEW ]] && print -u2 "WARNING: codereview(1) not found."
|
# [[ ! -x $CODEREVIEW ]] && print -u2 "WARNING: codereview(1) not found."
|
||||||
# [[ ! -x $PS2PDF ]] && print -u2 "WARNING: ps2pdf(1) not found."
|
# [[ ! -x $PS2PDF ]] && print -u2 "WARNING: ps2pdf(1) not found."
|
||||||
@ -2050,13 +1807,11 @@ iflag=
|
|||||||
oflag=
|
oflag=
|
||||||
pflag=
|
pflag=
|
||||||
uflag=
|
uflag=
|
||||||
lflag=
|
|
||||||
wflag=
|
|
||||||
Oflag=
|
Oflag=
|
||||||
rflag=
|
rflag=
|
||||||
Nflag=
|
Nflag=
|
||||||
forestflag=
|
forestflag=
|
||||||
while getopts "c:i:o:p:r:u:lmtwONvfb" opt
|
while getopts "c:i:o:p:r:u:mONvfb" opt
|
||||||
do
|
do
|
||||||
case $opt in
|
case $opt in
|
||||||
b) bflag=1;;
|
b) bflag=1;;
|
||||||
@ -2081,19 +1836,7 @@ do
|
|||||||
|
|
||||||
m) SCM_MODE="mercurial";;
|
m) SCM_MODE="mercurial";;
|
||||||
|
|
||||||
t) SCM_MODE="teamware";;
|
O) Oflag=1;; # ignored (bugs are now all visible at bugs.openjdk.java.net)
|
||||||
|
|
||||||
#
|
|
||||||
# If -l has been specified, we need to abort further options
|
|
||||||
# processing, because subsequent arguments are going to be
|
|
||||||
# arguments to 'putback -n'.
|
|
||||||
#
|
|
||||||
l) lflag=1
|
|
||||||
break;;
|
|
||||||
|
|
||||||
w) wflag=1;;
|
|
||||||
|
|
||||||
O) Oflag=1;;
|
|
||||||
|
|
||||||
N) Nflag=1;;
|
N) Nflag=1;;
|
||||||
|
|
||||||
@ -2112,10 +1855,6 @@ done
|
|||||||
FLIST=/tmp/$$.flist
|
FLIST=/tmp/$$.flist
|
||||||
HG_LIST_FROM_COMMIT=
|
HG_LIST_FROM_COMMIT=
|
||||||
|
|
||||||
if [[ -n $wflag && -n $lflag ]]; then
|
|
||||||
usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n $forestflag && -n $rflag ]]; then
|
if [[ -n $forestflag && -n $rflag ]]; then
|
||||||
print "The -r <rev> flag is incompatible with the use of forests"
|
print "The -r <rev> flag is incompatible with the use of forests"
|
||||||
exit 2
|
exit 2
|
||||||
@ -2130,7 +1869,6 @@ if [[ -n $pflag && -d $codemgr_parent/raw_files/new ]]; then
|
|||||||
codemgr_parent="$codemgr_parent/raw_files/new"
|
codemgr_parent="$codemgr_parent/raw_files/new"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z $wflag && -z $lflag ]]; then
|
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
if [[ $1 == "-" ]]; then
|
if [[ $1 == "-" ]]; then
|
||||||
@ -2151,7 +1889,6 @@ if [[ -z $wflag && -z $lflag ]]; then
|
|||||||
else
|
else
|
||||||
flist_mode="auto"
|
flist_mode="auto"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Before we go on to further consider -l and -w, work out which SCM we think
|
# Before we go on to further consider -l and -w, work out which SCM we think
|
||||||
@ -2162,8 +1899,6 @@ if [[ -z $SCM_MODE ]]; then
|
|||||||
fi
|
fi
|
||||||
if [[ $SCM_MODE == "unknown" ]]; then
|
if [[ $SCM_MODE == "unknown" ]]; then
|
||||||
print -u2 "Unable to determine SCM type currently in use."
|
print -u2 "Unable to determine SCM type currently in use."
|
||||||
print -u2 "For teamware: webrev looks for \$CODEMGR_WS either in"
|
|
||||||
print -u2 " the environment or in the file list."
|
|
||||||
print -u2 "For mercurial: webrev runs 'hg root'."
|
print -u2 "For mercurial: webrev runs 'hg root'."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -2199,7 +1934,7 @@ if [[ $SCM_MODE == "mercurial" ]]; then
|
|||||||
#
|
#
|
||||||
# for forest we have to rely on properly set default and
|
# for forest we have to rely on properly set default and
|
||||||
# default-push because they can be different from the top one.
|
# default-push because they can be different from the top one.
|
||||||
# unless of course it was explicitely speficied with -p
|
# unless of course it was explicitly specified with -p
|
||||||
if [[ -z $pflag ]]; then
|
if [[ -z $pflag ]]; then
|
||||||
OUTPWS=
|
OUTPWS=
|
||||||
fi
|
fi
|
||||||
@ -2281,46 +2016,7 @@ if [[ $SCM_MODE == "mercurial" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $lflag ]]; then
|
if [[ $flist_mode == "stdin" ]]; then
|
||||||
#
|
|
||||||
# If the -l flag is given instead of the name of a file list,
|
|
||||||
# then generate the file list by extracting file names from a
|
|
||||||
# putback -n.
|
|
||||||
#
|
|
||||||
shift $(($OPTIND - 1))
|
|
||||||
if [[ $SCM_MODE == "teamware" ]]; then
|
|
||||||
flist_from_teamware "$*"
|
|
||||||
elif [[ $SCM_MODE == "mercurial" ]]; then
|
|
||||||
flist_from_mercurial
|
|
||||||
fi
|
|
||||||
flist_done=1
|
|
||||||
shift $#
|
|
||||||
|
|
||||||
elif [[ -n $wflag ]]; then
|
|
||||||
#
|
|
||||||
# If the -w is given then assume the file list is in Bonwick's "wx"
|
|
||||||
# command format, i.e. pathname lines alternating with SCCS comment
|
|
||||||
# lines with blank lines as separators. Use the SCCS comments later
|
|
||||||
# in building the index.html file.
|
|
||||||
#
|
|
||||||
shift $(($OPTIND - 1))
|
|
||||||
wxfile=$1
|
|
||||||
if [[ -z $wxfile && -n $CODEMGR_WS ]]; then
|
|
||||||
if [[ -r $CODEMGR_WS/wx/active ]]; then
|
|
||||||
wxfile=$CODEMGR_WS/wx/active
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -z $wxfile ]] && print -u2 "wx file not specified, and could not " \
|
|
||||||
"be auto-detected (check \$CODEMGR_WS)" && exit 1
|
|
||||||
|
|
||||||
print -u2 " File list from: wx 'active' file '$wxfile' ... \c"
|
|
||||||
flist_from_wx $wxfile
|
|
||||||
flist_done=1
|
|
||||||
if [[ -n "$*" ]]; then
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
elif [[ $flist_mode == "stdin" ]]; then
|
|
||||||
print -u2 " File list from: standard input"
|
print -u2 " File list from: standard input"
|
||||||
elif [[ $flist_mode == "file" ]]; then
|
elif [[ $flist_mode == "file" ]]; then
|
||||||
print -u2 " File list from: $flist_file"
|
print -u2 " File list from: $flist_file"
|
||||||
@ -2330,110 +2026,7 @@ if [[ $# -gt 0 ]]; then
|
|||||||
print -u2 "WARNING: unused arguments: $*"
|
print -u2 "WARNING: unused arguments: $*"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $SCM_MODE == "teamware" ]]; then
|
if [[ $SCM_MODE == "mercurial" ]]; then
|
||||||
#
|
|
||||||
# Parent (internally $codemgr_parent) and workspace ($codemgr_ws) can
|
|
||||||
# be set in a number of ways, in decreasing precedence:
|
|
||||||
#
|
|
||||||
# 1) on the command line (only for the parent)
|
|
||||||
# 2) in the user environment
|
|
||||||
# 3) in the flist
|
|
||||||
# 4) automatically based on the workspace (only for the parent)
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Here is case (2): the user environment
|
|
||||||
#
|
|
||||||
[[ -z $codemgr_ws && -n $CODEMGR_WS ]] && codemgr_ws=$CODEMGR_WS
|
|
||||||
[[ -z $codemgr_ws && -n $WSPACE ]] && codemgr_ws=`$WSPACE name`
|
|
||||||
|
|
||||||
if [[ -n $codemgr_ws && ! -d $codemgr_ws ]]; then
|
|
||||||
print -u2 "$codemgr_ws: no such workspace"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -z $codemgr_parent && -n $CODEMGR_PARENT ]] && \
|
|
||||||
codemgr_parent=$CODEMGR_PARENT
|
|
||||||
|
|
||||||
if [[ -n $codemgr_parent && ! -d $codemgr_parent ]]; then
|
|
||||||
print -u2 "$codemgr_parent: no such directory"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# If we're in auto-detect mode and we haven't already gotten the file
|
|
||||||
# list, then see if we can get it by probing for wx.
|
|
||||||
#
|
|
||||||
if [[ -z $flist_done && $flist_mode == "auto" && -n $codemgr_ws ]]; then
|
|
||||||
if [[ ! -x $WX ]]; then
|
|
||||||
print -u2 "WARNING: wx not found!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# We need to use wx list -w so that we get renamed files, etc.
|
|
||||||
# but only if a wx active file exists-- otherwise wx will
|
|
||||||
# hang asking us to initialize our wx information.
|
|
||||||
#
|
|
||||||
if [[ -x $WX && -f $codemgr_ws/wx/active ]]; then
|
|
||||||
print -u2 " File list from: 'wx list -w' ... \c"
|
|
||||||
$WX list -w > $FLIST
|
|
||||||
$WX comments > /tmp/$$.wx_comments
|
|
||||||
wxfile=/tmp/$$.wx_comments
|
|
||||||
print -u2 "done"
|
|
||||||
flist_done=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# If by hook or by crook we've gotten a file list by now (perhaps
|
|
||||||
# from the command line), eval it to extract environment variables from
|
|
||||||
# it: This is step (3).
|
|
||||||
#
|
|
||||||
env_from_flist
|
|
||||||
|
|
||||||
#
|
|
||||||
# Continuing step (3): If we still have no file list, we'll try to get
|
|
||||||
# it from teamware.
|
|
||||||
#
|
|
||||||
if [[ -z $flist_done ]]; then
|
|
||||||
flist_from_teamware
|
|
||||||
env_from_flist
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z $codemgr_ws && -d $PWD/Codemgr_wsdata ]]; then
|
|
||||||
codemgr_ws=$PWD
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
# Observe true directory name of CODEMGR_WS, as used later in
|
|
||||||
# webrev title.
|
|
||||||
#
|
|
||||||
if [[ -n $codemgr_ws ]]; then
|
|
||||||
codemgr_ws=$(cd $codemgr_ws;print $PWD)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n $codemgr_parent ]]; then
|
|
||||||
codemgr_parent=$(cd $codemgr_parent;print $PWD)
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# (4) If we still don't have a value for codemgr_parent, get it
|
|
||||||
# from workspace.
|
|
||||||
#
|
|
||||||
[[ -z $codemgr_parent && -n $WSPACE ]] && codemgr_parent=`$WSPACE parent`
|
|
||||||
[[ -z $codemgr_parent ]] && codemgr_parent=`parent_from_teamware $codemgr_ws`
|
|
||||||
|
|
||||||
if [[ ! -d $codemgr_parent ]]; then
|
|
||||||
print -u2 "$CODEMGR_PARENT: no such parent workspace"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Reset CODEMGR_WS to make sure teamware commands are happy.
|
|
||||||
#
|
|
||||||
CODEMGR_WS=$codemgr_ws
|
|
||||||
CWS=$codemgr_ws
|
|
||||||
PWS=$codemgr_parent
|
|
||||||
elif [[ $SCM_MODE == "mercurial" ]]; then
|
|
||||||
if [[ -z $flist_done ]]; then
|
if [[ -z $flist_done ]]; then
|
||||||
flist_from_mercurial $PWS
|
flist_from_mercurial $PWS
|
||||||
fi
|
fi
|
||||||
@ -2527,31 +2120,13 @@ print " Output to: $WDIR"
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Bug IDs will be replaced by a URL. Order of precedence
|
# Bug IDs will be replaced by a URL. Order of precedence
|
||||||
# is: default location, $WEBREV_BUGURL, the -O flag.
|
# is: default location, $WEBREV_BUGURL
|
||||||
#
|
#
|
||||||
BUGURL='https://bugs.openjdk.java.net/browse/'
|
BUGURL='https://bugs.openjdk.java.net/browse/'
|
||||||
[[ -n $WEBREV_BUGURL ]] && BUGURL="$WEBREV_BUGURL"
|
[[ -n $WEBREV_BUGURL ]] && BUGURL="$WEBREV_BUGURL"
|
||||||
if [[ -n "$Oflag" ]]; then
|
|
||||||
CRID=`echo $CRID | sed -e 's/JDK-//'`
|
|
||||||
BUGURL='http://bugs.sun.com/bugdatabase/view_bug.do?bug_id='
|
|
||||||
IDPREFIX=''
|
|
||||||
else
|
|
||||||
IDPREFIX='JDK-'
|
IDPREFIX='JDK-'
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Likewise, ARC cases will be replaced by a URL. Order of precedence
|
|
||||||
# is: default, $WEBREV_SACURL, the -O flag.
|
|
||||||
#
|
|
||||||
# Note that -O also triggers different substitution behavior for
|
|
||||||
# SACURL. See sac2url().
|
|
||||||
#
|
|
||||||
SACURL='http://sac.eng.sun.com'
|
|
||||||
[[ -n $WEBREV_SACURL ]] && SACURL="$WEBREV_SACURL"
|
|
||||||
[[ -n $Oflag ]] && \
|
|
||||||
SACURL='http://www.opensolaris.org/os/community/arc/caselog'
|
|
||||||
|
|
||||||
rm -f $WDIR/$WNAME.patch
|
rm -f $WDIR/$WNAME.patch
|
||||||
rm -f $WDIR/$WNAME.changeset
|
rm -f $WDIR/$WNAME.changeset
|
||||||
rm -f $WDIR/$WNAME.ps
|
rm -f $WDIR/$WNAME.ps
|
||||||
@ -2650,20 +2225,6 @@ do
|
|||||||
# cd to the directory so the names are short
|
# cd to the directory so the names are short
|
||||||
cd $CWS/$DIR
|
cd $CWS/$DIR
|
||||||
|
|
||||||
#
|
|
||||||
# If we're in OpenSolaris mode, we enforce a minor policy:
|
|
||||||
# help to make sure the reviewer doesn't accidentally publish
|
|
||||||
# source which is in usr/closed/*
|
|
||||||
#
|
|
||||||
if [[ -n $Oflag ]]; then
|
|
||||||
pclosed=${P##usr/closed/}
|
|
||||||
if [[ $pclosed != $P ]]; then
|
|
||||||
print "*** Omitting closed source for OpenSolaris" \
|
|
||||||
"mode review"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# We stash old and new files into parallel directories in /tmp
|
# We stash old and new files into parallel directories in /tmp
|
||||||
# and do our diffs there. This makes it possible to generate
|
# and do our diffs there. This makes it possible to generate
|
||||||
@ -2968,18 +2529,15 @@ print "<h2>Code Review for $WNAME</h2>"
|
|||||||
|
|
||||||
print "<table>"
|
print "<table>"
|
||||||
|
|
||||||
if [[ -z $uflag ]]
|
if [[ -z $uflag ]]; then
|
||||||
then
|
if [[ $SCM_MODE == "mercurial" ]]; then
|
||||||
if [[ $SCM_MODE == "mercurial" ]]
|
|
||||||
then
|
|
||||||
#
|
#
|
||||||
# Let's try to extract the user name from the .hgrc file
|
# Let's try to extract the user name from the .hgrc file
|
||||||
#
|
#
|
||||||
username=`grep '^username' $HOME/.hgrc | sed 's/^username[ ]*=[ ]*\(.*\)/\1/'`
|
username=`grep '^username' $HOME/.hgrc | sed 's/^username[ ]*=[ ]*\(.*\)/\1/'`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z $username ]]
|
if [[ -z $username ]]; then
|
||||||
then
|
|
||||||
#
|
#
|
||||||
# Figure out the username and gcos name. To maintain compatibility
|
# Figure out the username and gcos name. To maintain compatibility
|
||||||
# with passwd(4), we must support '&' substitutions.
|
# with passwd(4), we must support '&' substitutions.
|
||||||
@ -3047,27 +2605,21 @@ if [[ -n "$iflag" ]]; then
|
|||||||
print "</div></td></tr>"
|
print "</div></td></tr>"
|
||||||
fi
|
fi
|
||||||
# Add links to referenced CRs, if any
|
# Add links to referenced CRs, if any
|
||||||
# external URL has a <title> like:
|
# URL has a <title> like:
|
||||||
# <title>Bug ID: 6641309 Wrong Cookie separator used in HttpURLConnection</title>
|
# <title>[#JDK-8024688] b106-lambda: j.u.Map.merge doesn't work as specified if contains key:null pair - Java Bug System</title>
|
||||||
# while internal URL has <title> like:
|
# we format this to:
|
||||||
# <title>[#JDK-6641309] Wrong Cookie separator used in HttpURLConnection</title>
|
# JDK-8024688: b106-lambda: j.u.Map.merge doesn't work as specified if contains key:null pair
|
||||||
#
|
|
||||||
if [[ -n $CRID ]]; then
|
if [[ -n $CRID ]]; then
|
||||||
for id in $CRID
|
for id in $CRID
|
||||||
do
|
do
|
||||||
if [[ -z "$Oflag" ]]; then
|
|
||||||
#add "JDK-" to raw bug id for openjdk.java.net links.
|
#add "JDK-" to raw bug id for openjdk.java.net links.
|
||||||
id=`echo ${id} | sed 's/^\([0-9]\{5,\}\)$/JDK-\1/'`
|
id=`echo ${id} | sed 's/^\([0-9]\{5,\}\)$/JDK-\1/'`
|
||||||
fi
|
|
||||||
print "<tr><th>Bug id:</th><td>"
|
print "<tr><th>Bug id:</th><td>"
|
||||||
url="${BUGURL}${id}"
|
url="${BUGURL}${id}"
|
||||||
if [[ -n "$Oflag" ]]; then
|
|
||||||
cleanup='s/Bug ID: \([0-9]\{5,\}\) \(.*\)/JDK-\1 : \2/'
|
|
||||||
else
|
|
||||||
cleanup='s|\[#\(JDK-[0-9]\{5,\}\)\] \(.*\)|\1 : \2|'
|
|
||||||
fi
|
|
||||||
if [[ -n $WGET ]]; then
|
if [[ -n $WGET ]]; then
|
||||||
msg=`$WGET --timeout=10 --tries=1 -q $url -O - | grep '<title>' | sed 's/<title>\(.*\)<\/title>/\1/' | sed "$cleanup" | html_quote`
|
msg=`$WGET --timeout=10 --tries=1 -q $url -O - | grep '<title>' | sed 's/<title>\[#\(.*\)\] \(.*\) - Java Bug System<\/title>/\1 : \2/' | html_dequote | html_quote`
|
||||||
fi
|
fi
|
||||||
if [[ -z $msg ]]; then
|
if [[ -z $msg ]]; then
|
||||||
msg="${id}"
|
msg="${id}"
|
||||||
@ -3184,16 +2736,6 @@ do
|
|||||||
print "<b>$P</b> $oldname"
|
print "<b>$P</b> $oldname"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
|
||||||
# Check for usr/closed
|
|
||||||
#
|
|
||||||
if [ ! -z "$Oflag" ]; then
|
|
||||||
if [[ $P == usr/closed/* ]]; then
|
|
||||||
print " <i>Closed source: omitted from" \
|
|
||||||
"this review</i>"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
print "</p><blockquote>\c"
|
print "</p><blockquote>\c"
|
||||||
# Insert delta comments if any
|
# Insert delta comments if any
|
||||||
comments=`getcomments html $P $PP`
|
comments=`getcomments html $P $PP`
|
||||||
|
Loading…
Reference in New Issue
Block a user