How to use keywords in SVN (TortoiseSVN)

冷暖自知 提交于 2019-12-04 11:51:58

问题


I can't do a document with the Keyword Substitution tool to have only a few data as: -Date -Revision -Author -HeadURL -Id

I'm doing a test but I can't implement the Keyword Substitution. I created a document Txt with the following information:

svn:keywords = Date Revision Author HeadURL Id

 $Id: $
 $Revision: $
 $Author: $
 $HeadURL: $
 $Date: $

I do not know whether it should be implemented in a txt file or in another format.

I am using TortoiseSVN and tools Subversion Edge.


回答1:


You have to use correct workflow and syntax

  1. Add svn-property to file (as Ken noted)
  2. Use proper syntax of enabled keywords inside text-file

$Revision$ $Date$ $Author$




回答2:


You've done half of what you need. Now you need to use svn propset to do the rest of it, as it shows in the documentation, about halfway down the page:

You've done this part:

For example, say you have a versioned file named weather.txt that looks like this:

Here is the latest report from the front lines.
$LastChangedDate$
$Rev$
Cumulus clouds are appearing more frequently as summer approaches.

Now you need to do the other half of it:

With no svn:keywords property set on that file, Subversion will do nothing special. Now, let's enable substitution of the LastChangedDate keyword.

$ svn propset svn:keywords "Date Author" weather.txt
property 'svn:keywords' set on 'weather.txt'
$

The easiest way to set these properties using TortoiseSVN is to right-click the file, choose TortoiseSVN->Properties from the pop-up menu, and then configure the properties there. You can find this info in the Project Settings page of the TortoiseSVN documentation; see SVN keywords roughly 2/3 of the way down the page. (There's no anchor provided, but you can search the page once you get there.)




回答3:


So for example if you want Author, Date, Revision to be part of your SVN versioned file you have to add SVN Key propery to that file. So my initial file is called example.xls this is before the first commmit !!!

With content

<!--
$Rev::                      $:  Revision of last commit.
$Author::                   $:  Author of last commit.
$Date::                     $:  Date of last commit.
-->
<abv:container xmlns:abv="http://my_org/odel/common">
    <abv:object xmln
....
  1. You have to set Keyword Substitution to your file, so for that purpose, if you are Tourtoise SVN user, right click on the file example.xsl

  1. The Choose New Keywords

  2. Select Revision, Date, Author

  3. So now when you commit that file unless the Comment <!-- SVN will add the needed values after the ::. So After commit the file will look like:

    $Rev:: 938                  $:  Revision of last commit.
    $Author:: Xelian            $:  Author of last commit.
    $Date:: 2016-07-11 11:21:26#$:  Date of last commit.
    



回答4:


Today I encountered the same problem, but the syntax and the properties were correct.

In my case the problem was depending on the encoding of the file (it had UCS-2 LE BOM). I converted the file to ANSI and the keywords becomes replaced.



来源:https://stackoverflow.com/questions/16916283/how-to-use-keywords-in-svn-tortoisesvn

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!