📄 ch19_03.htm
字号:
<a name="unut-ch-19-sect-3.4" /><div class="sect2"><h3 class="sect2">19.3.4. Revision Numbering</h3><p><a name="IXT-19-123572" /><a name="IXT-19-123573" /><a name="IXT-19-123574" />Unless told otherwise, RCS commands typically operate on the latest revision.Some commands have an <tt class="literal">-r</tt> option that specifies a revision number.In addition, many options accept a revision number as an optional argument.(In the command summary, this argument is shown as [<em class="emphasis">R</em>].) Revision numbers consist of up to four fields: release, level, branch, andsequence; but most revisions consist of only the release and level.For example, you can check out revision 1.4 as follows:</p><blockquote><pre class="code"><tt class="userinput"><b>co -l -r1.4 ch01</b></tt></pre></blockquote><p>When you check it in again, the new revision will be marked as 1.5.Now suppose the edited copy needs to be checked in as the next release.You would type:</p><blockquote><pre class="code"><tt class="userinput"><b>ci -r2 ch01</b></tt></pre></blockquote><p>This creates revision 2.1. You can also create a branch from an earlier revision.The following command creates revision 1.4.1.1:</p><blockquote><pre class="code"><tt class="userinput"><b>ci -r1.4.1 ch01</b></tt></pre></blockquote><p>Numbers that begin with a period are considered to be relative tothe default branch of the RCS file. Normally, this is the“trunk” of the revision tree.</p><p>Numbers are not the only way to specify revisions, though.You can assign a text label as a revision name,using the <tt class="literal">-n</tt> option of <tt class="literal">ci</tt> or <tt class="literal">rcs</tt>.You can also specify this name in any option that acceptsa revision number for an argument.For example, you could check in each of your C files,using the same label regardless of the current revision number:</p><blockquote><pre class="code"><tt class="userinput"><b>ci -u -nPrototype *.c</b></tt></pre></blockquote><p>In addition,you mayspecify a <tt class="literal">$</tt>,which means the revision number extracted from the keywordsof a working file. For example:</p><blockquote><pre class="code"><tt class="userinput"><b>rcsdiff -r$ ch01</b></tt></pre></blockquote><p>compares <tt class="literal">ch01</tt> to the revision that is checked in.You can also combine names and symbols. The command:</p><blockquote><pre class="code"><tt class="userinput"><b>rcs -nDraft:$ ch*</b></tt></pre></blockquote><p>assigns a name to the revision numbers associated with several chapter files.</p></div><a name="unut-ch-19-sect-3.5" /><div class="sect2"><h3 class="sect2">19.3.5. Specifying the Date</h3><p><a name="IXT-19-123575" /><a name="IXT-19-123576" /><a name="IXT-19-123577" />Revisions are timestamped by time and date of check-in.Several keyword strings include the date in their values.Dates can be supplied in options to <tt class="literal">ci</tt>, <tt class="literal">co</tt>, and <tt class="literal">rlog</tt>.RCS uses the following date format as its default:</p><blockquote><pre class="code">2000/01/10 02:00:00 <i class="lineannotation">Year/month/day time</i></pre></blockquote><p>The default time zone is Greenwich Mean Time (GMT), which is also referred toas Coordinated Universal Time (UTC). Dates can be supplied in free format.This lets you specify many different styles. Here are some ofthe more common ones, which show the same time as in the previous example:</p><blockquote><pre class="code">6:00 pm lt <i class="lineannotation">Assuming today is Jan. 10, 2000</i>2:00 AM, Jan. 10, 2000Mon Jan 10 18:00:00 2000 LT Mon Jan 10 18:00:00 PST 2000</pre></blockquote><p>The uppercase or lowercase “lt” indicates local time (here, Pacific StandardTime). The third line shows <tt class="literal">ctime</tt> format (plus the “LT”);the fourth line is the <tt class="literal">date</tt> command format.</p></div><a name="unut-ch-19-sect-3.6" /><div class="sect2"><h3 class="sect2">19.3.6. Specifying States</h3><p><a name="IXT-19-123578" /><a name="IXT-19-123579" />In some situations, particularly programming environments,you want to know the status of a set of revisions.RCS files are marked by a text string that describes their <em class="emphasis">state</em>.The default state is <tt class="literal">Exp</tt> (experimental). Other common choicesinclude <tt class="literal">Stab</tt> (stable) or <tt class="literal">Rel</tt> (released).These words are user-defined and have no special internal meaning.Several keyword strings include the state in their values.In addition, states can be supplied in options to <tt class="literal">ci</tt>, <tt class="literal">co</tt>, <tt class="literal">rcs</tt>, and <tt class="literal">rlog</tt>.</p></div><a name="unut-ch-19-sect-3.7" /><div class="sect2"><h3 class="sect2">19.3.7. Standard Options and Environment Variables</h3><p><a name="IXT-19-123580" /><a name="IXT-19-123581" /><a name="IXT-19-123582" />RCS defines an environment variable, RCSINIT,which sets up default options for RCS commands.If you set RCSINIT to a space-separated list of options,they will be prepended to the command-line optionsyou supply to any RCS command.</p><p>Six options are useful to include in RCSINIT:<tt class="literal">-q</tt>,<tt class="literal">-V</tt>,<tt class="literal">-V</tt><em class="emphasis">n</em>,<tt class="literal">-T</tt>,<tt class="literal">-x</tt>,and<tt class="literal">-z</tt>.They can be thought of as standard optionsbecause most RCS commands accept them.</p><dl><dt><tt class="literal">-q</tt>[<tt><em class="replaceable">R</em></tt>]</dt><dd>Quiet mode; don't show diagnostic output. <em class="emphasis">R</em></tt> specifiesa file revision.</p></dd><dt><tt class="literal">-T</tt></dt><dd>If the file with the new revision has a later modification timethan that of the RCS file, update the RCS file's modification time.Otherwise, preserve the RCS file's modification time.This option should be used with care; see the discussion inthe <tt class="literal">ci</tt> manpage for more detail.</p></dd><dt><tt class="literal">-V</tt></dt><dd>Print the RCS version number.</p></dd><dt><tt class="literal">-V</tt><tt><em class="replaceable">n</em></tt></dt><dd>Emulate version <em class="emphasis">n</em></tt> of RCS; useful when trading filesbetween systems that run different versions.<em class="emphasis">n</em> can be 3, 4, or 5.</p></dd><dt><tt class="literal">-x</tt><tt><em class="replaceable">suffixes</em></tt></dt><dd>Specify an alternate list of <em class="emphasis">suffixes</em></tt> for RCS files.Each suffix is separated by a <tt class="literal">/</tt>.On Unix systems, RCS files normally end with the characters <tt class="literal">,v</tt>. The <tt class="literal">-x</tt> option provides a workaround for systems that don't allow a comma character in filenames.</p></dd><dt><tt class="literal">-z</tt><tt><em class="replaceable">timezone</em></tt></dt><dd><em class="emphasis">timezone</em></tt> controls the output format for datesin keyword substitution.<em class="emphasis">timezone</em> should have one of the following values:</p></dd></dl><table border="1" cellpadding="3"><tr><th><em class="emphasis">Value</em></th><th><em class="emphasis">Effect</em></th></tr><tr><td><em class="emphasis">empty</em></td><td><p>Default format: UTC with no time zone and slashes separating theparts of the date.</p></td></tr><tr><td><tt class="literal">LT</tt></td><td><p>The local time and date, in ISO-8601 format, with time-zone indication(<em class="emphasis">YYYY</em><tt class="literal">-</tt><em class="emphasis">MM</em><tt class="literal">-</tt><em class="emphasis">DD</em><em class="emphasis">HH</em><tt class="literal">:</tt><em class="emphasis">MM</em><tt class="literal">:</tt><em class="emphasis">SS</em><tt class="literal">-</tt><em class="emphasis">ZZ</em>).</p></td></tr><tr><td>±<em class="replaceable"><tt>hh</em><tt class="literal">:</tt><em class="replaceable">mm</tt></em></td><td><p>With a numeric offset from UTC, the output is in IS0-8601 format.</p></td></tr></table><p><p>For example, when depositing a working file into an RCS file, the command:</p><blockquote><pre class="code"><tt class="userinput"><b>ci -x,v/ ch01 </b></tt> <i class="lineannotation">Second suffix is blank</i></pre></blockquote><p>searches in order for the RCS filenames:</p><blockquote><pre class="code">RCS/ch01,vch01,vRCS/ch01</pre></blockquote><p>RCS allows you to specify a location for temporary files.It checks the environment variablesTMPDIR,TMP,andTEMP,in that order.If none of those exist, it uses a default location,such as <tt class="literal">/tmp</tt>.</p></div><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch19_02.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"><img src="../gifs/txthome.gif" alt="Home" border="0" /></a></td><td align="right" valign="top" width="228"><a href="ch19_04.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">19.2. Basic Operation</td><td align="center" valign="top" width="228"><a href="index/index.htm"><img src="../gifs/index.gif" alt="Book Index" border="0" /></a></td><td align="right" valign="top" width="228">19.4. Conversion Guide for SCCS Users</td></tr></table></div><hr width="684" align="left" /><img src="../gifs/navbar.gif" usemap="#library-map" border="0" alt="Library Navigation Links" /><p><p><font size="-1"><a href="copyrght.htm">Copyright © 2003</a> O'Reilly & Associates. All rights reserved.</font></p><map name="library-map"><area shape="rect" coords="1,0,88,96" href="../index.htm"><area shape="rect" coords="90,0,165,96" href="../upt/index.htm"><area shape="rect" coords="168,1,253,107" href="../mac/index.htm"><area shape="rect" coords="255,0,335,97" href="../korn/index.htm"><area shape="rect" coords="337,0,415,109" href="../unixnut/index.htm"><area shape="rect" coords="417,0,512,122" href="../sedawk/index.htm"><area shape="rect" coords="514,0,605,105" href="../lunix/index.htm"><area shape="rect" coords="611,2,694,121" href="../vi/index.htm"></map></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -