`

svn命令

阅读更多

The Subversion Command-Line Client: svn

To use the command-line client, type svn , the subcommand you wish to use, [56 ] and any options or targets that you wish to operate on—the subcommand and the options need not appear in a specific order. For example, all of the following are valid ways to use svn status :

$ svn -v status
$ svn status -v 
$ svn status -v myfile

You can find many more examples of how to use most client commands in Chapter 2, Basic Usage and commands for managing properties in the section called “Properties” .

svn Options

While Subversion has different options for its subcommands, all options exist in a single namespace—that is, each option is guaranteed to mean the same thing regardless of the subcommand you use it with. For example, --verbose (-v ) always means “verbose output, ” regardless of the subcommand you use it with.

The svn command-line client usually exits quickly with an error if you pass it an option which does not apply to the specified subcommand. But as of Subversion 1.5, several of the options which apply to all—or nearly all—of the subcommands have been deemed acceptable by all subcommands, even if they have no effect on some of them. They appear grouped together in the command-line client's usage messages as global options. This was done to assist folks who write scripts which wrap the command-line client. These global options are as follows:

--config-dir DIR

Instructs Subversion to read configuration information from the specified directory instead of the default location (.subversion in the user's home directory).

--no-auth-cache

Prevents caching of authentication information (e.g., username and password) in the Subversion runtime configuration directories.

--non-interactive

Disables all interactive prompting. Some examples of interactive prompting include requests for authentication credentials and conflict resolution decisions. This is useful if you're running Subversion inside an automated script and it's more appropriate to have Subversion fail than to prompt for more information.

--password PASSWD

Specifies the password to use when authenticating against a Subversion server. If not provided, or if incorrect, Subversion will prompt you for this information as needed.

--username NAME

Specifies the username to use when authenticating against a Subversion server. If not provided, or if incorrect, Subversion will prompt you for this information as needed.

The rest of the options apply and are accepted by only a subset of the subcommand. They are as follows:

--accept ACTION

Specifies an action for automatic conflict resolution. Possible actions are postpone , base , mine-full , theirs-full , edit , and launch .

--auto-props

Enables auto-props, overriding the enable-auto-props directive in the config file.

--change (-c ) ARG

Used as a means to refer to a specific “change ” (a.k.a. a revision). This option is syntactic sugar for “-r ARG-1:ARG ”.

--changelist ARG

Instructs Subversion to operate only on members of the changelist named ARG . You can use this option multiple times to specify sets of changelists.

--cl ARG

An alias for the --changelist option.

--depth ARG

Instructs Subversion to limit the scope of an operation to a particular tree depth. ARG is one of empty , files , immediates , or infinity .

--diff-cmd CMD

Specifies an external program to use to show differences between files. When svn diff is invoked without this option, it uses Subversion's internal diff engine, which provides unified diffs by default. If you want to use an external diff program, use --diff-cmd . You can pass options to the diff program with the --extensions option (more on that later in this section).

--diff3-cmd CMD

Specifies an external program to use to merge files.

--dry-run

Goes through all the motions of running a command, but makes no actual changes—either on disk or in the repository.

--editor-cmd CMD

Specifies an external program to use to edit a log message or a property value. See the editor-cmd section in the section called “Config” for ways to specify a default editor.

--encoding ENC

Tells Subversion that your commit message is encoded in the charset provided. The default is your operating system's native locale, and you should specify the encoding if your commit message is in any other encoding.

--extensions (-x ) ARGS

Specifies an argument or arguments that Subversion should pass to an external diff command. This option is valid only when used with the svn diff or svn merge commands, with the --diff-cmd option. If you wish to pass multiple arguments, you must enclose all of them in quotes (e.g., svn diff --diff-cmd /usr/bin/diff -x "-b -E" ).

--file (-F ) FILENAME

Uses the contents of the named file for the specified subcommand, though different subcommands do different things with this content. For example, svn commit uses the content as a commit log, whereas svn propset uses it as a property value.

--force

Forces a particular command or operation to run. Subversion will prevent you from performing some operations in normal usage, but you can pass the force option to tell Subversion “I know what I'm doing as well as the possible repercussions of doing it, so let me at 'em. ” This option is the programmatic equivalent of doing your own electrical work with the power on—if you don't know what you're doing, you're likely to get a nasty shock.

--force-log

Forces a suspicious parameter passed to the --message (-m ) or --file (-F ) option to be accepted as valid. By default, Subversion will produce an error if parameters to these options look like they might instead be targets of the subcommand. For example, if you pass a versioned file's path to the --file (-F ) option, Subversion will assume you've made a mistake, that the path was instead intended as the target of the operation, and that you simply failed to provide some other—unversioned—file as the source of your log message. To assert your intent and override these types of errors, pass the --force-log option to subcommands that accept log messages.

--help (-h ) or -? )

If used with one or more subcommands, shows the built-in help text for each. If used alone, it displays the general client help text.

--ignore-ancestry

Tells Subversion to ignore ancestry when calculating differences (rely on path contents alone).

--ignore-externals

Tells Subversion to ignore externals definitions and the external working copies managed by them.

--incremental

Prints output in a format suitable for concatenation.

--keep-changelists

Tells Subversion not to delete changelists after committing.

--keep-local

Keeps the local copy of a file or directory (used with the svn delete command).

--limit (-l ) NUM

Shows only the first NUM log messages.

--message (-m ) MESSAGE

Indicates that you will specify either a log message or a lock comment on the command line, following this option. For example:

$ svn commit -m "They don't make Sunday."

--new ARG

Uses ARG as the newer target (for use with svn diff ).

--no-auto-props

Disables auto-props, overriding the enable-auto-props directive in the config file.

--no-diff-deleted

Prevents Subversion from printing differences for deleted files. The default behavior when you remove a file is for svn diff to print the same differences that you would see if you had left the file but removed all the content.

--no-ignore

Shows files in the status listing that would normally be omitted since they match a pattern in the global-ignores svn:ignore property. See the section called “Config” and the section called “Ignoring Unversioned Items” for more information. configuration option or the

--no-unlock

Tells Subversion not to automatically unlock files (the default commit behavior is to unlock all files listed as part of the commit). See the section called “Locking” for more information.

--non-recursive (-N )

Deprecated . Stops a subcommand from recursing into subdirectories. Most subcommands recurse by default, but some subcommands—usually those that have the potential to remove or undo your local modifications—do not.

--notice-ancestry

Pays attention to ancestry when calculating differences.

--old ARG

Uses ARG as the older target (for use with svn diff ).

--parents

Creates and adds nonexistent or nonversioned parent subdirectories to the working copy or repository as part of an operation. This is useful for automatically creating multiple subdirectories where none currently exist. If performed on a URL, all the directories will be created in a single commit.

--quiet (-q )

Requests that the client print only essential information while performing an operation.

--record-only

Marks revisions as merged (for use with --revision ).

--recursive (-R )

Makes a subcommand recurse into subdirectories. Most subcommands recurse by default.

--reintegrate

Used with the svn merge subcommand, merges all of the source URL's changes into the working copy. See the section called “Keeping a Branch in Sync” for details.

--relocate FROM TO [PATH...]

Used with the svn switch subcommand, changes the location of the repository that your working copy references. This is useful if the location of your repository changes and you have an existing working copy that you'd like to continue to use. See svn switch for an example.

--remove ARG

Disassociates ARG from a changelist

--revision (-r ) REV

Indicates that you're going to supply a revision (or range of revisions) for a particular operation. You can provide revision numbers, keywords, or dates (in curly braces) as arguments to the revision option. If you wish to offer a range of revisions, you can provide two revisions separated by a colon. For example:

$ svn log -r 1729
$ svn log -r 1729:HEAD
$ svn log -r 1729:1744
$ svn log -r {2001-12-04}:{2002-02-17}
$ svn log -r 1729:{2002-02-17}

See the section called “Revision Keywords” for more information.

--revprop

Operates on a revision property instead of a property specific to a file or directory. This option requires that you also pass a revision with the --revision (-r ) option.

--set-depth ARG

Sets the sticky depth on a directory in a working copy to one of empty , files , immediates , or infinity .

--show-revs ARG

Used to make svn mergeinfo display either merged or eligible revisions.

--show-updates (-u )

Causes the client to display information about which files in your working copy are out of date. This doesn't actually update any of your files—it just shows you which files will be updated if you then use svn update .

--stop-on-copy

Causes a Subversion subcommand that traverses the history of a versioned resource to stop harvesting that historical information when a copy—that is, a location in history where that resource was copied from another location in the repository—is encountered.

--strict

Causes Subversion to use strict semantics, a notion that is rather vague unless talking about specific subcommands (namely, svn propget ).

--targets FILENAME

Tells Subversion to get the list of files that you wish to operate on from the filename that you provide instead of listing all the files on the command line.

--use-merge-history (-g )

Uses or displays additional information from merge history.

--verbose (-v )

Requests that the client print out as much information as it can while running any subcommand. This may result in Subversion printing out additional fields, detailed information about every file, or additional information regarding its actions.

--version

Prints the client version info. This information includes not only the version number of the client, but also a listing of all repository access modules that the client can use to access a Subversion repository. With --quiet (-q ) it prints only the version number in a compact form.

--with-all-revprops

Used with the --xml option to svn log , will retrieve and display all revision properties in the log output.

--with-revprop ARG

When used with any command that writes to the repository, sets the revision property, using the NAME=VALUE format, NAME to VALUE . When used with svn log in --xml mode, this displays the value of ARG in the log output.

--xml

Prints output in XML format.

svn Subcommands

Here are the various subcommands for the svn program. For the sake of brevity, we omit the global options (described in the section called “svn Options” ) from the subcommand descriptions which follow.



[56 ] Well, you don't need a subcommand to use the --version option, but we'll get to that in just a minute.

分享到:
评论

相关推荐

    svn在linux下的使用(svn命令)

    svn 在 Linux 下的使用(svn 命令) svn 是一个版本控制系统,允许多人合作开发项目,追踪文件的变化历史记录,避免文件冲突和丢失。下面介绍 svn 在 Linux 下的使用和常用命令。 1. 将文件 checkout 到本地目录 ...

    svn命令大全.docx

    "svn命令大全" SVN(Subversion)是一种版本控制系统,主要用于管理软件开发过程中的代码修改和更新。下面是 Linux 下 SVN 命令大全介绍: 一、checkout 命令 checkout 命令用于将文件从服务器 checkout 到本地...

    svn命令操作手册大全

    **SVN 命令操作手册大全** **一、Svnadmin 概述** Svnadmin 是 Subversion(简称 SVN)中的一个管理工具,用于创建、维护和操作 SVN 仓库。它提供了对仓库的底层控制,允许管理员执行如创建、备份、恢复等高级操作...

    linux下svn命令大全.txt

    下面将详细解析从给定文件中提取的关键SVN命令及其功能,这将帮助你在Linux系统中更有效地管理和操作SVN仓库。 ### 1. 检出 (Checkout) `svn checkout path path` 命令用于从SVN仓库检出项目到本地目录。例如,`...

    ubuntu SVN命令大全

    ### Ubuntu SVN 命令大全解析 #### 一、Checkout (检出) **命令格式**: ``` svn checkout [URL] [本地路径] ``` **示例**: ``` svn checkout svn://192.168.1.1/pro/domain ``` **功能说明**: - `svn ...

    linux下的 svn命令

    通过svn命令,用户可以实现对代码库的多种操作,包括检出、添加、提交、更新、查看状态、删除、查看日志、比较差异、合并版本等。以下是对这些常见svn命令的详细解释: 1. **检出(Checkout)**: `svn checkout` 或 `...

    linux下SVN命令全解

    本文将详细解析Linux环境下常用的SVN命令及其用法。 1. **Checkout**: `svn checkout` 或 `svn co` 命令用于从远程仓库克隆项目到本地工作目录。例如: ``` svn checkout svn://192.168.1.1/pro/domain ``` 2...

    svn命令再封装

    ### SVN命令再封装详解 #### 一、引言 在软件开发过程中,版本控制系统是必不可少的工具之一。Subversion(SVN)作为一款经典的集中式版本控制系统,在许多项目中仍被广泛使用。然而,对于一些复杂的操作场景,...

    linix fedora svn命令大全

    以下是对标题和描述中涉及的svn命令的详细解释: 1. **Checkout(检出)** `svn checkout` 或 `svn co` 用于从远程仓库下载项目到本地工作目录,例如: ``` svn checkout svn://192.168.1.1/pro/domain ``` 2....

    SVN命令及外部定义用法

    ### SVN命令详解 1. **`svn checkout (简称 svn co)`**:用于从服务器上检出一份工作副本到本地。 2. **`svn update (简称 svn up)`**:更新本地工作副本,获取服务器上的最新更改。 3. **`svn commit (简称 svn ci...

    Linux下SVN命令使用大全

    ### Linux下SVN命令使用大全 #### 一、概述 Subversion (SVN) 是一款开源版本控制系统,广泛应用于软件开发和其他需要版本控制管理的领域。在Linux环境下使用SVN,能够有效地帮助开发者管理和协作代码。本文档将...

    SVN打基线常用命令使用介绍

    在了解了打基线的基本概念之后,接下来详细介绍一些常用的SVN命令,这些命令可以帮助我们在SVN中有效地进行打基线操作。 ##### 1. 创建标签(tag) 创建标签是一种非常简单的方式,可以用来记录项目的一个快照。...

    linux下的svn命令操作大全借鉴.pdf

    Linux 下的 SVN 命令操作大全借鉴 本文档对 Linux 下的 SVN 命令操作进行了详细的介绍,从基本的 checkout 到 commits、更新、锁定、解锁、状态查看、删除、日志查看、信息查看、差异比较、合并等多个方面对 SVN ...

    svn命令大全[PDF格式]

    ### SVN命令大全解析 #### 一、概述 Subversion(简称SVN)是一种开源的版本控制系统,用于管理软件项目的源代码。它可以帮助开发者们更好地跟踪和管理代码的变化历史,支持团队协作开发。本文将详细介绍SVN中的...

    linux下svn命令大全.pdf

    Linux 下 SVN 命令大全 Linux 下 SVN 命令大全是 Subversion 版本控制系统的命令行接口,提供了许多功能强大且灵活的命令来管理项目代码的版本控制。下面是 Linux 下 SVN 命令大全的详细介绍。 配置 SVN 在 Linux...

Global site tag (gtag.js) - Google Analytics