TortoiseSVN使用简介(9/9)复制文件及文件夹

<p class="MsoNormal">很多时候您会希望用某文件夹的复件来进行修改。等到确定此修改已经完毕了,再合并到原来的主要开发版本上。举例来说,我们目前在<span lang="EN-US">working copy</span>下面有如下的文件夹及文件:<span lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US"><span><img src="http://hi.csdn.net/attachment/201004/26/0_1272241515hZ8z.gif" alt=""></span></span></p>
<p class="MsoNormal">现在,我们要为<span lang="EN-US">trunk</span>这个文件夹建立一个<span lang="EN-US">branch</span>。假设我们希望这个文件夹是在<span lang="EN-US">E:/svn_repo/my_prj/trunk/my_new_branch_for_testing</span>(须与<span lang="EN-US">Repository</span>同根,实际的目录将产生在当前<span lang="EN-US">trunk</span>所在目录的相应目录,需要<span lang="EN-US">check out</span>一下)。首先我们可以在<span lang="EN-US">trunk</span>文件夹下面的空白处,或是直接在<span lang="EN-US">trunk</span>的<span lang="EN-US">icon</span>下面按下鼠标右键。<span lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US"><span><img src="http://hi.csdn.net/attachment/201004/26/0_127224151977Jh.gif" alt=""></span></span></p>
<p class="MsoNormal">在选择<span lang="EN-US">Branch/Tag…</span>这个项目后,您将会看到如下的对话框出现。 <span lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US"><span><img src="http://hi.csdn.net/attachment/201004/26/0_12722415230LZk.gif" alt=""></span></span></p>
<p class="MsoNormal">请先确认<span lang="EN-US">From WC at URL: </span>中的文件夹是您要复制的来源文件夹。接着,在<span lang="EN-US">To URL</span>中输入您要复制过去的路径。通常我们会将所有的<span lang="EN-US">branch</span>集中在一个文件夹下面。以上面的例子来说,<span lang="EN-US">branch</span>文件都会集中在<span lang="EN-US">branch</span>的子文件夹下面。在<span lang="EN-US">To URL</span>中您只需要输入您要的文件夹即可。文件夹不存在时,会由<span lang="EN-US">SVN</span>帮您建立。特别需要注意的是<span lang="EN-US">SVN</span>因为斜线作为文件夹分隔字符,而非反斜线。<span lang="EN-US"></span></p>
<p class="MsoNormal">接着在<span lang="EN-US">Log message</span>输入您此次<span lang="EN-US">branch</span>的目的为何。按下<span lang="EN-US">OK</span>就可以了。 <span lang="EN-US"></span></p>
<p class="MsoNormal">如果成功,将可以看到下面的画面:
<span lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US"><span><img src="http://hi.csdn.net/attachment/201004/26/0_1272241527wNnX.gif" alt=""></span></span></p>
<p class="MsoNormal">按下<span lang="EN-US">OK</span>就可以关闭这个窗口了。如果您此时立刻去<span lang="EN-US">working copy</span>的<span lang="EN-US">branch</span>子文件夹下面,您将会失望的发现在该文件夹下面并没有刚刚指定的文件夹存在。这是因为您<span lang="EN-US">working copy</span>的部份还是旧的,您只需要在<span lang="EN-US">branch</span>子文件夹下面进行<span lang="EN-US">SVN update</span>就可以看到这个新增的文件夹了。新增的文件夹就与原来的文件夹无关了。您可以任意对他进行编辑,一直到您确认好所有在<span lang="EN-US">branch</span>下面该做的工作都完成后,您可以选择将这个<span lang="EN-US">branch merge</span>回原来的<span lang="EN-US">trunk</span>文件夹,或者是保留它在<span lang="EN-US">branch</span>中。 <span lang="EN-US"></span></p>
<p class="MsoNormal">要<span lang="EN-US">merge</span>回<span lang="EN-US">trunk</span>文件夹中,方法很简单。以上面的例子来说,我们在<span lang="EN-US">D:\working\my_prj\trunk</span>文件夹空白处,按下鼠标右键,选择<span lang="EN-US">Merge:
</span></p>
<p class="MsoNormal"><span lang="EN-US"><span><img src="http://hi.csdn.net/attachment/201004/26/0_1272241532THJf.gif" alt=""></span></span></p>
<p class="MsoNormal">接着可以看到如下的画面:
<span lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US"><span><img src="http://hi.csdn.net/attachment/201004/26/0_12722415377cJG.gif" alt=""></span></span></p>
<p class="MsoNormal">下一步,就进入如下窗口:<span lang="EN-US"></span></p>
<p class="MsoNormal"><img src="http://hi.csdn.net/attachment/201004/26/0_1272241542OVxD.gif" alt=""></p>
<p class="MsoNormal"><span lang="EN-US">From: </span>与<span lang="EN-US"> To: </span>是要问您打算从<span lang="EN-US">Branch</span>中的哪个版本到哪个版本,<span lang="EN-US">merge</span>回原来的<span lang="EN-US">trunk</span>文件夹中。剩下的就是指定要<span lang="EN-US">merge</span>的<span lang="EN-US">revision</span>范围。选好要集成的版本后下一步:<span lang="EN-US"></span></p>
<p class="MsoNormal"><img src="http://hi.csdn.net/attachment/201004/26/0_1272241547jpFJ.gif" alt=""></p>
<p class="MsoNormal">您可以通过<span lang="EN-US">Test merge</span>按钮,试作一次<span lang="EN-US">Merge</span>。这个<span lang="EN-US">merge</span>只会显示一些信息,不会真正的更新到<span lang="EN-US">trunk</span>的文件夹去。只有按下<span lang="EN-US">Merge</span>按钮后,才会真正的将<span lang="EN-US">branch</span>的文件与<span lang="EN-US">trunk</span>的文件合并起来。 <span lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US"><span><img src="http://hi.csdn.net/attachment/201004/26/0_1272241551PItI.gif" alt=""></span></span></p>
<p class="MsoNormal">上面的信息告诉我们在<span lang="EN-US">trunk</span>文件夹下面的<span lang="EN-US">b.cpp</span>及<span lang="EN-US">c.cpp</span>已经被更改过了。如果您在现在到<span lang="EN-US">trunk</span>文件夹下,会看到这两个文件处于被修改的状态。<span lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US"><span></span><span><span></span></span><img src="http://hi.csdn.net/attachment/201004/26/0_1272241555ddI7.gif" alt=""></span></p>
<p class="MsoNormal">如果您确认这次的<span lang="EN-US">merge</span>没有问题,您可以直接使用<span lang="EN-US">commit</span>来将这两个被修改的文件<span lang="EN-US">commit</span>回<span lang="EN-US">SVN repository</span>上。如果有问题,您可以直接修改这两个文件,直到确认<span lang="EN-US">ok</span>了,再行<span lang="EN-US">commit</span>。<span lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US"><span><span lang="EN-US"><img src="http://hi.csdn.net/attachment/201004/26/0_127224156053QM.gif" alt=""></span><span lang="EN-US"><span><img src="http://hi.csdn.net/attachment/201004/26/0_1272241565Y1ek.gif" alt=""></span></span></span></span></p>
<p class="MsoNormal"><img src="http://hi.csdn.net/attachment/201004/26/0_1272241786c7S1.gif" alt=""></p>
<p class="MsoNormal">一切顺利的话,您就成功的将<span lang="EN-US">branch</span>的文件<span lang="EN-US">merge</span>回<span lang="EN-US">trunk</span>了。<span lang="EN-US"></span></p>

你可能感兴趣的:(tortoiseSVN)