Rev 1295 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><HTML><HEAD><TITLE>Creating a new Topic</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINKREL="HOME"TITLE="The Codestriker Guide"HREF="book1.html"><LINKREL="UP"TITLE="User's Guide"HREF="c333.html"><LINKREL="PREVIOUS"TITLE="Creating a new Project"HREF="x370.html"><LINKREL="NEXT"TITLE="Reviewing Topics"HREF="x504.html"></HEAD><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">The Codestriker Guide: Version 1.9.3</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="x370.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 3. User's Guide</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="x504.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="CREATE-TOPIC">3.4. Creating a new Topic</A></H1><P> The "Create topic" screen can be accessed from a number ofother screens, and requires the submission of a number ofdetails in order to create a topic. A screenshot can be seenin <AHREF="x394.html#FIGURE-CREATE-TOPIC">Figure 3-4</A>. It is also possibleto create a new topic which obsoletes a number of other topicsvia the "Obsolete Topics" button on the topic list screen (see<AHREF="x339.html">Section 3.2</A>). This is normally done when areview has many comments, and a new review (which obsoletesthe old review) needs to be created which has addressed thesecomments. It is also possible to generate new topics from thecommand line. Check out the<TTCLASS="FILENAME">SubmitCodeReview.pl</TT> script in the<TTCLASS="FILENAME">bin</TT> directory in the Codestrikerdistribution.<DIVCLASS="FIGURE"><ANAME="FIGURE-CREATE-TOPIC"></A><P><B>Figure 3-4. Create Topic Screenshot</B></P><DIVCLASS="MEDIAOBJECT"><P><IMGSRC="createtopic.png"></P></DIV></DIV></P><P> The topic title is a mandatory field which contains a one-linesummary of the topic. This title is used when the topic isdisplayed in the "Topic list" screen (see <AHREF="x339.html">Section 3.2</A>). The topic description contains a moredetailed description of the review itself, and should be enoughfor a reviewer to understand the purpose of the review. IfCodestriker is linked to a bug tracking system, further down inthe form, the "Bug IDs" field gives the opportunity to enterin multiple bug ids (either space or comma separated), whichwill also give the reviewer an opportunity to see what bugsthis review fixes.</P><P> The "Project" dropdown list should be selected onto theproject this review belongs to. The last three fields containcomma-separated email addresses. The "Your email address"field contains the email address which will receive reviewcomments. This is typically, the author's email address. The"Reviewers" field contains the list of reviewer email addresswhich will be notified once the review is created. The "Cc"field is typically used for notifying a group email list thata new review has been created. These field values are storedinto your browser's cookie, so that the next time a review iscreated, these fields will be pre-filled, as they don'ttypically change much between different reviews.</P><P> The most complex part of this form are the values required forthe "Topic text upload", "Start tag", "End tag", "Module" and"Repository" fields. These fields dictate what the actualreview text is. The first step is to select what sourcecontrol management system the review was made against, andupdating the "Repository" field accordingly. The followingsub-sections detail the different review inputs that can behandled. Once all the details have been entered, and the"Submit" button is pressed, a confirmation screen will come upindicating that the review has been created. An email, witha URL to view the topic will be sent to the author, reviewersand any email addresses entered in the "Cc" field.</P><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN412">3.4.1. Creating CVS Diff Topics</A></H2><P> For CVS projects, a common situation is you have a checkoutof your project's module, and you have fixed a bug whichneeds to be reviewed. To get this reviewed in Codestriker,you need to generate the review text, by going to thetop-level directory of your checkout, and issuing a commandlike:<PRECLASS="PROGRAMLISTING">% cvs diff -uN > /tmp/review.txt</PRE>This command creates a diff file, which consists of the codechanges you have made since you checked out the project fromCVS. The <CODECLASS="OPTION">-u</CODE> option indicates to create a"unidiff" formatted file, which is what Codestriker canparse. The <CODECLASS="OPTION">-N</CODE> option means to show addedand removed files. Depending on your development process,you may want to issue different cvs diff commands withdifferent flags, or even using "cvs rdiff" instead.Codestriker can accept any input, as long as<CODECLASS="OPTION">-u</CODE> is specified, to ensure the diff is inunidiff format. Note for reviews which include C/C++ code,you can also include the<CODECLASS="OPTION">--show-function-line</CODE> and/or<CODECLASS="OPTION">--show-c-function</CODE> options, which willindicate for each diff delta in the display, what functionis being modified.</P><P> This filename can either be entered directly into the "Topictext upload" field, or selected from a file dialog which iscreated when the "Browse" button is pressed. The "Starttag", "End tag" and "Module" fields can be left blank. Onceall the other fields have been entered, clicking the"Submit" button will create the review, and show aconfirmation screen.</P><P> In some development processes, CVS tags are used to markunits of work that have been applied to the repository.Rather than generating the review text via a CVS command, asspecified in the previously, the review text can bespecified by entering in the "Start tag", "End tag" and"Module" name into their respective fields. Codestrikerwill then fetch the review text from the nominatedrepository automatically, by executing the appropriate CVScommand itself.</P><P> Alternatively, Codestriker can also accept CVS diffs ofalready committed code from commands such as:<PRECLASS="PROGRAMLISTING">% cvs rdiff -uN -r START_TAG -r END_TAG MODULE</PRE>Where START_TAG, END_TAG and MODULE are substituted withappropriate values. Note this is no different to whatCodestriker does when values are entered into the "Starttag", "End Tag" and "Module" fields when creating a topic.</P><P> If you want to review code in its full form as it exists inthe repository for a specific tag value, you only need tospecify this tag value in either the START_TAG<SPANCLASS="emphasis"><ICLASS="EMPHASIS">or</I></SPAN> END_TAG field, and an appropriatevalue in the MODULE field. Codestriker will fetch all ofthe source files for this module and tag into the topic, andtreat all of the files as "new" (ie, no diffs). This is nodifferent to executing the following command to generate adiff:<PRECLASS="PROGRAMLISTING">% cvs rdiff -uN -r 1.0 -r TAG MODULE</PRE></P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN428">3.4.2. Creating CVS Diff Topics Automatically</A></H2><P> Depending on your development process, it may be moreconvenient for CVS to automatically create a Codestrikertopic <SPANCLASS="emphasis"><ICLASS="EMPHASIS">automatically</I></SPAN> whenever a commitoccurs. The benefit with this approach is developers don'tneed to explicitly create code reviews. A "code reviewer"can then monitor all commits to the repository, and has theopportunity to send comments to the authors if they spot anyissues that need addressing.</P><P> The standard <TTCLASS="FILENAME">commit_prep.pl</TT> and<TTCLASS="FILENAME">log_accum.pl</TT> scripts from CVS have beenmodified so that the email which is sent after each commitwhich contains the diff of the commit, also includes the URLof the associated Codestriker topic that was created.<SPANCLASS="emphasis"><ICLASS="EMPHASIS">Unfortunately, these scripts can only be executedon the UNIX platform.</I></SPAN></P><P> The <TTCLASS="FILENAME">commit_prep.pl</TT> and<TTCLASS="FILENAME">log_accum.pl</TT> files are located in theCodestriker <TTCLASS="FILENAME">bin</TT> directory, and need tobe copied into your <TTCLASS="FILENAME">CVSROOT</TT> directory,with a line like the following in your<TTCLASS="FILENAME">commitinfo</TT> file (read the comment inthis file to set this correctly for your site):<PRECLASS="PROGRAMLISTING">DEFAULT $CVSROOT/CVSROOT/commit_prep.pl -r</PRE>and a line like the following in your<TTCLASS="FILENAME">loginfo</TT> file (read the comment in thisfile to set this correctly for your site):<PRECLASS="PROGRAMLISTING">DEFAULT $CVSROOT/CVSROOT/log_accum.pl %s</PRE>The <TTCLASS="FILENAME">log_accum.pl</TT> file needs to havesome configuration variables set at the start of the scriptto reflect your site. You will also need to make sure youcreate a <TTCLASS="FILENAME">$CVSROOT/CVSROOT/commitlogs</TT>directory with the appropriate user-writable permissions,as commit information is written here as a result of thesescripts running.</P><P> Note the first line of the log message will be used as thetopic title. The entire log message is used as the topicdescription. Any strings of the form "Bug nnn" in the logmessage will be taken as a reference to a bug id, and willbe used in the topic's bugid field.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN448">3.4.3. Creating Diff Topics</A></H2><P> In some deployments, there may not even be a source controlmanagement system, and it might be the case that only diffsare reviewed. An example command to generate the reviewtext could be something like:<PRECLASS="PROGRAMLISTING">% diff -urN ../old-version/ . > /tmp/review.txt</PRE>Like the CVS command shown above, the <CODECLASS="OPTION">-u</CODE>and <CODECLASS="OPTION">-N</CODE> options are specified to output aunidiff file, which contains new and old files. The<CODECLASS="OPTION">-r</CODE> option indicates to recursively checkthe source and target directories specified (in this case<TTCLASS="FILENAME">../old-version</TT> and<TTCLASS="FILENAME">.</TT> to find differences. There arelikely to be other options that will be specified, run<BCLASS="COMMAND">man diff</B> for more options. Note forreviews which include C/C++ code, you can also include the<CODECLASS="OPTION">--show-function-line</CODE> and/or<CODECLASS="OPTION">--show-c-function</CODE> options, which willindicate for each diff delta in the display, what functionis being modified.</P><P> The "Start tag", "End tag" and "Module" fields have norelevance in this situation.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN461">3.4.4. Creating Plain Text Topics</A></H2><P> It is also possible to use Codestriker to simply review textthat is not in the form as a diff. In this situation,Codestriker will simply treat the text as a single new file.Reviewers will still be able to view the text and makecomments on a per-line basis as before. Simply put thefilename to be reviewed in the "Topic text upload" field.The "Start tag", "End tag" and "Module" fields have norelevance in this situation.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN464">3.4.5. Creating Subversion Diff Topics</A></H2><P> Similar to CVS, Subversion diffs are created by again, goingto the top of your project directory, and issuing thefollowing command:<PRECLASS="PROGRAMLISTING">% svn diff -N > /tmp/review.txt</PRE>This file should then be selected for the "Topic textupload" field. The "Start tag", "End tag" and "Module"fields have no relevance in this situation. Because of anissue in Subversion, running the <BCLASS="COMMAND">svn diff</B>command <SPANCLASS="emphasis"><ICLASS="EMPHASIS">outside</I></SPAN> of the repository rootwill not allow Codestriker to download and review the fullfile (although the patch segments can still be reviewed). Ifyou commit your code first, then let Codestriker make thediff, as explained in the next section, then you can avoidthis limitation. If you really don't want to commit yourcode, you will need to modify the diff file to include thepaths on the Index: +++, and --- lines generated by<BCLASS="COMMAND">svn diff</B>.</P><P> In some development processes, branches are used as thelogical unit of work that should be reviewed. Rather thangenerating the review text via the <BCLASS="COMMAND">svndiff</B> command, as specified in the previoussection, the review text can be created by setting theappropriate values into the "Start tag", "End tag" and"Module" fields. Codestriker will then fetch the reviewtext from the nominated repository automatically, byexecuting the following command:<PRECLASS="PROGRAMLISTING">% svn diff --non-interactive -r START_TAG:END_TAG --old repository_url MODULE</PRE>In Subversion the tags can be a repository revision numberor HEAD, The HEAD shortcut indicates the latest revisionnumber in the repository. If you would like to review aspecific single check in, for example, check in 544, thenyou would use 543 for START_TAG and 544 for END_TAG.</P><P> If you would like to review a branch before merging thenenter the start tag as the version number of the branchcreation. The end tag should be HEAD, and the module pathshould be the path into the branch directory relative to therepository location. All topics created by Codestriker havea builtin workaround for the Subversion diff problem.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN475">3.4.6. Creating Perforce Diff Topics</A></H2><P> Similar to CVS, Perforce diffs are created by going to thetop of your checkout (or client view in Perforceterminology) and issuing a command like:<PRECLASS="PROGRAMLISTING">% p4 diff -du > /tmp/review.txt</PRE>This file should then be selected for the "Topic textupload" field. The "Start tag", "End tag" and "Module"fields have no relevance in this situation.</P><P> Alternatively, for code which has already been committedinto the repository (or depot in Perforce terminology), acommand like the following can be used to generate the topictext:<PRECLASS="PROGRAMLISTING">% p4 describe -du 132 > /tmp/review.txt</PRE>Here 132 is the change-number. This should be substitutedwith the change-number that you want to review.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN481">3.4.7. Creating ClearCase Diff Topics</A></H2><P> In its very basic form, a ClearCase diff file can be createdfor a single file using the following command:<PRECLASS="PROGRAMLISTING">% cleartool diff -serial_format -predecessor filename > /tmp/review.txt</PRE>This file can then be uploaded into Codestriker forreviewing. Of course, it is far more useful to be able toreview a group of files at once. In ClearCase, to determinewhich files are a part of a view, you can use the followingcommand from the top level of your checkout:<PRECLASS="PROGRAMLISTING">% cleartool lsco -cview -short -recurse</PRE></P><P> Combine the two commands together to generate a singlefile with all modified files can be achieved doing somethinglike:<PRECLASS="PROGRAMLISTING">% cleartool lsco -cview -short -recurse | \xargs -n1 cleartool diff -serial_format -predecessor > /tmp/review.txt</PRE>Note if you are on a Win32 platform, and you have cygwininstalled, you may need to add an intermediate sed commandso that cleartool doesn't complain:<PRECLASS="PROGRAMLISTING">% cleartool lsco -cview -short -recurse | sed 's/\\/\//g' | \xargs -n1 cleartool diff -serial_format -predecessor > /tmp/review.txt</PRE></P><P> In all of the above commands, if a ClearCase repository hasbeen specified in the Codestriker configuration, it isimportant that the above commands are run from the<SPANCLASS="emphasis"><ICLASS="EMPHASIS">top-level directory</I></SPAN> of the view, so thatthe full vob pathname information is available within thediff files. This allows Codestriker to retrieve the fullcontents of files from the vob, so that a reviewer can seethe changes applied to an entire file, rather than a smallsegment.</P><P> Note the above commands can be modified if there isonly interest in a specific sub-directory in your view, forexample, the<BCLASS="COMMAND">cleartool lsco</B> can be amended with thesub-directory of interest as follows:<PRECLASS="PROGRAMLISTING">% cleartool lsco -cview -short -recurse pathname/to/interested/dir | \xargs -n1 cleartool diff -serial_format -predecessor > /tmp/review.txt</PRE></P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN494">3.4.8. Creating Visual SourceSafe Topics</A></H2><P> Similar to CVS, SourceSafe diffs are creating by going tothe top of your project, and issuing a command like thefollowing in a cmd.exe window:<PRECLASS="PROGRAMLISTING">C:\Project\> ssdiff.pl > topic.txt</PRE>The <TTCLASS="FILENAME">topic.txt</TT> file will contain thesource-code differences made with the current code setcompared with the SourceSafe repository. This file can thenbe selected for the "Topic text upload" field in the createtopic screen. The "Start tag", "End tag" and "Module"fields have no relevance in this situation.</P><P> The <TTCLASS="FILENAME">ssdiff.pl</TT> Perl script is a customscript that is contained in the Codestriker<TTCLASS="FILENAME">bin</TT> directory, which needs to beinstalled on client machines that need to run the abovecommand. The configuration section at the start of thescript should be updated appropriately before it is used.</P><P> Alternatively, for code which has already been committed toSourceSafe, it is possible to explicitly specify on thecreate topic screen, values for the "Start tag", "End tag"and "Module" fields, which will enable Codestriker to fetchthe topic text directly from SourceSafe. In this instance,any SourceSafe label names can be used in the tag fields.If only one tag field is specified, the complete contents offiles corresponding to the specified label will beretrieved. The "Module" field contains a path into theSourceSafe repository which indicates the files of interest.An example value could be <TTCLASS="FILENAME">$/Project/Gui</TT>,which would work on all files located within that path.</P></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="x370.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="book1.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="x504.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Creating a new Project</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="c333.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Reviewing Topics</TD></TR></TABLE></DIV></BODY></HTML>