From d7b56f414df5eecc5f2cc64674bb2a4be951082d Mon Sep 17 00:00:00 2001 From: Bart Coddens Date: Fri, 7 Feb 2014 16:55:38 +0100 Subject: [PATCH] 3810 remove support for teamware from webrev Reviewed by: Andrew Stormont Reviewed by: Garrett D'Amore Approved by: Robert Mustacchi --- usr/src/tools/scripts/webrev.1 | 46 +------ usr/src/tools/scripts/webrev.sh | 292 ++-------------------------------------- 2 files changed, 11 insertions(+), 327 deletions(-) diff --git a/usr/src/tools/scripts/webrev.1 b/usr/src/tools/scripts/webrev.1 index 566ce1e959..d970157275 100644 --- a/usr/src/tools/scripts/webrev.1 +++ b/usr/src/tools/scripts/webrev.1 @@ -22,7 +22,7 @@ .\" Use is subject to license terms. .\" .\" -.TH webrev 1 "6 Dec 2010" +.TH webrev 1 "7 Feb 2014" .SH NAME webrev \- Generate HTML codereview materials .SH SYNOPSIS @@ -46,29 +46,18 @@ webrev \- Generate HTML codereview materials .B -w .I wx-file -.B webrev -[ -.I common-options -] -.B -l -.I arguments to 'putback' - -See OPTIONS for common-options. -Note that the -l option is only applicable to TeamWare workspaces. - .SH DESCRIPTION .B webrev builds a set of HTML files suitable for performing code review of source changes in a web browser. -It supports Mercurial, Git, Subversion and Teamware repositories. +It supports Mercurial, Git and Subversion repositories. At its most basic, usage is: .nf $ webrev .fi In which case \fBwebrev\fR attempts to figure out the list of files -for review (note that when using Teamware \fBputback\fR, this may take -a long time; see the -l option). If that fails, or if more control +for review. If that fails, or if more control over the set of files is needed, a \fIfile list\fR may be specified. \fBwebrev\fR also attempts to deduce a .I basis for comparison @@ -151,25 +140,6 @@ makes use of .BR which_scm (1) to determine the SCM in use for a given workspace. -.SS TeamWare -In the case of TeamWare \fBwebrev\fR will use the output of "workspace -name" to discover the workspace root, if not otherwise specified. -.PP -\fBwebrev\fR will attempt to use a -.BR wx (1) -active list in -\fBCODEMGR_WS/wx/active\fR. -To direct \fBwebrev\fR to determine the file list from the output of -.BR putback "(1)," -use the -l option. (Note that \fBwebrev\fR may also elect to use -\fBputback\fR if it cannot determine the file list from -.BR wx "(1))." -The -l option indicates that subsequent arguments should be -treated as arguments to -.BR putback "(1)." -This can be used to prune the set of files which putback examines, -or to reference a teamware flp (file list program). - .SS Mercurial In the case of Mercurial \fBwebrev\fR will attempt to use the output from the @@ -237,14 +207,6 @@ as part of the webrev. This allows a snippet of XHTML to be added by the webrev author. User content is contained by a
tag and the markup should validate as XHTML 1.0 Transitional. .TP 10 -.BI "-l " putback-args -Extract the file list from the output of -.I putback -n. -Any arguments supplied will be passed to -.BR putback "(1)." -See SCM INTERACTIONS. For more information about file -lists, see FILE LIST. This argument should appear last. -.TP 10 .BI "-N" Suppress all comments from all output forms html, txt and pdf. .TP 10 @@ -468,8 +430,6 @@ For the nested directory case it is necessary to specify the full target: This will remove just the \fIbugfix.onnv\fR directory. .SH SEE ALSO -.BR putback "(1)," -.BR workspace "(1)," .BR hg "(1)," .BR git "(1)," .BR ssh_config "(4)," diff --git a/usr/src/tools/scripts/webrev.sh b/usr/src/tools/scripts/webrev.sh index 7df8aa8b52..25acbf5d4c 100644 --- a/usr/src/tools/scripts/webrev.sh +++ b/usr/src/tools/scripts/webrev.sh @@ -26,6 +26,7 @@ # Copyright 2008, 2010, Richard Lowe # Copyright 2012 Marcel Telka +# Copyright 2014 Bart Coddens # # This script takes a file list and a workspace and builds a set of html files @@ -1432,55 +1433,6 @@ source_to_html() } # -# comments_from_teamware {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 - - if [[ ! -f $PWS/${2%/*}/SCCS/s.${2##*/} && -n $RWS ]]; then - pfile=$RWS/$2 - fi - - if [[ -f $pfile ]]; then - psid=$($SCCS prs -d:I: $pfile 2>/dev/null) - else - psid=1.1 - fi - - set -A sids $($SCCS prs -l -r$psid -d:I: $cfile 2>/dev/null) - N=${#sids[@]} - - nawkprg=' - /^COMMENTS:/ {p=1; continue} - /^D [0-9]+\.[0-9]+/ {printf "--- %s ---\n", $2; p=0; } - NF == 0u { continue } - {if (p==0) continue; 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 | its2url | $AWK "$nawkprg" - fi -} - -# # comments_from_wx {text|html} filepath # # Given the pathname of a file, find its location in a "wx" active @@ -1536,10 +1488,6 @@ getcomments() # if [[ -n $wxfile ]]; then comments_from_wx $fmt $p - else - if [[ $SCM_MODE == "teamware" ]]; then - comments_from_teamware $fmt $pp $p - fi fi } @@ -1718,44 +1666,6 @@ function flist_from_wx } # -# flist_from_teamware [ ] -# -# 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 && -z $parent_webrev ]]; 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; continue} - NF == 0 {p=0 ; continue} - /^rename/ {old=$3} - $1 == "to:" {print $2, old} - /^"/ {continue} - p == 1 {print $1}' | - sort -r -k 1,1 -u | sort > $FLIST - - print " Done." -} - -# # Call hg-active to get the active list output in the wx active list format # function hg_active_wxfile @@ -1916,7 +1826,7 @@ function look_for_prog ppath=$PATH ppath=$ppath:/usr/sfw/bin:/usr/bin:/usr/sbin - ppath=$ppath:/opt/teamware/bin:/opt/onbld/bin + ppath=$ppath:/opt/onbld/bin ppath=$ppath:/opt/onbld/bin/`uname -p` PATH=$ppath prog=`whence $progname` @@ -1938,78 +1848,6 @@ function get_file_mode ' $1 } -function build_old_new_teamware -{ - typeset olddir="$1" - typeset newdir="$2" - - # If the child's version doesn't exist then - # get a readonly copy. - - if [[ ! -f $CWS/$DIR/$F && -f $CWS/$DIR/SCCS/s.$F ]]; then - $SCCS get -s -p $CWS/$DIR/$F > $CWS/$DIR/$F - fi - - # The following two sections propagate file permissions the - # same way SCCS does. If the file is already under version - # control, always use permissions from the SCCS/s.file. If - # the file is not under SCCS control, use permissions from the - # working copy. In all cases, the file copied to the webrev - # is set to read only, and group/other permissions are set to - # match those of the file owner. This way, even if the file - # is currently checked out, the webrev will display the final - # permissions that would result after check in. - - # - # Snag new version of file. - # - rm -f $newdir/$DIR/$F - cp $CWS/$DIR/$F $newdir/$DIR/$F - if [[ -f $CWS/$DIR/SCCS/s.$F ]]; then - chmod `get_file_mode $CWS/$DIR/SCCS/s.$F` \ - $newdir/$DIR/$F - fi - chmod u-w,go=u $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/$PF && ! -f $PWS/$PDIR/SCCS/s.$PF && \ - ! -f $PWS/$PDIR/SCCS/p.$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/$PDIR/$PF - cp $PWS/$PDIR/$PF $olddir/$PDIR/$PF - else - if [[ -f $PWS/$PDIR/SCCS/s.$PF ]]; then - real_parent=$PWS - else - real_parent=$RWS - fi - - rm -f $olddir/$PDIR/$PF - - if [[ -f $real_parent/$PDIR/$PF ]]; then - if [ -f $CWS/$DIR/SCCS/p.$F ]; then - $SCCS get -s -p -k $real_parent/$PDIR/$PF > \ - $olddir/$PDIR/$PF - else - $SCCS get -s -p $real_parent/$PDIR/$PF > \ - $olddir/$PDIR/$PF - fi - chmod `get_file_mode $real_parent/$PDIR/SCCS/s.$PF` \ - $olddir/$PDIR/$PF - fi - fi - if [[ -f $olddir/$PDIR/$PF ]]; then - chmod u-w,go=u $olddir/$PDIR/$PF - fi -} - function build_old_new_mercurial { typeset olddir="$1" @@ -2200,9 +2038,7 @@ function build_old_new mkdir -p $olddir/$PDIR mkdir -p $newdir/$DIR - if [[ $SCM_MODE == "teamware" ]]; then - build_old_new_teamware "$olddir" "$newdir" - elif [[ $SCM_MODE == "mercurial" ]]; then + if [[ $SCM_MODE == "mercurial" ]]; then build_old_new_mercurial "$olddir" "$newdir" elif [[ $SCM_MODE == "git" ]]; then build_old_new_git "$olddir" "$newdir" @@ -2246,9 +2082,6 @@ Environment: WDIR: Control the output directory. WEBREV_TRASH_DIR: Set directory for webrev delete. -SCM Specific Options: - TeamWare: webrev [common-options] -l [arguments to 'putback'] - SCM Environment: CODEMGR_WS: Workspace location. CODEMGR_PARENT: Parent workspace location. @@ -2358,14 +2191,6 @@ do I) Iflag=1 ITSREG=$OPTARG;; - # - # 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;; - N) Nflag=1;; n) nflag=1;; @@ -2415,22 +2240,7 @@ fi # logic. # $WHICH_SCM | read SCM_MODE junk || exit 1 -if [[ $SCM_MODE == "teamware" ]]; then - # - # Teamware priorities: - # 1. CODEMGR_WS from the environment - # 2. workspace name - # - [[ -z $codemgr_ws && -n $CODEMGR_WS ]] && codemgr_ws=$CODEMGR_WS - if [[ -n $codemgr_ws && ! -d $codemgr_ws ]]; then - print -u2 "$codemgr_ws: no such workspace" - exit 1 - fi - [[ -z $codemgr_ws ]] && codemgr_ws=$(workspace name) - codemgr_ws=$(cd $codemgr_ws;print $PWD) - CODEMGR_WS=$codemgr_ws - CWS=$codemgr_ws -elif [[ $SCM_MODE == "mercurial" ]]; then +if [[ $SCM_MODE == "mercurial" ]]; then # # Mercurial priorities: # 1. hg root from CODEMGR_WS environment variable @@ -2556,7 +2366,7 @@ fi # is in use. # case "$SCM_MODE" in -teamware|mercurial|git|subversion) +mercurial|git|subversion) ;; unknown) if [[ $flist_mode == "auto" ]]; then @@ -2575,22 +2385,7 @@ esac print -u2 " SCM detected: $SCM_MODE" -if [[ -n $lflag ]]; 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 "$*" - else - print -u2 -- "Error: -l option only applies to TeamWare" - exit 1 - fi - flist_done=1 - shift $# -elif [[ -n $wflag ]]; then +if [[ -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 @@ -2633,77 +2428,7 @@ fi # Before we entered the DO_EVERYTHING loop, we should have already set CWS # and CODEMGR_WS as needed. Here, we set the parent workspace. # - -if [[ $SCM_MODE == "teamware" ]]; then - - # - # Teamware priorities: - # - # 1) via -p command line option - # 2) in the user environment - # 3) in the flist - # 4) automatically based on the workspace - # - - # - # For 1, codemgr_parent will already be set. Here's 2: - # - [[ -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 method 3 for finding the parent. - # - if [[ -z $flist_done ]]; then - flist_from_teamware - fi - env_from_flist - - # - # (4) If we still don't have a value for codemgr_parent, get it - # from workspace. - # - [[ -z $codemgr_parent ]] && codemgr_parent=`workspace parent` - if [[ ! -d $codemgr_parent ]]; then - print -u2 "$CODEMGR_PARENT: no such parent workspace" - exit 1 - fi - - PWS=$codemgr_parent - - [[ -n $parent_webrev ]] && RWS=$(workspace parent $CWS) - -elif [[ $SCM_MODE == "mercurial" ]]; then +if [[ $SCM_MODE == "mercurial" ]]; then # # Parent can either be specified with -p # Specified with CODEMGR_PARENT in the environment @@ -3683,8 +3408,7 @@ do rm $F.count fi - if [[ $SCM_MODE == "teamware" || - $SCM_MODE == "mercurial" || + if [[ $SCM_MODE == "mercurial" || $SCM_MODE == "unknown" ]]; then # Include warnings for important file mode situations: -- 2.11.4.GIT