一、SVN客户端:TortoiseSvn

下载地址: http://tortoisesvn.net/downloads.html

安装完后重启, 右击就可以使用SVN命令

首先, 从服务器版本库那边 svn Checkout....代码, 放到本地

在checkout目录下(带有.svn文件夹), 主要有以下命令:

常用的 SVN Add...  Delete...  Rename...  Update to revision.... Revert  Get lock/Releae lock...

本地Update 出服务器上最新代码

add/delete/edit/rename file 都只是在本地做修改,  要执行 commit 操作才能提交到服务器上。

二、SVN服务器:Subversion

1、安装

下载地址:http://www.visualsvn.com/

个人认为最好用VisualSVN server服务端和TortoiseSVN客户端搭配使用

安装完成后, 点击Window->VisualSVN->VisualSVN Server Manager, 就可以直接使用应用管理器来操作SVN 库

2、SVN 仓库

在Repositories可以CreateNewRepository,新建新的库, 选择库的结构如下:

1)、三个子目录的区别:

tag,一般情况下, 是用来做一个milestone的,不管是不是release,都是一个可用的版本。这里,应该是只读的。更多的是一个显示用的,给人一个可读(readable)的标记。

branch,是用来做并行开发的

trunk, 是主线

2)、仓库转移

(eg: move RepA to RepB)

•Copy RepA Repositories forder to  RepB
•Open RepB VisualSVN Server Manager
•Right click Repositories->All Tasks->import existing repository
•Copy the file ‘groups.conf’  ‘htpasswd’ ‘authz’ from RepA to RepB again to keep the permission set.
 
3、权限控制
 
Create User
Create Groups and add users
Then you can add access permissions in any directory levels or specific file.
 
4、svn hook
建完仓库后, 每个仓库下, 都有一个D:\SVNrepository\myRepositoryt\hooks 文件夹, 放SVN钩子程序, 用来提供的第三方增加自定义事物处理, 比如:
•start commit: excute when you click ’ok’,eg: judge if user has right to commit.
•pre commit: excute before the change is saved to Rep,eg: check whether the log as expected.
•post commit: excute after commit transtion end,eg:you can redeploy environment automatically by add some batch commands.

特定hook类型里面有特定提供的参数,如

REPOS 路径, TXN 事物,USER 用户…

Test.py %REPOS% %TXN% call python/perl..script to achieve more functional control.

示例:

window下, 建pre-commit.bat文件, 放在hooks下, 则该仓库下执行commit时, 必须输入10个字符。 默认安装下,svn可以无comment提交

  1. @echo off
  2. setlocal
  3. set SVN_BINDIR="D:\Program Files\VisualSVN Server\bin"
  4. set REPOS=%1
  5. set TXN=%2
  6. rem check that logmessage contains at least 10 characters
  7. %SVN_BINDIR%\svnlook log "%REPOS%" -t "%TXN%" | findstr ".........." > nul
  8. if %errorlevel% gtr 0 goto err
  9. exit 0
  10. :err
  11. echo Empty log messge not allowed.Please log at least 10 characters! 1>&2
  12. exit 1

SVN_BINDIR是svnserver安装路径下的bin文件夹

5、svn ignore

整个project内部, 可以把某些不想加入版本控制的文件夹, 或者特定文件类型做ignore

比如, target文件夹, 右击点击 add to ignore list(target, target recursively), 回复版本控制, 就remove from ignore list.

 

三、版本控制过程

1、Create a repository

1)Right click in Repositories and create New Repository…

2)Select the second Radio to create a Repository with trunk/baches/tags

3)You can also set access permissions  here.

2、Import project to ${repName}/trunk

Go to the project Directory, click svn->import, input the trunk path (get path:copy the trunk URL by right click at trunk folder and click ’copy URL to clipboard’)

3、Check out trunk code to local

New a directory ’svnTrunk’  to store trunk code, then you can excute new Branch/tag, merge etc.

4、New branches Right click in ‘svnTrunk’ and right click->svn->Branch/tag…

note:不要在branches上先建branch_1文件夹再以此为目录地址来copy,这样会提示Path 'branches/branch_1' already exists,认为branch_1就是已经建好分支, 不能再建),同样方式, 可以创建很多个分支, 并行开发

After  new branch in Repository

We can check out the branch code to working copy

Develop………….

Commit code to branch

5. Merge trunk to branch

Note:to avoid a world of difference between branch and trunk, we’d better make branch keep pace with trunk by merge trunk to branch.

Also, we’d better merge trunk to branch before doing merge to trunk

1)Select ‘Merge a range of revision’

2)Input trunk path, Revision range to merge

note: How to decide the merge Revisions:

Click show log to sure what the versions to merge.

3)Resolve the confict, and compile/test_compile the project

4)Commit to RepositoryT1/branches/branch_2 after step5.3 build success.

Continue to develop in branch_2

Commit chages in branch_2 to branch_2 Repository …

Repeat step5 to keep branch sync with trunk when necessary.

Merge branch_2 to trunk as step6

Merge trunk to branch  again to Mark the newest version(RecordOnly)

6.Merge branch to trunk

1)Select ‘Reintegrate a branch’

2)Input the branch_1 path to ‘From URL’

3)Click ‘Test merge’ Button to test if it has many conflicts.

4) Resolve the confict, and compile/test_compile the project

5) Commit to RepositoryT1/trunk after step6.4 build success.

7.Copy trunk to tag

Copy trunk to tag when we released a stable version.

8.Merge summary

1)Remember to update to newest version in working copy before merge

2)Step 1-2 Corresponds to ‘version-control step6’

3)Step 3-4 Conrreponds to ‘version-control step5’

4)Do step1-2 frequently to keep branch sync with trunk.

trunk log:

在Log Messages窗口的左下角勾选了"Include merged revisions"你还能看到额外的Merge information:

其中灰色的log, 是branch里自己变化的log , 包括了版本信息。

SVN Application的更多相关文章

  1. 版本控制系统-SVN(1)

    1.   SVN介绍 1.1.  简介 SVN(subversion),版本管理工具,与CVS一样,SVN是一个可跨平台的开源版本控制系统,Subversion管理随时间变化的数据.这些数据都被放置在 ...

  2. SVN打patch,某Java文件提示svn:mime-type = application/octet-stream的问题

    在使用SVN合版本时发现某文件有冲突,正常冲突文件是可以编辑修改的,但是该文件无法编辑,我只好选择后续修改选项,问题好诡异啊!!!在解决完其他冲突后,我选择了在eclipse开发工具内将修改的代码调整 ...

  3. 【工匠大道】 svn命令自己总结

     本文地址   分享提纲: 1. svn 不常见单有用的命令 2. svn查看切换用户 1. svn自己总结的一些不常见,但有用的命令 1)[导出svn不带版本代码]导出不带svn版本控制的代码到本地 ...

  4. 解决eclipse中svn插件总是提示输入密码的问题

    一.背景 最近在eclipse中使用svn插件进行远程仓库代码管理时,老是出现提示让输入密码,特别烦人,经过努力,终于解决该问题,拿来和大家分享~ 二.svn插件密码机制以及出现问题的原因分析 当我们 ...

  5. 搭建 SVN 服务器

    安装.启动 SVN 服务器 在 Windows 下,可以使用以下命令将 SVN 服务注册到 windows 服务中去: sc create svnserver binPath= "drive ...

  6. Windows Server配置Jenkins,实现监测SVN提交自动构建.net4.5的项目

    1,持续集成 概念:http://baike.baidu.com/view/5253255.htm,对于大多数人而言,自动构建/自动测试/自动部署,已经很发挥它的价值了.选择上: 推荐jenkins, ...

  7. Eclipse切换SVN用户

    1. 点击windows --> preference --> Team --> SVN,查看当前的SVN接口. 2. 如果SVN接口是JavaHL,那么找到C:\Documents ...

  8. eclipse svn账号更换

    在eclipse下用 svn的时候,我们习惯将用户名和密码保存.前天公司将svn的账号全部更换了,这时原来的eclipse保存的svn账号密码就失效了.那怎么样才能切换账号了,eclipse svn插 ...

  9. svn 修改文件的二进制或文本标记

    在添加一个文件的时候,svn自动标记成了二进制文件.当时也没在意就提交了.结果修改了之后不能进行svn diff操作,说是二进制文件不能进行diff操作.在网上找了个方法,修改这个文件的标记属性,把这 ...

随机推荐

  1. ecshop的smarty库还原成smarty原生库方法

    写过ecshop模板的人都晓得,他们是用所谓的dwt的文件来嵌套lbi文件进行模板的彼此调用.在咱们调取数据的时分,ecshop的默许模板只提供给咱们几个简略的句子进行调用,那么有没有办法能够把这个精 ...

  2. 测试URL有效性

    方法一: #禁用滚动条 $ProgressPreference='silentlycontinue' Invoke-WebRequest "www.163.com" -UseBas ...

  3. char数组与char指针

    1.以字符串形式出现的,编译器会在结尾自动添加\0,思考,为什么? 存在的C语言方法,如strlen(s),计算字符串的长度,其中s指针.strlen要计算字符串长度,必须知道哪里是结尾,因此使用\0 ...

  4. Codeforces 278C Learning Languages(并查集)

    题意抽象出来就是求联通块的个数吧,然后添加最少边使图联通. 注意所有人都不会任何语言的时候,答案是n而不是n-1. #include<algorithm> #include<iost ...

  5. android UI进阶之实现listview的分页加载

    上篇博文和大家分享了下拉刷新,这是一个用户体验非常好的操作方式.新浪微薄就是使用这种方式的典型. 还有个问题,当用户从网络上读取微薄的时候,如果一 下子全部加载用户未读的微薄这将耗费比较长的时间,造成 ...

  6. Word2010 清除样式

    使用场景         有时候我们在网页上面粘贴一些精华文章或者从去整理别人已经完成的word的时候,会发现它自带的格式,可能并不是我们所理想的格式,所以此时就不得不去重新编辑其格式,但是word里 ...

  7. 打开Excel时提示"您尝试打开的文件**.xls的格式与文件扩展名指定的格式不一致"

    问题描述:     系统安装了WPS时,Analyzer导出excel时候,会提示"您尝试打开的文件**.xls的格式与文件扩展名指定的格式不一致",这是Excel的安全问题,   ...

  8. PAT 1003

    1003. Emergency (25) As an emergency rescue team leader of a city, you are given a special map of yo ...

  9. JavaScript触摸与手势事件

    JavaScript触摸与手势事件 发表于 2012-12-10 由 admin iOS版Safari为了向开发人员传达一些特殊信息,新增了一些专有事件.因为iOS设备既没有鼠标也没有键盘,所以在为移 ...

  10. 基于Qt的开源音乐播放器(CZPlayer)

    CZPlayer CZPlayer是基于Qt开发的一款功能强大的音乐播放器,该播放器的论坛地址请点击here,目前CZPlayer已经是第四个版本了,历史版本也分别在我的github上, github ...