make/scripts/webrev.ksh

changeset 690
b95c5c8ee60a
parent 678
26a4456cb19e
child 792
67f64101616e
equal deleted inserted replaced
689:7da551071fe8 690:b95c5c8ee60a
25 # This script takes a file list and a workspace and builds a set of html files 25 # This script takes a file list and a workspace and builds a set of html files
26 # suitable for doing a code review of source changes via a web page. 26 # suitable for doing a code review of source changes via a web page.
27 # Documentation is available via 'webrev -h'. 27 # Documentation is available via 'webrev -h'.
28 # 28 #
29 29
30 WEBREV_UPDATED=23.18-hg+jbs 30 WEBREV_UPDATED=24.0-hg+jbs
31 31
32 HTML='<?xml version="1.0"?> 32 HTML='<?xml version="1.0"?>
33 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 33 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
34 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 34 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
35 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n' 35 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n'
1441 HG_LIST_FROM_COMMIT=1 1441 HG_LIST_FROM_COMMIT=1
1442 fi 1442 fi
1443 if [ ! -f $FLIST ]; then 1443 if [ ! -f $FLIST ]; then
1444 # hg commit hasn't been run see what is lying around 1444 # hg commit hasn't been run see what is lying around
1445 print "\n No outgoing, perhaps you haven't commited." 1445 print "\n No outgoing, perhaps you haven't commited."
1446 NO_OUTGOING=
1447 print " File list from hg fstatus -mard ...\c" 1446 print " File list from hg fstatus -mard ...\c"
1448 FSTAT_OPT= 1447 FSTAT_OPT=
1449 fstatus 1448 fstatus
1450 HG_LIST_FROM_COMMIT=0 1449 HG_LIST_FROM_COMMIT=
1451 fi 1450 fi
1452 print " Done." 1451 print " Done."
1453 } 1452 }
1454 1453
1455 # 1454 #
1627 elif [[ -n $OUTREV ]]; then 1626 elif [[ -n $OUTREV ]]; then
1628 STATUS_REV="--rev $OUTREV" 1627 STATUS_REV="--rev $OUTREV"
1629 else 1628 else
1630 # hg commit hasn't been run see what is lying around 1629 # hg commit hasn't been run see what is lying around
1631 print "\n No outgoing, perhaps you haven't commited." 1630 print "\n No outgoing, perhaps you haven't commited."
1632 NO_OUTGOING=
1633 fi 1631 fi
1634 # First let's list all the modified or deleted files 1632 # First let's list all the modified or deleted files
1635 1633
1636 hg status $STATUS_REV -mdn | $FILTER > $FLIST 1634 hg status $STATUS_REV -mdn | $FILTER > $FLIST
1637 1635
2110 ?) usage;; 2108 ?) usage;;
2111 esac 2109 esac
2112 done 2110 done
2113 2111
2114 FLIST=/tmp/$$.flist 2112 FLIST=/tmp/$$.flist
2113 HG_LIST_FROM_COMMIT=
2115 2114
2116 if [[ -n $wflag && -n $lflag ]]; then 2115 if [[ -n $wflag && -n $lflag ]]; then
2117 usage 2116 usage
2118 fi 2117 fi
2119 2118
2552 [[ -n $WEBREV_SACURL ]] && SACURL="$WEBREV_SACURL" 2551 [[ -n $WEBREV_SACURL ]] && SACURL="$WEBREV_SACURL"
2553 [[ -n $Oflag ]] && \ 2552 [[ -n $Oflag ]] && \
2554 SACURL='http://www.opensolaris.org/os/community/arc/caselog' 2553 SACURL='http://www.opensolaris.org/os/community/arc/caselog'
2555 2554
2556 rm -f $WDIR/$WNAME.patch 2555 rm -f $WDIR/$WNAME.patch
2556 rm -f $WDIR/$WNAME.changeset
2557 rm -f $WDIR/$WNAME.ps 2557 rm -f $WDIR/$WNAME.ps
2558 rm -f $WDIR/$WNAME.pdf 2558 rm -f $WDIR/$WNAME.pdf
2559 2559
2560 touch $WDIR/$WNAME.patch 2560 touch $WDIR/$WNAME.patch
2561 2561
2781 # [to del a file] @@ -X,Y +1,0 @@ --> @@ -X,Y +0,0 @@ 2781 # [to del a file] @@ -X,Y +1,0 @@ --> @@ -X,Y +0,0 @@
2782 # 2782 #
2783 cleanse_rmfile="sed 's/^\(@@ [0-9+,-]*\) [0-9+,-]* @@$/\1 +0,0 @@/'" 2783 cleanse_rmfile="sed 's/^\(@@ [0-9+,-]*\) [0-9+,-]* @@$/\1 +0,0 @@/'"
2784 cleanse_newfile="sed 's/^@@ [0-9+,-]* \([0-9+,-]* @@\)$/@@ -0,0 \1/'" 2784 cleanse_newfile="sed 's/^@@ [0-9+,-]* \([0-9+,-]* @@\)$/@@ -0,0 \1/'"
2785 2785
2786 if [[ -v NO_OUTGOING ]]; 2786 if [[ ! "$HG_LIST_FROM_COMMIT" -eq 1 || ! $flist_mode == "auto" ]];
2787 then 2787 then
2788 # Only need to generate a patch file here if there are no commits in outgoing 2788 # Only need to generate a patch file here if there are no commits in outgoing
2789 # or if we've specified a file list
2789 rm -f $WDIR/$DIR/$F.patch 2790 rm -f $WDIR/$DIR/$F.patch
2790 if [[ -z $rename ]]; then 2791 if [[ -z $rename ]]; then
2791 if [ ! -f $ofile ]; then 2792 if [ ! -f $ofile ]; then
2792 diff -u /dev/null $nfile | sh -c "$cleanse_newfile" \ 2793 diff -u /dev/null $nfile | sh -c "$cleanse_newfile" \
2793 > $WDIR/$DIR/$F.patch 2794 > $WDIR/$DIR/$F.patch
2907 print 2908 print
2908 done < $FLIST 2909 done < $FLIST
2909 2910
2910 # Create the new style mercurial patch here using hg export -r [all-revs] -g -o $CHANGESETPATH 2911 # Create the new style mercurial patch here using hg export -r [all-revs] -g -o $CHANGESETPATH
2911 if [[ $SCM_MODE == "mercurial" ]]; then 2912 if [[ $SCM_MODE == "mercurial" ]]; then
2912 if [[ !(-v NO_OUTGOING) ]]; then 2913 if [[ "$HG_LIST_FROM_COMMIT" -eq 1 && $flist_mode == "auto" ]]; then
2913 EXPORTCHANGESET="$WNAME.changeset" 2914 EXPORTCHANGESET="$WNAME.changeset"
2914 CHANGESETPATH=${WDIR}/${EXPORTCHANGESET} 2915 CHANGESETPATH=${WDIR}/${EXPORTCHANGESET}
2915 rm -f $CHANGESETPATH 2916 rm -f $CHANGESETPATH
2916 touch $CHANGESETPATH 2917 touch $CHANGESETPATH
2917 if [[ -n $ALL_CREV ]]; then 2918 if [[ -n $ALL_CREV ]]; then
2923 rev_opt="--rev $FIRST_CREV" 2924 rev_opt="--rev $FIRST_CREV"
2924 fi 2925 fi
2925 2926
2926 if [[ -n $rev_opt ]]; then 2927 if [[ -n $rev_opt ]]; then
2927 (cd $CWS;hg export -g $rev_opt -o $CHANGESETPATH) 2928 (cd $CWS;hg export -g $rev_opt -o $CHANGESETPATH)
2928 # echo "Created new-patch: $CHANGESETPATH" 1>&2 2929 echo "Created changeset: $CHANGESETPATH" 1>&2
2929 # Use it in place of the jdk.patch created above 2930 # Use it in place of the jdk.patch created above
2930 rm -f $WDIR/$WNAME.patch 2931 rm -f $WDIR/$WNAME.patch
2931 fi 2932 fi
2932 set +x 2933 set +x
2933 fi 2934 fi

mercurial