📄 ch19_02.htm
字号:
<html><head><title>Basic Operation (UNIX in a Nutshell: System V Edition)</title><link rel="stylesheet" type="text/css" href="../style/style1.css" /><meta name="DC.Creator" content="Arnold Robbins" /><meta name="DC.Format" content="text/xml" scheme="MIME" /><meta name="DC.Language" content="en-US" /><meta name="DC.Publisher" content="O'Reilly & Associates, Inc." /><meta name="DC.Source" scheme="ISBN" content="1-56592-427-4" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="UNIX in a Nutshell: System V Edition" /><meta name="DC.Type" content="Text.Monograph" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" usemap="#banner-map" border="0" alt="Book Home" /><map name="banner-map"><area shape="rect" coords="1,-2,616,66" href="index.htm" alt="Book Title" /><area shape="rect" coords="629,-11,726,25" href="jobjects/fsearch.htm" alt="Search this book" /></map><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch19_01.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228" /><td align="right" valign="top" width="228"><a href="ch19_03.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><h2 class="sect1">19.2. Basic Operation</h2><p><a name="IXT-19-123549" />Normally, you maintain RCS files in a subdirectory called <tt class="literal">RCS</tt>,so the first step in using RCS should be:</p><blockquote><pre class="code"><tt class="userinput"><b>mkdir RCS</b></tt></pre></blockquote><p>Next, you place an existing file (or files) under RCS controlby running the check-in command:</p><blockquote><pre class="code"><tt class="userinput"><b>ci </b></tt><em class="replaceable"><tt>file</tt></em></pre></blockquote><p><a name="IXT-19-123550" /><a name="IXT-19-123551" /><a name="IXT-19-123552" />This creates a file called <em class="emphasis">file</em><tt class="literal">,v</tt> inthe <tt class="literal">RCS</tt> directory.<em class="emphasis">file</em><tt class="literal">,v</tt> is called an RCS file, and it stores all future revisionsof <em class="emphasis">file</em>. When you run <tt class="literal">ci</tt> on a file for the first time,you are prompted to describe the contents. <tt class="literal">ci</tt> then deposits <em class="emphasis">file</em>into the RCS file as revision 1.1.</p><p>To edit a new revision, check out a copy:</p><blockquote><pre class="code"><tt class="userinput"><b>co -l </b></tt><em class="replaceable"><tt>file</tt></em></pre></blockquote><p><a name="IXT-19-123553" /><a name="IXT-19-123554" /><a name="IXT-19-123555" />This causes RCS to extract a copy of <em class="emphasis">file</em> from the RCS file.You must lock the file with <tt class="literal">-l</tt> to make it writable by you.This copy is called a working file. When you're done editing,you can record the changes by checking the working file back in again:</p><blockquote><pre class="code"><tt class="userinput"><b>ci </b></tt><em class="replaceable"><tt>file</tt></em></pre></blockquote><p>This time, you are prompted to enter a log of the changes made, andthe file is deposited as revision 1.2. Note that a check-innormally removes the working file. To retrieve a read-only copy, do a check-out without a lock:</p><blockquote><pre class="code"><tt class="userinput"><b>co </b></tt><em class="replaceable"><tt>file</tt></em></pre></blockquote><p>This is useful when you need to keep a copy on hand for compiling or searching.As a shortcut to the previous <tt class="literal">ci</tt>/<tt class="literal">co</tt>, you could type:</p><blockquote><pre class="code"><tt class="userinput"><b>ci -u </b></tt><em class="replaceable"><tt>file</tt></em></pre></blockquote><p>This checks in the file but immediately checks out a read-only(“unlocked”) copy.In practice, you would probably make a “checkpoint”of your working version and then keep going, like this:</p><blockquote><pre class="code"><tt class="userinput"><b>ci -l</b></tt> <em class="replaceable"><tt>file</tt></em></pre></blockquote><p>This checks in the file, and then checks it back out again, locked,for continued work.To compare changes between a working file and its latest revision,you can type:</p><blockquote><pre class="code"><tt class="userinput"><b>rcsdiff </b></tt><em class="replaceable"><tt>file</tt></em></pre></blockquote><p><a name="IXT-19-123556" />Another useful command is <tt class="literal">rlog</tt>, which shows a summary oflog messages. System administrators can use the <tt class="literal">rcs</tt> commandto set up default behavior of RCS.</p><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch19_01.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_03.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">19. The Revision Control System</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.3. General RCS Specifications</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 + -