svn命令(svn命令使用详解)

本篇文章给大家谈谈svn命令,以及svn命令使用详解对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

svn的checkout命令?

1、进入想要拉取的本地文件夹目录,点击鼠标右键,选择“SVN Checkout”。

2、在弹出的对话框内,输入激桥远端SVN的地址,以及本地要保存的目录。

3、如果是第一次使用,可能会提示如下信息,告诉你的证书保存的时效性,选择上一项,永久保存。

4、输入SVN用户名和密码,如果需颂带要永久保存认证信息,勾选下方的“save authentication”。

5、此时,如果各项信息无误,SVN就会自动从远野铅芦程服务端下载项目代码。

svn命令行使用

命令: svn co url path

例如:

命令: svn up -r m path

例如:

命令:svn st -v path

例如:

命令: svn add file

例如:

命令: svn del path -m "斗团庆msg"

例如:

命令:空握 svn ci -m "或桥msg"

命令: svn log path

命令: svn diff path

如何在命令行通过SVN命令筛选出修改过的文件并递交

思路:

1,查看所有文件的状态

2,通过文件状态筛选出状态为“M”(修改)的文件

3,递交

解决办法:

1,输入命令:$svn st

查姿庆看所有文件的状态,比如:

guizhigngdemini:proj.ios guizhigang$ svn st

M channels/91/src/AppController.mm

M channels/91/src/dota_91.plist

M channels/i4/src/AppController.mm

M channels/itools/src/AppController.mm

M channels/itools/src/dota_itools.plist

M channels/ky/src/AppController.mm

M channels/pp/src/AppController.mm

M channels/tb/src/AppController.mm

M channels/xy/src/AppController.mm

M dota.xcodeproj/project.pbxproj

? dota.xcodeproj/xcshareddata/xcdebugger

可以看出我的环境下的输出结果

2,输入命令:$svn st | grep "M" | cut -c 8-modified.txt

以凯敬上命令将会把状态为M的文件筛选出来存入modified.txt文件,可以打开此文件查看是不是正确的。

3,只将modified.txt中记录的文件递交到SVN服务器

输入命令:svn ci -m "add buyGoods fun to every channel" --targets modified.txt

比如:

guizhigngdemini:proj.ios guizhigang$ svn ci -m "add buyGoods fun to every channel" --targets modified.txt

Sending channels/91/src/盯册慎AppController.mm

Sending channels/91/src/dota_91.plist

Sending channels/i4/src/AppController.mm

Sending channels/itools/src/AppController.mm

Sending channels/itools/src/dota_itools.plist

Sending channels/ky/src/AppController.mm

Sending channels/pp/src/AppController.mm

Sending channels/tb/src/AppController.mm

Sending channels/xy/src/AppController.mm

Sending dota.xcodeproj/project.pbxproj

Transmitting file data ..........

Committed revision 9413.

问题解决!

[img]

windows 怎么用svn命令

1、Windows下命令行工具:

发现原来安装的tortoisesvn已经集成到shell中,不能在命令行下使用。

下载Apache Subversion command line tools,这是一个可以在cmd下使用的命令行工具,解压后把里面bin目录这个路径添加到环境变量的path,这样在cmd下就可以使用了,和linux下使用svn的习惯一样了。

目录约定:

/trunck:开发主线

/branches:支线副本

/tags:标签副本(一旦创建,不允许修改)

1)使用trunk作为主要的开发目录

一般的,我们的所有的开发都是基于trunk进行开发,当一个版本(release)开发告一段落(开发、测试、文档、制作安装程序、打包等结束后),代码处樱答袭于冻结状态(人为规定,可以通过hook来进行管理)。此时应该基于当前冻结的代码库,打tag。

当下一个版本/阶段的开发任务开始时,继续在trunk进行开发。此时,如果发现了上一个已发行版本(Released Version)有一些bug,或者一些很急迫的功能要求,而正在开发的版本(Developing Version)无法满足时间要求,这时候就需要在上一个版本上进行修改了。解决方法是基于发行版对应的tag,做相应的分支(branch)进行开发。

2)下图为struts2的SVN仓库目录:

3、常用命令

svn help

svn --version

svn --version --quiet    只显示版本号

svn checkout 地址

svn add 文件或者文件夹    增加本地数据到服务器

svn commit / svn ci -m “注释”  文件名   提交代码,要先add才commit

svn update / svn up 不必跟特定的文件或目录,也可以自己指定需要更新的文件或目录。每次commit或者改动之前最好更新一下。

svn log

svn delete 文件名

svn resolve 路径 --accept working    解决冲突

svn switch 远程路径    版本切换

svn list 路径 / svn ls    列出版本库下的文件和目录

svn merge -r m:n 路径     合并文件,从版本号m到版本号n的远程分支都合并到当前分支中

svn info 确认工作目录的svn信息

svn diff -r m:n 路径    对版本m和版本n比较差异

svn cleanup     为失败的失误清场

svn status -v    在本地进行代码修改,检查修改状态

svn import 远程路径 --message “message”   将当前路径下文件导入到版本库中

svn export 远程路径    导出一份干净的项目

svn move/ svn mv 原文件名 新文件名    举前重命名

svn mkdir 文件名

svn copy / svn cp 源文件路径 新文件路径

svn revert 文件名     只能恢复未提交之前的操作

若要还原已提交的改动:只能用旧文件覆盖新文件。操作如下:

1)sun up    让本地工作拷贝更新到最新状态

2)svn log your_file_path     查看文件日志,这时候提交时填写的说明信息就派上用场了

3)svn diff -r 旧修订版序号:新修订版序号 your_file_path    查看两个修订版之间的不同。

4)决定用哪个旧的修订版号后,用旧的修订版号文件覆盖新的修订版号文件。svn merge -r 新修订版序号:旧修订版序号 your_file_path

5)svn commit -m "恢复到某修订版(某修订版作废脊兄)"

本地的版本叫做working copy

4、关于merge

branch主要用于新功能的开发

合并发生在本地working copy,只要你不提交就不会影响到repository

合并前一定要先update、commit,保证不会out of day,并将本地的修改保存到repository

branch和trunk并行开发的过程中,要经常同步,将trunk的修改合并到branch,合并时选择"Merge a range of revision"

branch最后合并回trunk时,merge type选择"Reintegrate a branch"

不管是从trunk合并到branch还是最终从branch合并回trunk,在每次合并前最好先update,然后将本地的修改先全部commit,保护好现场,万一合并不理想随时都可以revert 

5、关于解决冲突

发生冲突之后会出现三个临时文件:

XXX.mine XXX.r1 XXX.r2

一旦解决了冲突,需用svn resolved让subversion知道,这样就会删除这三个临时文件,冲突状态解决。

三种解决方式:

手工合并冲突:需要将冲突标志删除

用某一个临时文件覆盖自己的工作文件

用svn revert 放弃本地修改,不需要执行resolved

SVN命令行怎么用?

SVN Commit

"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:%f /notempfile /closeonend

SVN CommitAll

"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe"谈银 /command:commit /path:* /含渣宴notempfile /closeonend

SVN Diff

"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:diff /path:%f /notempfile /梁冲closeonend

SVN Log

"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:log /path:%f /notempfile /closeonend

SVN Update

"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:update /path:%f /notempfile /closeonend

SVN UpdateAll

"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:update /path:* /notempfile /closeonend

Source Monitor

D:\SourceMonitor\SourceMonitor /DC++ %f

如何用命令行实现TortoiseSVN命令

TortoiseSVN是一个GUI客户端,这个自动化指导为你展示了让TortoiseSVN对话框显示并收集客户输入,如果你希望编写不需要输入的脚本,你应该使用官方的Subversion命令行客户端。

TortoiseSVN的GUI程序叫做TortoiseProc.exe。所有的命令通过参数/command:asdf指定,其中asdf是必须的命令名(命令名详见”表 1. 有效命令及选项列表“)。大多数此类命令至少需要一个路径参数,使用/path:"some\path"指定。在下面的命令表格中,命令引用的是/command:asdf参数,余下的代表了/path:"some\path"参数。

因为一些命令需要一个目标路径的列表(例如提交一些特定的文件),/path参数可以接收多个路径,使用*分割。

TortoiseSVN 使用临时文件在 shell 扩展和主程序之间传递多个参数。从 TortoiseSVN 1.5.0 开始,废弃/notempfile参数,不再需要增加此参数。

The progress dialog which is used for commits, updates and many more commands usually stays open after the command has finished until the user presses theOK button. This can be changed by checking the corresponding option in the settings dialog. But using that setting will close the progress dialog, no matter if you start the command from your batch file or from the TortoiseSVN context menu.

To specify a different location of the configuration file, use the parameter /configdir:"path\to\config\directory". This will override the default path, including any registry setting.

如果想在进度对话框执行完毕后自动关闭,而又不必设置永久性的参数,可以传递/closeonend参数。

/closeonend:0 不自动关闭对话框

/closeonend:1 如果没发生错冲衡隐误则自动关闭对话框

/closeonend:2 如果没发生错误和冲突则自动关闭对话框

/closeonend:3如果没有错误、冲突和合并,会自动关闭

下面的列表列出了所有可以使用TortoiseProc.exe访问的命令,就像上面的描述,必须使用/command:asdf的形式,在列表中,因为节省空间的关系省略了/command的前缀。

表 1. 有效命令及选项列表

命令

描述

:about 显示关于对话框。如果没有给命令也会显示。

:log 打开日志对话框,/path 指定了显示日志的文件或目录,另外还有三个选项可以设置: /startrev:xxx、/endrev:xxx和/strict

:checkout 打开检出对话框,/path指定了目标路径,而/url制定了检出的URL。

:import 打开导入对话框,/path 指定了数据导入路径。

:update 将工作副本的/path更新到HEAD,如果给定参数/rev,就会弹出一个对话框询散厅问用户需要更新到哪个修订版本。为了防止指定修订版本号/rev:1234的对话框,需要选项/nonrecursive和/ignoreexternals。

:commit 打开提交对话框,/path 指定了目标路径或需要提交的文件列表,你也可以使用参数 /logmsg 给提交窗口传递预定义的日志信息,或者你不希望将日志传递给命令行,你也可以使用/logmsgfile:path,path 指向了保存日志信息的文件。为了预先填入bug的ID(如果你设置了集成bug追踪属性),你可以使用/bugid:"the bug id here"完成拦笑这个任务。

:add 将/path的文件添加到版本控制 。

:revert 恢复工作副本的本地修改,/path说明恢复哪些条目。

:cleanup 清理中断和终止的操作,将工作副本的/path解锁。

:resolve 将/path指定文件的冲突标示为解决,如果给定/noquestion,解决不会向用户确认操作。

:repocreate 在/path创建一个版本库。

:switch 打开选项对话框。/path 指定目标目录。

:export 将/path的工作副本导出到另一个目录,如果/path指向另一个未版本控制目录,对话框会询问要导出到/path的URL。

:merge Opens the merge dialog. The /path specifies the target directory. For merging a revision range, the following options are available: /fromurl:URL, /revrange:string. For merging two repository trees, the following options are available: /fromurl:URL, /tourl:URL, /fromrev:xxx and /torev:xxx. These pre-fill the relevant fields in the merge dialog.

:mergeall Opens the merge all dialog. The /path specifies the target directory.

:copy Brings up the branch/tag dialog. The /path is the working copy to branch/tag from. And the /url is the target URL. You can also specify the /logmsg switch to pass a predefined log message to the branch/tag dialog. Or, if you don't want to pass the log message on the command line, use /logmsgfile:path, where path points to a file containing the log message.

:settings 打开设置对话框。

:remove 从版本控制里移除/path中的文件。

:rename 重命名/path的文件,会在对话框中询问新文件,为了防止一个步骤中询问相似文件,传递/noquestion。

:diff Starts the external diff program specified in the TortoiseSVN settings. The /path specifies the first file. If the option /path2 is set, then the diff program is started with those two files. If /path2 is omitted, then the diff is done between the file in /path and its BASE. To explicitly set the revision numbers use /startrev:xxx and /endrev:xxx. If/blame is set and /path2 is not set, then the diff is done by first blaming the files with the given revisions.

:showcompare

Depending on the URLs and revisions to compare, this either shows a unified diff (if the option unified is set), a dialog with a list of files that have changed or if the URLs point to files starts the diff viewer for those two files.

The options url1, url2, revision1 and revision2 must be specified. The options pegrevision, ignoreancestry, blame and unified are optional.

:conflicteditor Starts the conflict editor specified in the TortoiseSVN settings with the correct files for the conflicted file in /path.

:relocate 打开重定位对话框,/path指定了重定位的工作副本路径。

:help 打开帮助文件

:repostatus 打开为修改检出对话框,/path 指定了工作副本目录。

:repobrowser Starts the repository browser dialog, pointing to the URL of the working copy given in /path or /path points directly to an URL. An additional option /rev:xxx can be used to specify the revision which the repository browser should show. If the /rev:xxx is omitted, it defaults to HEAD. If /path points to an URL, the /projectpropertiespath:path/to/wcspecifies the path from where to read and use the project properties.

:ignore 将/path中的对象加入到忽略列表,也就是将这些文件添加到 svn:ignore 属性。

:blame

为 /path 选项指定的文件打开追溯对话框。

如果设置了 /startrev 和 /endrev 选项,不会显示询问追溯范围对话框,直接使用这些选项中的版本号。

如果设置了 /line:nnn 选项,TortoiseBlame 会显示指定行数。

也支持 /ignoreeol,/ignorespaces 和 /ignoreallspaces 选项。

:cat 将/path指定的工作副本或URL的文件保存到/savepath:path,修订版本号在/revision:xxx,这样可以得到特定修订版本的文件。

:createpatch 创建/path下的补丁文件。

:revisiongraph 显示/path目录下的版本变化图。

:lock Locks a file or all files in a directory given in /path. The 'lock' dialog is shown so the user can enter a comment for the lock.

:unlock Unlocks a file or all files in a directory given in /path.

:rebuildiconcache Rebuilds the windows icon cache. Only use this in case the windows icons are corrupted. A side effect of this (which can't be avoided) is that the icons on the desktop get rearranged. To suppress the message box, pass /noquestion.

:properties 显示 /path 给出的路径之属性对话框。

Examples (which should be entered on one line):

TortoiseProc.exe /command:commit

/path:"c:\svn_wc\file1.txt*c:\svn_wc\file2.txt"

/logmsg:"test log message" /closeonend:0

TortoiseProc.exe /command:update /path:"c:\svn_wc\" /closeonend:0

TortoiseProc.exe /command:log /path:"c:\svn_wc\file1.txt"

/startrev:50 /endrev:60 /closeonend:0

关于svn命令和svn命令使用详解的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

标签列表