37 FRAMEHTML='<?xml version="1.0"?> |
37 FRAMEHTML='<?xml version="1.0"?> |
38 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" |
38 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" |
39 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> |
39 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> |
40 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n' |
40 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n' |
41 |
41 |
42 STDHEAD='<meta http-equiv="cache-control" content="no-cache" /> |
42 STDHEAD='<meta charset="utf-8"> |
|
43 <meta http-equiv="cache-control" content="no-cache" /> |
43 <meta http-equiv="Pragma" content="no-cache" /> |
44 <meta http-equiv="Pragma" content="no-cache" /> |
44 <meta http-equiv="Expires" content="-1" /> |
45 <meta http-equiv="Expires" content="-1" /> |
45 <!-- |
46 <!-- |
46 Note to customizers: the body of the webrev is IDed as SUNWwebrev |
47 Note to customizers: the body of the webrev is IDed as SUNWwebrev |
47 to allow easy overriding by users of webrev via the userContent.css |
48 to allow easy overriding by users of webrev via the userContent.css |
134 # |
135 # |
135 # Make a piece of source code safe for display in an HTML <pre> block. |
136 # Make a piece of source code safe for display in an HTML <pre> block. |
136 # |
137 # |
137 html_quote() |
138 html_quote() |
138 { |
139 { |
139 sed -e "s/&/\&/g" -e "s/</\</g" -e "s/>/\>/g" "$@" | expand |
140 sed -e "s/&/\&/g" -e "s/&#\([x]*[0-9A-Fa-f]\{2,5\}\);/\&#\1;/g" -e "s/</\</g" -e "s/>/\>/g" "$@" | expand |
|
141 } |
|
142 |
|
143 # |
|
144 # input_cmd | html_quote | output_cmd |
|
145 # or |
|
146 # html_dequote filename | output_cmd |
|
147 # |
|
148 # Replace HTML entities with literals |
|
149 # |
|
150 html_dequote() |
|
151 { |
|
152 sed -e "s/"/\"/g" -e "s/'/\'/g" -e "s/&/\&/g" -e "s/</<'/g" -e "s/>/>/g" "$@" | expand |
140 } |
153 } |
141 |
154 |
142 # |
155 # |
143 # input_cmd | bug2url | output_cmd |
156 # input_cmd | bug2url | output_cmd |
144 # |
157 # |
145 # Scan for bugids and insert <a> links to the relevent bug database. |
158 # Scan for bugids and insert <a> links to the relevent bug database. |
146 # |
159 # |
147 bug2url() |
160 bug2url() |
148 { |
161 { |
149 sed -e 's|[0-9]\{5,\}|<a href=\"'$BUGURL$IDPREFIX'&\">&</a>|g' |
162 sed -e 's|[0-9]\{5,\}|<a href=\"'$BUGURL$IDPREFIX'&\">&</a>|g' |
150 } |
|
151 |
|
152 # |
|
153 # input_cmd | sac2url | output_cmd |
|
154 # |
|
155 # Scan for ARC cases and insert <a> links to the relevent SAC database. |
|
156 # This is slightly complicated because inside the SWAN, SAC cases are |
|
157 # grouped by ARC: PSARC/2006/123. But on OpenSolaris.org, they are |
|
158 # referenced as 2006/123 (without labelling the ARC). |
|
159 # |
|
160 sac2url() |
|
161 { |
|
162 if [[ -z $Oflag ]]; then |
|
163 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' |
|
164 else |
|
165 sed -e 's|\([A-Z]\{1,2\}ARC\)[ /]\([0-9]\{4\}\)/\([0-9]\{3\}\)|<a href=\"'$SACURL'/\2/\3\">\1 \2/\3</a>|g' |
|
166 fi |
|
167 } |
163 } |
168 |
164 |
169 # |
165 # |
170 # strip_unchanged <infile> | output_cmd |
166 # strip_unchanged <infile> | output_cmd |
171 # |
167 # |
1053 print "<pre>" |
1049 print "<pre>" |
1054 html_quote | $AWK '{line += 1 ; printf "%4d %s\n", line, $0 }' |
1050 html_quote | $AWK '{line += 1 ; printf "%4d %s\n", line, $0 }' |
1055 print "</pre></body></html>" |
1051 print "</pre></body></html>" |
1056 } |
1052 } |
1057 |
1053 |
1058 # |
|
1059 # teamwarecomments {text|html} parent-file child-file |
|
1060 # |
|
1061 # Find the first delta in the child that's not in the parent. Get the |
|
1062 # newest delta from the parent, get all deltas from the child starting |
|
1063 # with that delta, and then get all info starting with the second oldest |
|
1064 # delta in that list (the first delta unique to the child). |
|
1065 # |
|
1066 # This code adapted from Bill Shannon's "spc" script |
|
1067 # |
|
1068 comments_from_teamware() |
|
1069 { |
|
1070 fmt=$1 |
|
1071 pfile=$PWS/$2 |
|
1072 cfile=$CWS/$3 |
|
1073 |
|
1074 psid=$($SCCS prs -d:I: $pfile 2>/dev/null) |
|
1075 if [[ -z "$psid" ]]; then |
|
1076 psid=1.1 |
|
1077 fi |
|
1078 |
|
1079 set -A sids $($SCCS prs -l -r$psid -d:I: $cfile 2>/dev/null) |
|
1080 N=${#sids[@]} |
|
1081 |
|
1082 nawkprg=' |
|
1083 /^COMMENTS:/ {p=1; next} |
|
1084 /^D [0-9]+\.[0-9]+/ {printf "--- %s ---\n", $2; p=0; } |
|
1085 NF == 0u { next } |
|
1086 {if (p==0) next; print $0 }' |
|
1087 |
|
1088 if [[ $N -ge 2 ]]; then |
|
1089 sid1=${sids[$((N-2))]} # Gets 2nd to last sid |
|
1090 |
|
1091 if [[ $fmt == "text" ]]; then |
|
1092 $SCCS prs -l -r$sid1 $cfile 2>/dev/null | \ |
|
1093 $AWK "$nawkprg" |
|
1094 return |
|
1095 fi |
|
1096 |
|
1097 $SCCS prs -l -r$sid1 $cfile 2>/dev/null | \ |
|
1098 html_quote | bug2url | sac2url | $AWK "$nawkprg" |
|
1099 fi |
|
1100 } |
|
1101 |
|
1102 # |
|
1103 # wxcomments {text|html} filepath |
|
1104 # |
|
1105 # Given the pathname of a file, find its location in a "wx" active file |
|
1106 # list and print the following sccs comment. Output is either text or |
|
1107 # HTML; if the latter, embedded bugids (sequence of 5 or more digits) are |
|
1108 # turned into URLs. |
|
1109 # |
|
1110 comments_from_wx() |
|
1111 { |
|
1112 typeset fmt=$1 |
|
1113 typeset p=$2 |
|
1114 |
|
1115 comm=`$AWK ' |
|
1116 $1 == "'$p'" { |
|
1117 do getline ; while (NF > 0) |
|
1118 getline |
|
1119 while (NF > 0) { print ; getline } |
|
1120 exit |
|
1121 }' < $wxfile` |
|
1122 |
|
1123 if [[ $fmt == "text" ]]; then |
|
1124 print "$comm" |
|
1125 return |
|
1126 fi |
|
1127 |
|
1128 print "$comm" | html_quote | bug2url | sac2url |
|
1129 } |
|
1130 |
|
1131 comments_from_mercurial() |
1054 comments_from_mercurial() |
1132 { |
1055 { |
1133 fmt=$1 |
1056 fmt=$1 |
1134 pfile=$PWS/$2 |
1057 pfile=$PWS/$2 |
1135 cfile=$CWS/$3 |
1058 cfile=$CWS/$3 |
1329 fi |
1244 fi |
1330 # print summary |
1245 # print summary |
1331 print "<span class=\"lineschanged\">\c" |
1246 print "<span class=\"lineschanged\">\c" |
1332 printCI $tot $ins $del $mod $unc |
1247 printCI $tot $ins $del $mod $unc |
1333 print "</span>" |
1248 print "</span>" |
1334 } |
|
1335 |
|
1336 |
|
1337 # |
|
1338 # flist_from_wx |
|
1339 # |
|
1340 # Sets up webrev to source its information from a wx-formatted file. |
|
1341 # Sets the global 'wxfile' variable. |
|
1342 # |
|
1343 function flist_from_wx |
|
1344 { |
|
1345 typeset argfile=$1 |
|
1346 if [[ -n ${argfile%%/*} ]]; then |
|
1347 # |
|
1348 # If the wx file pathname is relative then make it absolute |
|
1349 # because the webrev does a "cd" later on. |
|
1350 # |
|
1351 wxfile=$PWD/$argfile |
|
1352 else |
|
1353 wxfile=$argfile |
|
1354 fi |
|
1355 |
|
1356 $AWK '{ c = 1; print; |
|
1357 while (getline) { |
|
1358 if (NF == 0) { c = -c; continue } |
|
1359 if (c > 0) print |
|
1360 } |
|
1361 }' $wxfile > $FLIST |
|
1362 |
|
1363 print " Done." |
|
1364 } |
|
1365 |
|
1366 # |
|
1367 # flist_from_teamware [ <args-to-putback-n> ] |
|
1368 # |
|
1369 # Generate the file list by extracting file names from a putback -n. Some |
|
1370 # names may come from the "update/create" messages and others from the |
|
1371 # "currently checked out" warning. Renames are detected here too. Extract |
|
1372 # values for CODEMGR_WS and CODEMGR_PARENT from the output of the putback |
|
1373 # -n as well, but remove them if they are already defined. |
|
1374 # |
|
1375 function flist_from_teamware |
|
1376 { |
|
1377 if [[ -n $codemgr_parent ]]; then |
|
1378 if [[ ! -d $codemgr_parent/Codemgr_wsdata ]]; then |
|
1379 print -u2 "parent $codemgr_parent doesn't look like a" \ |
|
1380 "valid teamware workspace" |
|
1381 exit 1 |
|
1382 fi |
|
1383 parent_args="-p $codemgr_parent" |
|
1384 fi |
|
1385 |
|
1386 print " File list from: 'putback -n $parent_args $*' ... \c" |
|
1387 |
|
1388 putback -n $parent_args $* 2>&1 | |
|
1389 $AWK ' |
|
1390 /^update:|^create:/ {print $2} |
|
1391 /^Parent workspace:/ {printf("CODEMGR_PARENT=%s\n",$3)} |
|
1392 /^Child workspace:/ {printf("CODEMGR_WS=%s\n",$3)} |
|
1393 /^The following files are currently checked out/ {p = 1; next} |
|
1394 NF == 0 {p=0 ; next} |
|
1395 /^rename/ {old=$3} |
|
1396 $1 == "to:" {print $2, old} |
|
1397 /^"/ {next} |
|
1398 p == 1 {print $1}' | |
|
1399 sort -r -k 1,1 -u | sort > $FLIST |
|
1400 |
|
1401 print " Done." |
|
1402 } |
1249 } |
1403 |
1250 |
1404 function outgoing_from_mercurial_forest |
1251 function outgoing_from_mercurial_forest |
1405 { |
1252 { |
1406 hg foutgoing --template 'rev: {rev}\n' $OUTPWS | $FILTER | $AWK ' |
1253 hg foutgoing --template 'rev: {rev}\n' $OUTPWS | $FILTER | $AWK ' |
1708 # We dynamically test the SCM type; this allows future extensions to |
1555 # We dynamically test the SCM type; this allows future extensions to |
1709 # new SCM types |
1556 # new SCM types |
1710 # |
1557 # |
1711 function detect_scm |
1558 function detect_scm |
1712 { |
1559 { |
1713 # |
1560 if hg root >/dev/null ; then |
1714 # If CODEMGR_WS is specified in the flist file, we assume teamware. |
|
1715 # |
|
1716 if [[ -r $FLIST ]]; then |
|
1717 egrep '^CODEMGR_WS=' $FLIST > /dev/null 2>&1 |
|
1718 if [[ $? -eq 0 ]]; then |
|
1719 print "teamware" |
|
1720 return |
|
1721 fi |
|
1722 fi |
|
1723 |
|
1724 # |
|
1725 # The presence of $CODEMGR_WS and a Codemgr_wsdata directory |
|
1726 # is our clue that this is a teamware workspace. |
|
1727 # Same if true if current directory has a Codemgr_wsdata sub-dir |
|
1728 # |
|
1729 if [[ -z "$CODEMGR_WS" ]]; then |
|
1730 CODEMGR_WS=`workspace name 2>/dev/null` |
|
1731 fi |
|
1732 |
|
1733 if [[ -n $CODEMGR_WS && -d "$CODEMGR_WS/Codemgr_wsdata" ]]; then |
|
1734 print "teamware" |
|
1735 elif [[ -d $PWD/Codemgr_wsdata ]]; then |
|
1736 print "teamware" |
|
1737 elif hg root >/dev/null ; then |
|
1738 print "mercurial" |
1561 print "mercurial" |
1739 else |
1562 else |
1740 print "unknown" |
1563 print "unknown" |
1741 fi |
1564 fi |
1742 } |
|
1743 |
|
1744 # |
|
1745 # Extract the parent workspace from the Codemgr_wsdata/parent file |
|
1746 # |
|
1747 function parent_from_teamware |
|
1748 { |
|
1749 if [[ -f "$1/Codemgr_wsdata/parent" ]]; then |
|
1750 tail -1 "$1/Codemgr_wsdata/parent" |
|
1751 fi |
|
1752 } |
1565 } |
1753 |
1566 |
1754 function look_for_prog |
1567 function look_for_prog |
1755 { |
1568 { |
1756 typeset path |
1569 typeset path |
1772 ppath=$ppath:/java/devtools/share/bin:$DEVTOOLS |
1585 ppath=$ppath:/java/devtools/share/bin:$DEVTOOLS |
1773 |
1586 |
1774 PATH=$ppath prog=`whence $progname` |
1587 PATH=$ppath prog=`whence $progname` |
1775 if [[ -n $prog ]]; then |
1588 if [[ -n $prog ]]; then |
1776 print $prog |
1589 print $prog |
1777 fi |
|
1778 } |
|
1779 |
|
1780 function build_old_new_teamware |
|
1781 { |
|
1782 # If the child's version doesn't exist then |
|
1783 # get a readonly copy. |
|
1784 |
|
1785 if [[ ! -f $F && -f SCCS/s.$F ]]; then |
|
1786 $SCCS get -s $F |
|
1787 fi |
|
1788 |
|
1789 # |
|
1790 # Snag new version of file. |
|
1791 # |
|
1792 rm -f $newdir/$DIR/$F |
|
1793 cp $F $newdir/$DIR/$F |
|
1794 |
|
1795 # |
|
1796 # Get the parent's version of the file. First see whether the |
|
1797 # child's version is checked out and get the parent's version |
|
1798 # with keywords expanded or unexpanded as appropriate. |
|
1799 # |
|
1800 if [ -f $PWS/$PDIR/SCCS/s.$PF -o \ |
|
1801 -f $PWS/$PDIR/SCCS/p.$PF ]; then |
|
1802 rm -f $olddir/$PDIR/$PF |
|
1803 if [ -f SCCS/p.$F ]; then |
|
1804 $SCCS get -s -p -k $PWS/$PDIR/$PF \ |
|
1805 > $olddir/$PDIR/$PF |
|
1806 else |
|
1807 $SCCS get -s -p $PWS/$PDIR/$PF \ |
|
1808 > $olddir/$PDIR/$PF |
|
1809 fi |
|
1810 else |
|
1811 if [[ -f $PWS/$PDIR/$PF ]]; then |
|
1812 # Parent is not a real workspace, but just a raw |
|
1813 # directory tree - use the file that's there as |
|
1814 # the old file. |
|
1815 |
|
1816 rm -f $olddir/$DIR/$F |
|
1817 cp $PWS/$PDIR/$PF $olddir/$DIR/$F |
|
1818 fi |
|
1819 fi |
1590 fi |
1820 } |
1591 } |
1821 |
1592 |
1822 # |
1593 # |
1823 # Find the parent for $1 |
1594 # Find the parent for $1 |
1951 # |
1718 # |
1952 # Usage message. |
1719 # Usage message. |
1953 # |
1720 # |
1954 function usage |
1721 function usage |
1955 { |
1722 { |
1956 print "Usage:\twebrev [common-options] |
1723 print "Usage:\twebrev [options] |
1957 webrev [common-options] ( <file> | - ) |
1724 webrev [options] ( <file> | - ) |
1958 webrev [common-options] -w <wx file> |
|
1959 webrev [common-options] -l [arguments to 'putback'] |
|
1960 |
1725 |
1961 Options: |
1726 Options: |
1962 -v: Print the version of this tool. |
1727 -v: Print the version of this tool. |
1963 -b: Do not ignore changes in the amount of white space. |
1728 -b: Do not ignore changes in the amount of white space. |
1964 -c <CR#>: Include link to CR (aka bugid) in the main page. |
1729 -c <CR#>: Include link to CR (aka bugid) in the main page. |
1965 -O: Print bugids/arc cases suitable for OpenJDK. |
|
1966 -i <filename>: Include <filename> in the index.html file. |
1730 -i <filename>: Include <filename> in the index.html file. |
1967 -o <outdir>: Output webrev to specified directory. |
1731 -o <outdir>: Output webrev to specified directory. |
1968 -p <compare-against>: Use specified parent wkspc or basis for comparison |
1732 -p <compare-against>: Use specified parent wkspc or basis for comparison |
1969 -w <wxfile>: Use specified wx active file. |
|
1970 -u <username>: Use that username instead of 'guessing' one. |
1733 -u <username>: Use that username instead of 'guessing' one. |
1971 -m: Forces the use of Mercurial |
1734 -m: Forces the use of Mercurial |
1972 -t: Forces the use of Teamware |
|
1973 |
1735 |
1974 Mercurial only options: |
1736 Mercurial only options: |
1975 -r rev: Compare against a specified revision |
1737 -r rev: Compare against a specified revision |
1976 -N: Skip 'hg outgoing', use only 'hg status' |
1738 -N: Skip 'hg outgoing', use only 'hg status' |
1977 -f: Use the forest extension |
1739 -f: Use the forest extension |
1978 |
1740 |
|
1741 Arguments: |
|
1742 <file>: Optional file containing list of files to include in webrev |
|
1743 -: read list of files to include in webrev from standard input |
|
1744 |
1979 Environment: |
1745 Environment: |
1980 WDIR: Control the output directory. |
1746 WDIR: Control the output directory. |
1981 WEBREV_BUGURL: Control the URL prefix for bugids. |
1747 WEBREV_BUGURL: Control the URL prefix for bugids. |
1982 WEBREV_SACURL: Control the URL prefix for ARC cases. |
|
1983 |
|
1984 SCM Environment: |
|
1985 Teamware: CODEMGR_WS: Workspace location. |
|
1986 Teamware: CODEMGR_PARENT: Parent workspace location. |
|
1987 |
1748 |
1988 " |
1749 " |
1989 |
1750 |
1990 exit 2 |
1751 exit 2 |
1991 } |
1752 } |
2001 trap "rm -f /tmp/$$.* ; exit" 0 1 2 3 15 |
1762 trap "rm -f /tmp/$$.* ; exit" 0 1 2 3 15 |
2002 |
1763 |
2003 set +o noclobber |
1764 set +o noclobber |
2004 |
1765 |
2005 [[ -z $WDIFF ]] && WDIFF=`look_for_prog wdiff` |
1766 [[ -z $WDIFF ]] && WDIFF=`look_for_prog wdiff` |
2006 [[ -z $WX ]] && WX=`look_for_prog wx` |
|
2007 [[ -z $CODEREVIEW ]] && CODEREVIEW=`look_for_prog codereview` |
1767 [[ -z $CODEREVIEW ]] && CODEREVIEW=`look_for_prog codereview` |
2008 [[ -z $PS2PDF ]] && PS2PDF=`look_for_prog ps2pdf` |
1768 [[ -z $PS2PDF ]] && PS2PDF=`look_for_prog ps2pdf` |
2009 [[ -z $PERL ]] && PERL=`look_for_prog perl` |
1769 [[ -z $PERL ]] && PERL=`look_for_prog perl` |
2010 [[ -z $SCCS ]] && SCCS=`look_for_prog sccs` |
1770 [[ -z $SCCS ]] && SCCS=`look_for_prog sccs` |
2011 [[ -z $AWK ]] && AWK=`look_for_prog nawk` |
1771 [[ -z $AWK ]] && AWK=`look_for_prog nawk` |
2012 [[ -z $AWK ]] && AWK=`look_for_prog gawk` |
1772 [[ -z $AWK ]] && AWK=`look_for_prog gawk` |
2013 [[ -z $AWK ]] && AWK=`look_for_prog awk` |
1773 [[ -z $AWK ]] && AWK=`look_for_prog awk` |
2014 [[ -z $WSPACE ]] && WSPACE=`look_for_prog workspace` |
|
2015 [[ -z $JAR ]] && JAR=`look_for_prog jar` |
1774 [[ -z $JAR ]] && JAR=`look_for_prog jar` |
2016 [[ -z $ZIP ]] && ZIP=`look_for_prog zip` |
1775 [[ -z $ZIP ]] && ZIP=`look_for_prog zip` |
2017 [[ -z $GETENT ]] && GETENT=`look_for_prog getent` |
1776 [[ -z $GETENT ]] && GETENT=`look_for_prog getent` |
2018 [[ -z $WGET ]] && WGET=`look_for_prog wget` |
1777 [[ -z $WGET ]] && WGET=`look_for_prog wget` |
2019 |
1778 |
2128 if [[ -n $pflag && -d $codemgr_parent/raw_files/new ]]; then |
1867 if [[ -n $pflag && -d $codemgr_parent/raw_files/new ]]; then |
2129 parent_webrev="$codemgr_parent" |
1868 parent_webrev="$codemgr_parent" |
2130 codemgr_parent="$codemgr_parent/raw_files/new" |
1869 codemgr_parent="$codemgr_parent/raw_files/new" |
2131 fi |
1870 fi |
2132 |
1871 |
2133 if [[ -z $wflag && -z $lflag ]]; then |
1872 shift $(($OPTIND - 1)) |
2134 shift $(($OPTIND - 1)) |
1873 |
2135 |
1874 if [[ $1 == "-" ]]; then |
2136 if [[ $1 == "-" ]]; then |
1875 cat > $FLIST |
2137 cat > $FLIST |
1876 flist_mode="stdin" |
2138 flist_mode="stdin" |
1877 flist_done=1 |
2139 flist_done=1 |
1878 shift |
2140 shift |
1879 elif [[ -n $1 ]]; then |
2141 elif [[ -n $1 ]]; then |
1880 if [[ ! -r $1 ]]; then |
2142 if [[ ! -r $1 ]]; then |
1881 print -u2 "$1: no such file or not readable" |
2143 print -u2 "$1: no such file or not readable" |
1882 usage |
2144 usage |
1883 fi |
2145 fi |
1884 cat $1 > $FLIST |
2146 cat $1 > $FLIST |
1885 flist_mode="file" |
2147 flist_mode="file" |
1886 flist_file=$1 |
2148 flist_file=$1 |
1887 flist_done=1 |
2149 flist_done=1 |
1888 shift |
2150 shift |
1889 else |
2151 else |
1890 flist_mode="auto" |
2152 flist_mode="auto" |
|
2153 fi |
|
2154 fi |
1891 fi |
2155 |
1892 |
2156 # |
1893 # |
2157 # Before we go on to further consider -l and -w, work out which SCM we think |
1894 # Before we go on to further consider -l and -w, work out which SCM we think |
2158 # is in use. |
1895 # is in use. |
2159 # |
1896 # |
2160 if [[ -z $SCM_MODE ]]; then |
1897 if [[ -z $SCM_MODE ]]; then |
2161 SCM_MODE=`detect_scm $FLIST` |
1898 SCM_MODE=`detect_scm $FLIST` |
2162 fi |
1899 fi |
2163 if [[ $SCM_MODE == "unknown" ]]; then |
1900 if [[ $SCM_MODE == "unknown" ]]; then |
2164 print -u2 "Unable to determine SCM type currently in use." |
1901 print -u2 "Unable to determine SCM type currently in use." |
2165 print -u2 "For teamware: webrev looks for \$CODEMGR_WS either in" |
1902 print -u2 "For mercurial: webrev runs 'hg root'." |
2166 print -u2 " the environment or in the file list." |
1903 exit 1 |
2167 print -u2 "For mercurial: webrev runs 'hg root'." |
|
2168 exit 1 |
|
2169 fi |
1904 fi |
2170 |
1905 |
2171 print -u2 " SCM detected: $SCM_MODE" |
1906 print -u2 " SCM detected: $SCM_MODE" |
2172 |
1907 |
2173 |
1908 |
2279 if [[ -z $PREV ]]; then |
2014 if [[ -z $PREV ]]; then |
2280 print "WARNING: parent rev is not tip. Maybe an update or merge is needed" |
2015 print "WARNING: parent rev is not tip. Maybe an update or merge is needed" |
2281 fi |
2016 fi |
2282 fi |
2017 fi |
2283 |
2018 |
2284 if [[ -n $lflag ]]; then |
2019 if [[ $flist_mode == "stdin" ]]; then |
2285 # |
|
2286 # If the -l flag is given instead of the name of a file list, |
|
2287 # then generate the file list by extracting file names from a |
|
2288 # putback -n. |
|
2289 # |
|
2290 shift $(($OPTIND - 1)) |
|
2291 if [[ $SCM_MODE == "teamware" ]]; then |
|
2292 flist_from_teamware "$*" |
|
2293 elif [[ $SCM_MODE == "mercurial" ]]; then |
|
2294 flist_from_mercurial |
|
2295 fi |
|
2296 flist_done=1 |
|
2297 shift $# |
|
2298 |
|
2299 elif [[ -n $wflag ]]; then |
|
2300 # |
|
2301 # If the -w is given then assume the file list is in Bonwick's "wx" |
|
2302 # command format, i.e. pathname lines alternating with SCCS comment |
|
2303 # lines with blank lines as separators. Use the SCCS comments later |
|
2304 # in building the index.html file. |
|
2305 # |
|
2306 shift $(($OPTIND - 1)) |
|
2307 wxfile=$1 |
|
2308 if [[ -z $wxfile && -n $CODEMGR_WS ]]; then |
|
2309 if [[ -r $CODEMGR_WS/wx/active ]]; then |
|
2310 wxfile=$CODEMGR_WS/wx/active |
|
2311 fi |
|
2312 fi |
|
2313 |
|
2314 [[ -z $wxfile ]] && print -u2 "wx file not specified, and could not " \ |
|
2315 "be auto-detected (check \$CODEMGR_WS)" && exit 1 |
|
2316 |
|
2317 print -u2 " File list from: wx 'active' file '$wxfile' ... \c" |
|
2318 flist_from_wx $wxfile |
|
2319 flist_done=1 |
|
2320 if [[ -n "$*" ]]; then |
|
2321 shift |
|
2322 fi |
|
2323 elif [[ $flist_mode == "stdin" ]]; then |
|
2324 print -u2 " File list from: standard input" |
2020 print -u2 " File list from: standard input" |
2325 elif [[ $flist_mode == "file" ]]; then |
2021 elif [[ $flist_mode == "file" ]]; then |
2326 print -u2 " File list from: $flist_file" |
2022 print -u2 " File list from: $flist_file" |
2327 fi |
2023 fi |
2328 |
2024 |
2329 if [[ $# -gt 0 ]]; then |
2025 if [[ $# -gt 0 ]]; then |
2330 print -u2 "WARNING: unused arguments: $*" |
2026 print -u2 "WARNING: unused arguments: $*" |
2331 fi |
2027 fi |
2332 |
2028 |
2333 if [[ $SCM_MODE == "teamware" ]]; then |
2029 if [[ $SCM_MODE == "mercurial" ]]; then |
2334 # |
|
2335 # Parent (internally $codemgr_parent) and workspace ($codemgr_ws) can |
|
2336 # be set in a number of ways, in decreasing precedence: |
|
2337 # |
|
2338 # 1) on the command line (only for the parent) |
|
2339 # 2) in the user environment |
|
2340 # 3) in the flist |
|
2341 # 4) automatically based on the workspace (only for the parent) |
|
2342 # |
|
2343 |
|
2344 # |
|
2345 # Here is case (2): the user environment |
|
2346 # |
|
2347 [[ -z $codemgr_ws && -n $CODEMGR_WS ]] && codemgr_ws=$CODEMGR_WS |
|
2348 [[ -z $codemgr_ws && -n $WSPACE ]] && codemgr_ws=`$WSPACE name` |
|
2349 |
|
2350 if [[ -n $codemgr_ws && ! -d $codemgr_ws ]]; then |
|
2351 print -u2 "$codemgr_ws: no such workspace" |
|
2352 exit 1 |
|
2353 fi |
|
2354 |
|
2355 [[ -z $codemgr_parent && -n $CODEMGR_PARENT ]] && \ |
|
2356 codemgr_parent=$CODEMGR_PARENT |
|
2357 |
|
2358 if [[ -n $codemgr_parent && ! -d $codemgr_parent ]]; then |
|
2359 print -u2 "$codemgr_parent: no such directory" |
|
2360 exit 1 |
|
2361 fi |
|
2362 |
|
2363 # |
|
2364 # If we're in auto-detect mode and we haven't already gotten the file |
|
2365 # list, then see if we can get it by probing for wx. |
|
2366 # |
|
2367 if [[ -z $flist_done && $flist_mode == "auto" && -n $codemgr_ws ]]; then |
|
2368 if [[ ! -x $WX ]]; then |
|
2369 print -u2 "WARNING: wx not found!" |
|
2370 fi |
|
2371 |
|
2372 # |
|
2373 # We need to use wx list -w so that we get renamed files, etc. |
|
2374 # but only if a wx active file exists-- otherwise wx will |
|
2375 # hang asking us to initialize our wx information. |
|
2376 # |
|
2377 if [[ -x $WX && -f $codemgr_ws/wx/active ]]; then |
|
2378 print -u2 " File list from: 'wx list -w' ... \c" |
|
2379 $WX list -w > $FLIST |
|
2380 $WX comments > /tmp/$$.wx_comments |
|
2381 wxfile=/tmp/$$.wx_comments |
|
2382 print -u2 "done" |
|
2383 flist_done=1 |
|
2384 fi |
|
2385 fi |
|
2386 |
|
2387 # |
|
2388 # If by hook or by crook we've gotten a file list by now (perhaps |
|
2389 # from the command line), eval it to extract environment variables from |
|
2390 # it: This is step (3). |
|
2391 # |
|
2392 env_from_flist |
|
2393 |
|
2394 # |
|
2395 # Continuing step (3): If we still have no file list, we'll try to get |
|
2396 # it from teamware. |
|
2397 # |
|
2398 if [[ -z $flist_done ]]; then |
|
2399 flist_from_teamware |
|
2400 env_from_flist |
|
2401 fi |
|
2402 |
|
2403 if [[ -z $codemgr_ws && -d $PWD/Codemgr_wsdata ]]; then |
|
2404 codemgr_ws=$PWD |
|
2405 fi |
|
2406 # |
|
2407 # Observe true directory name of CODEMGR_WS, as used later in |
|
2408 # webrev title. |
|
2409 # |
|
2410 if [[ -n $codemgr_ws ]]; then |
|
2411 codemgr_ws=$(cd $codemgr_ws;print $PWD) |
|
2412 fi |
|
2413 |
|
2414 if [[ -n $codemgr_parent ]]; then |
|
2415 codemgr_parent=$(cd $codemgr_parent;print $PWD) |
|
2416 fi |
|
2417 |
|
2418 # |
|
2419 # (4) If we still don't have a value for codemgr_parent, get it |
|
2420 # from workspace. |
|
2421 # |
|
2422 [[ -z $codemgr_parent && -n $WSPACE ]] && codemgr_parent=`$WSPACE parent` |
|
2423 [[ -z $codemgr_parent ]] && codemgr_parent=`parent_from_teamware $codemgr_ws` |
|
2424 |
|
2425 if [[ ! -d $codemgr_parent ]]; then |
|
2426 print -u2 "$CODEMGR_PARENT: no such parent workspace" |
|
2427 exit 1 |
|
2428 fi |
|
2429 |
|
2430 # |
|
2431 # Reset CODEMGR_WS to make sure teamware commands are happy. |
|
2432 # |
|
2433 CODEMGR_WS=$codemgr_ws |
|
2434 CWS=$codemgr_ws |
|
2435 PWS=$codemgr_parent |
|
2436 elif [[ $SCM_MODE == "mercurial" ]]; then |
|
2437 if [[ -z $flist_done ]]; then |
2030 if [[ -z $flist_done ]]; then |
2438 flist_from_mercurial $PWS |
2031 flist_from_mercurial $PWS |
2439 fi |
2032 fi |
2440 fi |
2033 fi |
2441 |
2034 |
2525 # |
2118 # |
2526 [[ ! $FLIST -ef $WDIR/file.list ]] && cp $FLIST $WDIR/file.list |
2119 [[ ! $FLIST -ef $WDIR/file.list ]] && cp $FLIST $WDIR/file.list |
2527 |
2120 |
2528 # |
2121 # |
2529 # Bug IDs will be replaced by a URL. Order of precedence |
2122 # Bug IDs will be replaced by a URL. Order of precedence |
2530 # is: default location, $WEBREV_BUGURL, the -O flag. |
2123 # is: default location, $WEBREV_BUGURL |
2531 # |
2124 # |
2532 BUGURL='https://bugs.openjdk.java.net/browse/' |
2125 BUGURL='https://bugs.openjdk.java.net/browse/' |
2533 [[ -n $WEBREV_BUGURL ]] && BUGURL="$WEBREV_BUGURL" |
2126 [[ -n $WEBREV_BUGURL ]] && BUGURL="$WEBREV_BUGURL" |
2534 if [[ -n "$Oflag" ]]; then |
2127 IDPREFIX='JDK-' |
2535 CRID=`echo $CRID | sed -e 's/JDK-//'` |
2128 |
2536 BUGURL='http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=' |
|
2537 IDPREFIX='' |
|
2538 else |
|
2539 IDPREFIX='JDK-' |
|
2540 fi |
|
2541 |
|
2542 |
|
2543 # |
|
2544 # Likewise, ARC cases will be replaced by a URL. Order of precedence |
|
2545 # is: default, $WEBREV_SACURL, the -O flag. |
|
2546 # |
|
2547 # Note that -O also triggers different substitution behavior for |
|
2548 # SACURL. See sac2url(). |
|
2549 # |
|
2550 SACURL='http://sac.eng.sun.com' |
|
2551 [[ -n $WEBREV_SACURL ]] && SACURL="$WEBREV_SACURL" |
|
2552 [[ -n $Oflag ]] && \ |
|
2553 SACURL='http://www.opensolaris.org/os/community/arc/caselog' |
|
2554 |
2129 |
2555 rm -f $WDIR/$WNAME.patch |
2130 rm -f $WDIR/$WNAME.patch |
2556 rm -f $WDIR/$WNAME.changeset |
2131 rm -f $WDIR/$WNAME.changeset |
2557 rm -f $WDIR/$WNAME.ps |
2132 rm -f $WDIR/$WNAME.ps |
2558 rm -f $WDIR/$WNAME.pdf |
2133 rm -f $WDIR/$WNAME.pdf |
2966 print "<div class=\"summary\">" |
2527 print "<div class=\"summary\">" |
2967 print "<h2>Code Review for $WNAME</h2>" |
2528 print "<h2>Code Review for $WNAME</h2>" |
2968 |
2529 |
2969 print "<table>" |
2530 print "<table>" |
2970 |
2531 |
2971 if [[ -z $uflag ]] |
2532 if [[ -z $uflag ]]; then |
2972 then |
2533 if [[ $SCM_MODE == "mercurial" ]]; then |
2973 if [[ $SCM_MODE == "mercurial" ]] |
|
2974 then |
|
2975 # |
2534 # |
2976 # Let's try to extract the user name from the .hgrc file |
2535 # Let's try to extract the user name from the .hgrc file |
2977 # |
2536 # |
2978 username=`grep '^username' $HOME/.hgrc | sed 's/^username[ ]*=[ ]*\(.*\)/\1/'` |
2537 username=`grep '^username' $HOME/.hgrc | sed 's/^username[ ]*=[ ]*\(.*\)/\1/'` |
2979 fi |
2538 fi |
2980 |
2539 |
2981 if [[ -z $username ]] |
2540 if [[ -z $username ]]; then |
2982 then |
|
2983 # |
2541 # |
2984 # Figure out the username and gcos name. To maintain compatibility |
2542 # Figure out the username and gcos name. To maintain compatibility |
2985 # with passwd(4), we must support '&' substitutions. |
2543 # with passwd(4), we must support '&' substitutions. |
2986 # |
2544 # |
2987 username=`id | cut -d '(' -f 2 | cut -d ')' -f 1` |
2545 username=`id | cut -d '(' -f 2 | cut -d ')' -f 1` |
3045 print "<tr><th>Author comments:</th><td><div>" |
2603 print "<tr><th>Author comments:</th><td><div>" |
3046 cat /tmp/$$.include |
2604 cat /tmp/$$.include |
3047 print "</div></td></tr>" |
2605 print "</div></td></tr>" |
3048 fi |
2606 fi |
3049 # Add links to referenced CRs, if any |
2607 # Add links to referenced CRs, if any |
3050 # external URL has a <title> like: |
2608 # URL has a <title> like: |
3051 # <title>Bug ID: 6641309 Wrong Cookie separator used in HttpURLConnection</title> |
2609 # <title>[#JDK-8024688] b106-lambda: j.u.Map.merge doesn't work as specified if contains key:null pair - Java Bug System</title> |
3052 # while internal URL has <title> like: |
2610 # we format this to: |
3053 # <title>[#JDK-6641309] Wrong Cookie separator used in HttpURLConnection</title> |
2611 # JDK-8024688: b106-lambda: j.u.Map.merge doesn't work as specified if contains key:null pair |
3054 # |
|
3055 if [[ -n $CRID ]]; then |
2612 if [[ -n $CRID ]]; then |
3056 for id in $CRID |
2613 for id in $CRID |
3057 do |
2614 do |
3058 if [[ -z "$Oflag" ]]; then |
2615 #add "JDK-" to raw bug id for openjdk.java.net links. |
3059 #add "JDK-" to raw bug id for openjdk.java.net links. |
2616 id=`echo ${id} | sed 's/^\([0-9]\{5,\}\)$/JDK-\1/'` |
3060 id=`echo ${id} | sed 's/^\([0-9]\{5,\}\)$/JDK-\1/'` |
2617 |
3061 fi |
|
3062 print "<tr><th>Bug id:</th><td>" |
2618 print "<tr><th>Bug id:</th><td>" |
3063 url="${BUGURL}${id}" |
2619 url="${BUGURL}${id}" |
3064 if [[ -n "$Oflag" ]]; then |
2620 |
3065 cleanup='s/Bug ID: \([0-9]\{5,\}\) \(.*\)/JDK-\1 : \2/' |
|
3066 else |
|
3067 cleanup='s|\[#\(JDK-[0-9]\{5,\}\)\] \(.*\)|\1 : \2|' |
|
3068 fi |
|
3069 if [[ -n $WGET ]]; then |
2621 if [[ -n $WGET ]]; then |
3070 msg=`$WGET --timeout=10 --tries=1 -q $url -O - | grep '<title>' | sed 's/<title>\(.*\)<\/title>/\1/' | sed "$cleanup" | html_quote` |
2622 msg=`$WGET --timeout=10 --tries=1 -q $url -O - | grep '<title>' | sed 's/<title>\[#\(.*\)\] \(.*\) - Java Bug System<\/title>/\1 : \2/' | html_dequote | html_quote` |
3071 fi |
2623 fi |
3072 if [[ -z $msg ]]; then |
2624 if [[ -z $msg ]]; then |
3073 msg="${id}" |
2625 msg="${id}" |
3074 fi |
2626 fi |
3075 |
2627 |