ANT SVN TASK

rel="stylesheet" type="text/css" href="http://tortoisesvn.tigris.org/branding/css/print.css" media="print">

<Svn>

By Cédric Chabanois et al.

Description

This task provides an interface to Subversion revision control system that is a compelling replacement for CVS in the open source community.
With the help of the underlying svnClientAdapter, <svn> task uses JavaHL (a native JNI interface to the subversion api) if it can find the corresponding library (e.g. svnjavahl.dll on windows). Otherwise it uses svn command line interface.

Parameters

AttributeDescriptionRequired
usernameusername that will be used for all nested svn commands.No
passwordpassword that will be used for all nested svn commands.No
javahlSet to “false” to use command line client interface instead of JNI JavaHL binding.No (Defaults to true)

Svn commands specified as nested elements

add createRepositoryimportmovestatus
catdeletekeywordssetpropdelswitch
checkoutdiffkeywordsaddpropgetupdate
commitexportkeywordsremovepropset
copyignoremkdirrevert

add

You can add files and directories to svn repository with nested <add> elements.

AttributeDescriptionRequired
filefile to add to the repositoryNo
dirdirectory to add to the repositoryNo
recurseSet to "false" to operate on a single directory only (applies only when dir attribute is set). Default is "true" No

Parameters specified as nested elements :

  • fileset
    Filesets are used to select sets of files to add to the repository.
    Note that directories needed to add selected files will be added to the repository even if they are not selected by the fileset.

cat

Get the content of a file on repository.

AttributeDescriptionRequired
destFileName of the destination fileNo
(default is the name of the file on the url)
urlUrl of the file in repositoryYes
revisionrevision to get.
Possible values are :
- a date with the following format : MM/DD/YYYY HH:MM AM_PM
- a revision number
- HEAD, BASE, COMMITED or PREV
Default is "HEAD"
No

checkout

Check out a working copy from a repository.

AttributeDescriptionRequired
urlurl to checkout fromYes
recurseSet to "false" to operate on single directory only. Default is "true" No
destPathdestination directoryYes
revisionrevision to checkout.
Possible values are :
- a date with the following format : MM/DD/YYYY HH:MM AM_PM
- a revision number
- HEAD, BASE, COMMITED or PREV
Default is "HEAD"
No

Parameters specified as nested elements :

  • fileset
    Filesets are used to select sets of files to add to the repository.
    Note that directories needed to add selected files will be added to the repository even if they are not selected by the fileset.

<svn javahl="${javahl}">
<checkout url="${urlRepos}" destPath="workingcopy" />
</svn>

commit

Send changes from your working copy to the repository.

AttributeDescriptionRequired
filefile to commitNo
recurseSet to "false" to operate on single directory only. Default is "true"
Apply only when dir attribute is set.
No
dirdirectory to commitNo
messagecommit messageYes

Parameters specified as nested elements :

  • fileset
    Filesets are used to select sets of files to commit.

copy

Duplicate something in working copy or repository, remembering history.
source and destination can each be either a working copy (WC) path or URL:

  • WC->WC: copy and schedule for addition (with history)
  • WC->URL: immediately commit a copy of WC to URL
  • URL->WC: check out URL into WC, schedule for addition
  • URL->URL: complete server-side copy;  used to branch & tag

AttributeDescriptionRequired
srcPathsource pathOne of the two
srcUrlsource url
testPathdestination pathOne of the two
destUrldestination url
messagecommit messagewhen destUrl is set
revisionrevision to copy from (when srcUrl is set)
Possible values are :
- a date with the following format : MM/DD/YYYY HH:MM AM_PM
- a revision number
- HEAD, BASE, COMMITED or PREV
Default is "HEAD"
no

createRepository

Create a new, empty repository at path.

AttributeDescriptionRequired
pathPath where to create the new repositoryYes

Example:
<svn javahl="false">
<createRepository
path="repository"/>
</svn>

delete

If run on a working copy target, the item is scheduled for deletion upon the next commit.  Files, and directories that have not been committed, are immediately removed from the working copy. 
The command will not remove targets that are, or contain, unversioned or modified items; use the force attribute to override this behaviour.
If run on an url, the item is deleted from the repository via an immediate commit.

AttributeDescriptionRequired
filefile to deleteNo
urlurl to deleteNo
dirdirectory to deleteNo
messagecommit messagewhen url attribute is set
forcedefault is "false"No

Parameters specified as nested elements :

  • fileset
    Filesets are used to select sets of files to delete..

diff

Display the differences between two paths (oldPath and newPath) or two urls (oldUrl and newUrl).

AttributeDescriptionRequired
oldPathIf oldUrl is not set, defaults to the path '.'No
oldUrl No
oldTargetRevisiondefaults to BASE or, if oldUrl is set, to HEADNo
newPathdefaults to oldPath if oldUrl is not setNo
newUrl No
newTargetRevisiondefaults to the current working version or, if newUrl is set, to HEADNo
outFileDefault is 'patch'No
recurseSet to "false" to operate on single directory only. Default is "true" No

Example : diff between BASE and current working version
<svn javahl="${javahl}">
<diff
oldPath="workingcopy/diffTest/file.txt" outFile="workingcopy/diffTest/patch.txt"/>

</svn>

export

  1. Exports a clean directory tree from the repository specified by srcurl, at revision revision if it is given, otherwise at HEAD, into destPath.
  2. Exports a clean directory tree from the working copy specified by srcPath into destPath.  all local changes will be preserved, but files not under revision control will not be copied.

AttributeDescriptionRequired
srcUrlsource url to export fromOne of the two
srcPathsource path to export from
destPathdestination pathYes
revisionrevision of the source url to export from. Defaults is "HEAD"
Possible values are :
- a date with the following format : MM/DD/YYYY HH:MM AM_PM
- a revision number
- HEAD, BASE, COMMITED or PREV
No

ignore

Add a given file or a pattern to the ignored files list (modifies svn:ignore property)

AttributeDescriptionRequired
filefile to ignoreOne of the two
dirdirectory on which we will update svn:ignore property
patternpattern to add to svn:ignore on the directory
Only when dir is set
Yes
recurseSet to "true" to add the pattern recursively to directories. Default is "false"
Only when dir is set
No

Example :
<ignore dir="workingcopy/ignoreTest/dir1" pattern="*.ignore" recurse="true"/>

import

Commit an unversioned file or tree into the repository.
Recursively commit a copy of path to url.
If newEntry is not set, copy top-level contents of pathintourldirectly.  Otherwise, create newEntry underneath url and begin copy there.

AttributeDescriptionRequired
pathsource path to export fromYes
urlsource url to import toYes
newEntry No
messagecommit messageYes
recurseSet to "false" to operate on single directory only. Default is "true" False

keywordsset

Keywordsset controls which keywords will be substituted on the given files. Valid keywords are:

  • URL, HeadURL : The URL for the head version of the object.
  • Author, LastChangedBy : The last person to modify the file.
  • Date, LastChangedDate : The date/time the object was last modified.
  • Rev, LastChangedRevision : The last revision the object changed.
  • Id : A compressed summary of the previous

AttributeDescriptionRequired
fileFile for which keywords will be substitutedEither file, dir or filesets
dirAll files in this directory will have their keywords substituted (recursively)Either file, dir or filesets
keywordsThe keywords to substitute on the given filesNo
HeadURL/URL
Author, LastChangedBy
Date, LastChangedDate
Rev, LastChangedRevision
Id
Set to “true“ the keyword to substitute it on the given file. No

Parameters specified as nested elements :

  • fileset
    Filesets are used to select sets of files on which to apply keywords substitution.

keywordsadd

Keywordsadd add some keywords to be substituted on the given files. Present keywords are not modified.
The attributes are the same than for keywordsset command.

keywordsremove

Keywordsadd remove some keywords to be substituted on the given files. Other present keywords are not modified.
The attributes are the same than for keywordsset command.

mkdir

Create a new directory under revision control.
If target is a working copy path the directory is scheduled for addition in the working copy.  If target is an url the directory is created in the repository via an immediate commit. 
In both cases all the intermediate directories must already exist.

AttributeDescriptionRequired
pathpath to createOne of the two
urlurl to create
messagecommit messageYes

move

Move/rename something in working copy or repository.

  cource and destination can both be working copy (WC) paths or URLs:
    WC  -> WC:   move and schedule for addition (with history)
    URL -> URL:  complete server-side rename.

AttributeDescriptionRequired
srcPathsource pathOne of the two
srcUrlsource url
destPathdestination pathOne of the two
destUrldestination url
messagecommit messageYes

propdel

Remove a property from files or dirs.

AttributeDescriptionRequired
pathpath of the file or directory on which to delete the propertyYes
namename of the property to deleteYes
recurseif set, property will be removed recursivelyNo

propget

Get a property from a file or a directory.

AttributeDescriptionRequired
pathpath of the file or directory on which to get the propertyYes
namename of the property to getYes
propertythe name of the property to set with the value of the svn propertyOne of the two
filefile that will contain the value of the property

Example :
<propget path="workingcopy/propTest/file.png" name="svn:mime-type" property="propTest.mimeType"/>

propset

Set a property on files or dirs.

AttributeDescriptionRequired
pathpath of the file or directory on which to set the propertyYes
namename of the property to setYes
valuethe value of the propertyOne of the two
filethe file that will be used as a value
recurseif set, property will be set recursivelyNo

Note:svn recognizes the following special versioned properties but will store any arbitrary properties set:

  • svn:ignore : A newline separated list of file patterns to ignore.
  • svn:keywords : Keywords to be expanded.  Valid keywords are:
    • URL, HeadURL : The URL for the head version of the object.
    • Author, LastChangedBy : The last person to modify the file.
    • Date, LastChangedDate : The date/time the object was last modified.
    • Rev, LastChangedRevision : The last revision the object changed.
    • Id : A compressed summary of the previous 4 keywords.
  • svn:executable : If present, make the file executable. This property cannot be set on a directory.  A non-recursive attempt will fail, and a recursive attempt will set the property only on the file children of the directory
  • svn:eol-style : One of 'native', 'LF', 'CR', 'CRLF'.
  • svn:mime-type : The mimetype of the file.  Used to determine whether to merge the file, and how to serve it from Apache.
    A mimetype beginning with 'text/' (or an absent mimetype) is treated as text.  Anything else is treated as binary.
  • svn:externals : A newline separated list of module specifiers, each of which consists of a relative directory path, optional revision flags, and an URL.  For example
    foo http://example.com/repos/zig
    foo/bar -r 1234 http://example.com/repos/zag

revert

Restore pristine working copy file (undo most local edits).

AttributeDescriptionRequired
filefile to revertNo
dirdirectory to revertNo
recurseSet to "false" to operate on a single directory only (applies only when dir attribute is set). Default is "false"No
revisionrevision. Defaults is "HEAD"
Possible values are :
- a date with the following format : MM/DD/YYYY HH:MM AM_PM
- a revision number
- HEAD, BASE, COMMITED or PREV
No

Parameters specified as nested elements :

  • fileset
    Filesets are used to select sets of files to revert.

status

Get the status of working copy files and directories.

AttributeDescriptionRequired
pathpath of the file or directoryYes
textStatusPropertyName of the property to set to the status of the itemNo
propStatusPropertyName of the property to set to the status of the item propertiesNo
revisionPropertyName of the property to set to the revision of the item (or “” if unversioned)No
lastChangedRevisionPropertyName of the property to set to the last changed revision of the item (or “” if unversioned)No
lastCommitAuthorPropertyName of the property to set to the last commit author (or “” if unversioned)No
urlPropertyName of the property to set to the url of the itemNo

The value of TextStatusProperty can be :

  • non-svn
  • normal : no modifications
  • added
  • missing : item is missing (removed by non-svn command)
  • incomplete
  • deleted
  • replaced
  • modified
  • merged
  • conflicted
  • obstructed
  • ignored
  • external
  • unversioned
The value of propStatusProperty can be :
  • normal : no modifications
  • conflicted
  • modified

Example :
<status path="workingcopy/statusTest/added.txt" textStatusProperty="testStatus.textStatus" propStatusProperty="testStatus.propStatus" lastChangedRevisionProperty="testStatus.lastCommitRevision" revisionProperty="testStatus.revision" lastCommitAuthorProperty="testStatus.lastCommitAuthor"

switch

Update the working copy to mirror a new URL within the repository. This behaviour is similar to 'svn update', and is the way to move a working copy to a branch or tag within the same repository.

AttributeDescriptionRequired
pathThe working copy to switch to the given urlYes
urlThe url to switch toYes
recurseSet to "false" to operate on a single directory only. Default is "true"No
revisionrevision. Defaults is "HEAD"
Possible values are :
- a date with the following format : MM/DD/YYYY HH:MM AM_PM
- a revision number
- HEAD, BASE, COMMITED or PREV
No

Example :
<svn>

<switch
path="workingcopy/switchTest" url="${urlRepos}/switchTestBranch"/>

</svn>

update

Bring changes from the repository into the working copy.
If no revision given, bring working copy up-to-date with HEAD rev.  Else synchronize working copy to revision.

AttributeDescriptionRequired
filefile to updateNo
dirdirectory to updateNo
recurseSet to "false" to operate on a single directory only (applies only when dir attribute is set). Default is "true"No
revisionrevision. Defaults is "HEAD"
Possible values are :
- a date with the following format : MM/DD/YYYY HH:MM AM_PM
- a revision number
- HEAD, BASE, COMMITED or PREV
No
Parameters specified as nested elements :
  • fileset
    Filesets are used to select sets of files to update.

Examples

<svn>
<delete>
<fileset dir="workingcopy/deleteTest">
<include name="**/*.del"/> </fileset>
</delete>
<commit message="commit deleted files" dir="workingcopy/deleteTest"/>
</svn>
deletes some files from repository (and commit changes)

<svn javahl="false">
<add dir="workingcopy/propTest"/>
<commit message="propTest added" dir="workingcopy/propTest"/>
<propset path="workingcopy/propTest/file.png" name="svn:mime-type" value="image/png"/>
<propset path="workingcopy/propTest/file.png" name="myPicture" file="workingcopy/propTest/icon.gif"/>
</svn>
add my_repos/propTest to repository and set two properties on file.png
subversion command line interface is used (javahl="false").
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值