svn关键字替换_SVN关键字替换示例

svn关键字替换

I use SVN as repository management tool and usually work on multiple projects simultaneously. I was looking for some way using SVN to generate a release notes file that can have version details. Then I got to know about SVN keywords substitution property and I used it to create a release notes for my project.

我使用SVN作为存储库管理工具,通常同时处理多个项目。 我一直在寻找使用SVN生成可以包含版本详细信息的发行说明文件的方法。 然后,我了解了SVN关键字替换属性,并使用它为我的项目创建了发行​​说明。

SVN Provides a list of keywords that you can set on a file and it will dynamically replace that with the latest information at the time of code check in. Some of these keywords are Id, Author, Revision, HeadURL etc.

SVN提供您可以在文件上设置的关键字列表,它将在代码检入时动态地将其替换为最新信息。其中一些关键字是Id,Author,Revision,HeadURL等。

So to create my release notes file, first of all I added a release.txt file at my project root directory with following information.

因此,要创建我的发行说明文件,首先,我在项目根目录中添加了release.txt文件,其中包含以下信息。

release.txt

release.txt

======================================
Version Number: 0.0.1-SNAPSHOT
======================================

SVN Revision:
-------------
- $Id: $
- $HeadURL: $  

Release Notes :
------------------------
 - Testing Project

Notice the use of Id and HeadURL, these are the keywords that SVN will replace when I will check in this file. But before that we need to set the svn:keywords property on this file using below command.

请注意Id和HeadURL的使用,这些是我检入此文件时SVN将替换的关键字。 但是在此之前,我们需要使用以下命令在此文件上设置svn:keywords属性。

svn propedit svn:keywords release.txt

Add all the keywords that you want to be replaced dynamically space separated, for example “Id HeadURL”.

添加要动态替换的所有关键字,并以空格分隔,例如“ Id HeadURL”。

Now after all my development for a version is finished, I check in this file and the file gets edited dynamically like this.

现在,在完成所有版本的开发后,我签入该文件,然后像这样动态编辑文件。

======================================
Version Number: 0.0.1-SNAPSHOT
======================================

SVN Revision:
-------------
- $Id: release.txt 194 2013-05-31 04:24:20Z pkumar $
- $HeadURL: https://localhost:1080/SVNROOT/SANDBOX/MyProject/release.txt $  

Release Notes :
------------------------
 - Testing Project

Now every time I just add additional information to the file with release notes data and I can figure out easily which is the last revision number for a version. For example my file looks like below at the time of check in.

现在,每次我只要将带有发行说明数据的其他信息添加到文件中,就可以轻松找出哪个是版本的最新修订号。 例如,签入时我的文件如下所示。

======================================
Version Number: 0.0.2-SNAPSHOT
======================================

SVN Revision:
-------------
- $Id:  $
- $HeadURL: $  

Release Notes :
------------------------
 - New Features

======================================
Version Number: 0.0.1-SNAPSHOT
======================================

SVN Revision:
-------------
- $Id: release-notes.txt 194 2013-05-31 04:24:20Z pkumar2
- $HeadURL: https://localhost:1080/SVNROOT/SANDBOX/MyProject/release.txt

Release Notes :
------------------------
 - Testing Project

Note that we need to remove the ending $ from keywords in the file else it will also get replaced.

请注意,我们需要从文件中的关键字中删除结尾的$,否则它也会被替换。

That’s all about SVN keywords substitution example.

这就是有关SVN关键字替换示例的全部内容。

翻译自: https://www.journaldev.com/1398/svn-keywords-substitution-example

svn关键字替换

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值