svn笔记3
如果你是从头到尾按章节阅读本书,你一定已经具备了使用Subversion客户端执行大多数不同的版本控制操作足够的知识,你理解了怎样从Subversion版本库取出一个工作拷贝,你已经熟悉了通过svn commit和svn update来提交和接收修改,你甚至也经常下意识的使用svn status,无论目的是什么,你已经可以正常使用Subversion了。
但是Subversion的特性并没有止于“普通的版本控制操作”,它也有一些超越了与版本库传递文件和目录修改以外的功能。
本章重点介绍了一些很重要但不是经常使用的Subversion特性,本章假定你熟悉Subversion对文件和目录的基本版本操作能力,如果你还没有阅读这些内容,或者是需要一个复习,我们建议你重读第 1 章 基本概念和第 2 章 基本使用,一旦你已经掌握了基础知识和本章的内容,你会变成Subversion的超级用户!
Revision Specifiers
As we described in the section called “Revisions”, revision numbers in Subversion are pretty straightforward—integers that keep getting larger as you commit more changes to your versioned data. Still, it doesn't take long before you can no longer remember exactly what happened in each and every revision. Fortunately, the typical Subversion workflow doesn't often demand that you supply arbitrary revisions to the Subversion operations you perform. For operations that do require a revision specifier, you generally supply a revision number that you saw in a commit email, in the output of some other Subversion operation, or in some other context that would give meaning to that particular number.
But occasionally, you need to pinpoint a moment in time for which you don't already have a revision number memorized or handy. So besides the integer revision numbers, svn allows as input some additional forms of revision specifiers: revision keywords and revision dates.
The various forms of Subversion revision specifiers can be mixed and matched when used to specify revision ranges. For example, you can use -r
where REV1
:REV2
REV1
is a revision keyword and REV2
is a revision number, or where REV1
is a date andREV2
is a revision keyword, and so on. The individual revision specifiers are independently evaluated, so you can put whatever you want on the opposite sides of that colon.
版本清单
就像你在“修订版本”一节见到的,Subversion的修订版本号码非常直接—就是随提交增大的整数。尽管如此,不会花很长时间你就会忘记每个修订版本的修改,但幸运的是,典型的Subvesion工作流程中一般不会要求你提供任意的修订版本号。在需要输入修订版本号时,通常或者是你在一个提交邮件中看到了一个修订版本,或者是在其他Subversion命令的输出结果中,或者是任何上下文环境得到某个版本号码的情况下。
但是有时候,你需要精确指定一个时间,而无法记住或者记录了某个版本,这时除了使用修订版本号码,svn允许使用其他形式来指定修订版本—修订版本关键字和修订版本日期。
当用来指定修订版本范围时,不同形式的Subversion修订版本可以混合匹配。例如,你可以REV1
是修订版本关键字,REV2
是修订版本号,或者是REV1
是日期,而REV2
是修订版本关键字,等等。不同的修订版本指定符是等价的,所以你可以在冒号两边任意使用。
修订版本关键字
Subversion客户端可以理解一些修订版本关键字,这些关键字可以用来代替--revision (r)
的数字参数,这会被Subversion解释到特定修订版本号:
Revision Keywords
The Subversion client understands a number of revision keywords. These keywords can be used instead of integer arguments to the --revision
(-r
) option, and are resolved into specific revision numbers by Subversion:
HEAD
-
The latest (or “youngest”) revision in the repository.
BASE
-
The revision number of an item in a working copy. If the item has been locally modified, this refers to the way the item appears without those local modifications.
工作拷贝中一个条目的修订版本号,如果这个版本在本地修改了,则“BASE版本”就是这个条目在本地未修改的版本。
COMMITTED
-
The most recent revision prior to, or equal to,
BASE
, in which an item changed.项目最近修改的修订版本,与
BASE
相同或更早。 PREV
-
The revision immediately before the last revision in which an item changed. Technically, this boils down to
COMMITTED
−1.一个项目最后修改版本之前的那个版本,技术上可以认为是
COMMITTED
-1。
As can be derived from their descriptions, the PREV
, BASE
, and COMMITTED
revision keywords are used only when referring to a working copy path—they don't apply to repository URLs. HEAD
, on the other hand, can be used in conjunction with both of these path types.
因为可以从描述中得到,关键字PREV
,BASE
和COMMITTED
只在引用工作拷贝路径时使用,而不能用于版本库URL,而关键字HEAD
则可以用于两种路径类型。注意:HEAD针对于版本库,另外3个针对于某个工作副本目录或文件。
下面是一些修订版本关键字的例子:
Here are some examples of revision keywords in action:
$ svn diff -r PREV:COMMITTED foo.c
# shows the last change committed to foo.c $ svn log -r HEAD
# shows log message for the latest repository commit $ svn diff -r HEAD
# compares your working copy (with all of its local changes) to the
# latest version of that tree in the repository $ svn diff -r BASE:HEAD foo.c
# compares the unmodified version of foo.c with the latest version of
# foo.c in the repository $ svn log -r BASE:HEAD
# shows all commit logs for the current versioned directory since you
# last updated $ svn update -r PREV foo.c
# rewinds the last change on foo.c, decreasing foo.c's working revision $ svn diff -r BASE:14 foo.c
# compares the unmodified version of foo.c with the way foo.c looked
# in revision 14
版本日期Revision Dates
在版本控制系统以外,修订版本号码是没有意义的,但是有时候你需要将时间和历史修订版本号关联。为此,--revision (-r)
选项接受使用花括号({
和}
)包裹的日期输入,Subversion支持标准ISO-8601日期和时间格式,也支持一些其他的。下面是一些例子。(记住使用引号括起所有包含空格的日期。
$ svn checkout -r {2006-02-17}
$ svn checkout -r {15:30}
$ svn checkout -r {15:30:00.200000}
$ svn checkout -r {"2006-02-17 15:30"}
$ svn checkout -r {"2006-02-17 15:30 +0230"}
$ svn checkout -r {2006-02-17T15:30}
$ svn checkout -r {2006-02-17T15:30Z}
$ svn checkout -r {2006-02-17T15:30-04:00}
$ svn checkout -r {20060217T1530}
$ svn checkout -r {20060217T1530Z}
$ svn checkout -r {20060217T1530-0500}
…
When you specify a date, Subversion resolves that date to the most recent revision of the repository as of that date, and then continues to operate against that resolved revision number:当你指定一个日期,Subversion会在版本库找到接近这个日期的最新版本:
$ svn log -r {2006-11-28}
------------------------------------------------------------------------
r12 | ira | 2006-11-27 12:31:51 -0600 (Mon, 27 Nov 2006) | 6 lines
…
Is Subversion a Day Early?
If you specify a single date as a revision without specifying a time of day (for example 2006-11-27
), you may think that Subversion should give you the last revision that took place on the 27th of November. Instead, you'll get back a revision from the 26th, or even earlier. Remember that Subversion will find the most recent revision of the repository as of the date you give. If you give a date without a timestamp, such as 2006-11-27
, Subversion assumes a time of 00:00:00, so looking for the most recent revision won't return anything on the 27th.
If you want to include the 27th in your search, you can either specify the 27th with the time ({"2006-11-27 23:59"}
), or just specify the next day ({2006-11-28}
).
You can also use a range of dates. Subversion will find all revisions between both dates, inclusive:
$ svn log -r {2006-11-20}:{2006-11-29}
…
Subversion会早一天吗?
如果你只是指定了日期而没有时间(举个例子2002-11-27
),你也许会以为Subversion会给你11-27号最后的版本,相反,你会得到一个26号版本,甚至更早。记住Subversion会根据你的日期找到最新的版本,如果你给一个日期,而没有给时间,像2002-11-27
,Subversion会假定时间是00:00:00,所以在27号找不到任何版本。
如果你希望查询包括27号,你既可以使用({"2002-11-27 23:59"}
),或是直接使用({2002-11-28}
)。
Since the timestamp of a revision is stored as an unversioned, modifiable property of the revision (see the section called “Properties”), revision timestamps can be changed to represent complete falsifications of true chronology, or even removed altogether. Subversion's ability to correctly convert revision dates into real revision numbers depends on revision datestamps maintaining a sequential ordering—the younger the revision, the younger its timestamp. If this ordering isn't maintained, you will likely find that trying to use dates to specify revision ranges in your repository doesn't always return the data you might have expected.
你可以使用时间段,Subversion会找到这段时间的所有版本:
$ svn log --revision {2002-11-20}:{2002-11-29}
…
我们也曾经指出,你可以混合日期和修订版本号:
$ svn log --revision {2002-11-20}:4040
用户一定要认识到这种精巧会成为处理日期的绊脚石,因为一个版本的时间戳是作为一个属性存储的—不是版本化的,而是可以编辑的属性—版本号的时间戳可以被修改,从而建立一个虚假的年代表,也可以被完全删除。这将大大破坏Subversion的这种时间—版本转化功能的表现。
svn笔记3的更多相关文章
- svn笔记
安装部署 1.yum install subversion 2.创建svn版本库目录 mkdir -p /svn 3.创建版本库 svnadmin create /svn/fengchao/ ...
- svn笔记4属性Properties
我们已经详细讲述了Subversion存储和检索版本库中不同版本的文件和目录的细节,并且用了好几个章节来论述这个工具的基本功能.如果对于版本化的支持到此为止,从版本控制的角度来看Subversion已 ...
- svn笔记2
Examining History Your Subversion repository is like a time machine. It keeps a record of every chan ...
- SVN - 笔记
SVN(版本控制) 1.什么是SVN · 多人共同开发同一个项目,内部最大的问题是,在比较短的时间内如果有多人同时开发同一个文件,会造成彼此的代码相互覆盖的情况发生. · 管理着随时间改变的数据,这些 ...
- CentOS 7 配置SVN 笔记
一.通过yum 安装软件 yum install subversion -y 配置nfs 用来做版本库(略过) 格式 : NFS共享的目录 NFS客户端地址1(参数1,参数2,...) 客户端地址2( ...
- 【知识小结】PHP使用svn笔记总结
在公司里,我们要养成每天上班前更新代码,下班前提交代码的习惯,并且做好说明. svn更新代码的时候,先右键点击需要更新的项目,在team中进入资源库同步界面,选择incoming mode,显示的文件 ...
- Git本地版本控制备忘
首先git是一个版本控制工具,类似于SVN 笔记包括两部分,git本地版本控制和git远程协助 一.Git本地版本控制 以git windows版本msysgit为例,下载地址http://msysg ...
- [No000081]SVN学习笔记1-服务端搭建
目录 一:SVN服务器搭建和使用. 1.首先来下载和搭建SVN服务器,地址http://subversion.apache.org/packages.html 2.安装完成后,启动VisualSVN ...
- SVN版本库(访问权限)配置实例笔记
http://blog.csdn.net/zjianbo/article/details/8578297 SVN版本库(访问权限)配置实例笔记 本系列文章由ex_net(张建波)编写,转载请注明出处. ...
随机推荐
- HTTP使用BASIC认证的原理及实现方法 (转载)
转自:http://blog.itpub.net/23071790/viewspace-709367 一. BASIC认证概述 在HTTP协议进行通信的过程中,HTTP协议定义了基本认证过程以允许 ...
- protel99_拼板详细图解
首先打开PCB文档.如图所示,在PCB左下角放置一個坐標為X=0,Y=0的焊盤. 从下图看,为了方便电路板生产厂家的加工和焊接工厂的加工,拼版的方向是向上Y轴方向拼版. 接着为了在拼版过程中好对齐板边 ...
- python3 ImageTk 安装方法
使用命令: $ sudo yum search PIL | grep python3 可显示得知: python3-dogpile-cache.noarch : A caching front-end ...
- 基于RYU控制器(controller)上的simple-switch 的APP做的測试-SDN/OpenFlow
近期一直在学习RYU控制器,在使用的过程中,发现有下面几方面的长处:RYU控制器全然使用Python语言编写,在理解起来和上手速度上是挺快的:RYU控制器的总体架构清晰明了,在日后有时间我会整理一个关 ...
- Sql语句之select 5种查询
select 5种子句:注意顺序where / group by /having / order by / limit / 清空表中的数据:truncate 表名: 导入表结构(不含数据): crea ...
- 编写可维护的JavaScript—语句和表达式&变量、函数和运算符
语句和表达式 所有的块语句都应当使用花括号.包括: if for while do…while… try…catch…finally //不好的写法 if (condition) doSomethin ...
- asp.net js调用后台方法
先前网上百度了很多 ,大致都一样 但是不太详细,总是不成功,然后试了很多,把经验发给大家看看 前台js function aa() { //这里可以写你要带的参数用隐藏域放起来 __doPostBac ...
- python开发环境安装
1.首先安装python-3.4.2.msi,此为python主程序,双击安装,根据自身的情况做选择,也可以使用默认设置,一路next也没什么问题. 2.设置环境变量=>编辑Path,在最后加上 ...
- SharePoint迁移数据到生产环境
SharePoint迁移数据到生产环境步骤如下: 1. 安装部署好生产环境 2. 配置管理中心 3. 安装SPD工具 4. 备份数据库(放在数据库服务器) 5. 备份wsp包(部署在管理中心服务器) ...
- ThinkPHP第四天(U函数,URL类型参数配置,伪静态后缀名配置,数据传递与获取$_GET等)
1.U('地址','参数','伪静态','是否跳转','是否显示域名'); 在模板中使用U方法而不是固定写死URL地址的好处在于,一旦你的环境变化或者参数设置改变,你不需要更改模板中的任何代码. 在模 ...