svn搭建

yum install -y subversion

mkdir -p /application/svndata

mkdir -p /application/svnpasswd

svnadmin create /appplication/svndata/sadoc

[root@root ~]# LANG=en

[root@root ~]# tree  /appplication/svndata/sadoc

cd /application/svndata/sadoc

cp svnserve.conf svnserve.conf.ori

vim svnserve.concc

## access through http: and/or file: URLs, then this file is

### irrelevant.)

### Visit http://subversion.tigris.org/ for more information.

[general]

### These options control access to the repository for unauthenticated

### and authenticated users.  Valid values are "write", "read",

### and "none".  The sample settings below are the defaults.

anon-access = none

auth-access = write

### The password-db option controls the location of the password

### database file.  Unless you specify a path starting with a /,

### the file's location is relative to the directory containing

### this configuration file.

### If SASL is enabled (see below), this file will NOT be used.

### Uncomment the line below to use the default password file.

password-db = /application/svnpasswd/passwd

### The authz-db option controls the location of the authorization

### rules for path-based access control.  Unless you specify a path

### starting with a /, the file's location is relative to the the

### directory containing this file.  If you don't specify an

### authz-db, no path-based access control is done.

### Uncomment the line below to use the default authorization file.

authz-db =/authz

cp authz passwd /appplication/svnpasswd/

[root@root conf]# svnserve -d -r /appplication/svndata/

svnserve: warning: cannot set LC_CTYPE locale

svnserve: warning: environment variable LANG is en

svnserve: warning: please check that your locale name is correct

svnserve: Can't bind server socket: Address already in use

[root@root conf]# pkill svnserve

[root@root conf]# lsof -i :3690

[root@root conf]# svnserve -d -r /appplication/svndata/

svnserve: warning: cannot set LC_CTYPE locale

svnserve: warning: environment variable LANG is en

svnserve: warning: please check that your locale name is correct

[root@root conf]# lsof -i :3690

COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

svnserve 4713 root    3u  IPv4  28582      0t0  TCP *:svn (LISTEN)

cd /application/svnpasswd

vim passwd

[root@root svnpasswd]# cat passwd

### This file is an example password file for svnserve.

### Its format is similar to that of svnserve.conf. As shown in the

### example below it contains one section labelled [users].

### The name and password for each user follow, one account per line.

[users]

# harry = harryssecret

# sally = sallyssecret

fjb = 123456

fjj = 123456

stu001 = 123

stu002 = 456

cat authz

[groups]

# harry_and_sally = harry,sally

# harry_sally_and_joe = harry,sally,&joe

xiyue = stu001,stu002

# [/foo/bar]

# harry = rw

# &joe = r

# * =

# [repository:/baz/fuz]

# @harry_and_sally = rw

# * = r

[sadoc:/]

fjb = rw

fjj = r

@xiyue = r

cd /tmp

  476  mkdir dir

  477  cd dir/

  478  mkdir stu{003..010}

  479  svn import /tmp/dir/ svn://192.168.1.101/sadoc/ -m "import svntree"

[root@client dir]# cat passwd

cat: passwd: 没有那个文件或目录

[root@client dir]# cd /application/svnpasswd/

[root@client svnpasswd]# ll

总用量 8

-rw-r--r-- 1 root root 1200 3月   4 23:57 authz

-rw-r--r-- 1 root root  362 3月   4 23:16 passwd

[root@client svnpasswd]# cat authz

### This file is an example authorization file for svnserve.

### Its format is identical to that of mod_authz_svn authorization

### files.

### As shown below each section defines authorizations for the path and

### (optional) repository specified by the section name.

### The authorizations follow. An authorization line can refer to:

###  - a single user,

###  - a group of users defined in a special [groups] section,

###  - an alias defined in a special [aliases] section,

###  - all authenticated users, using the '$authenticated' token,

###  - only anonymous users, using the '$anonymous' token,

###  - anyone, using the '*' wildcard.

###

### A match can be inverted by prefixing the rule with '~'. Rules can

### grant read ('r') access, read-write ('rw') access, or no access

### ('').

[aliases]

# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]

# harry_and_sally = harry,sally

# harry_sally_and_joe = harry,sally,&joe

xiyue = stu001,stu002

# [/foo/bar]

# harry = rw

# &joe = r

# * =

# [repository:/baz/fuz]

# @harry_and_sally = rw

# * = r

[sadoc:/]

fjb = rw

fjj = r

[sadoc:/stu001]

fjb = rw

stu001 = rw

[sadoc:/stu002]

stu002 =rw

fjb =rw

[root@client svnpasswd]# cat passwd

### This file is an example password file for svnserve.

### Its format is similar to that of svnserve.conf. As shown in the

### example below it contains one section labelled [users].

### The name and password for each user follow, one account per line.

[users]

# harry = harryssecret

# sally = sallyssecret

fjb = 123456

fjj = 123456

stu001 = 123

stu002 = 456

linux svn 更新提交命令

linux下svn常用指令

一下内容转载于:http://blog.chinaunix.net/space.php?uid=22976768&do=blog&id=1640924。这个总结的很好~

windows下的TortoiseSVN是资源管理器的一个插件,以覆盖图标表示文件状态,几乎所以命令都有图形界面支持,比较好用,这里就不多说。主要说说linux下svn的使用,因为linux下大部分的操作都是通过命令行来进行,所以必须得掌握linux下svn的常用指令。当然linux下也有模仿TortoiseSVN的linux X程序,例如RabbitVCS,模仿程度很高,但很容易拖慢X,因此不推荐。

    (如果是第一次提交文件,很可能会出现“svn:'.'不是工作副本”,即当前目录不是工作副本,这个时候需要用到import:

eg:svn import . url)

1、将文件checkout到本地目录
svn checkout path(path是服务器上的目录)
例如:svn checkout svn://192.168.1.1/pro/domain
简写:svn co
2、往版本库中添加新的文件
svn add file
例如:svn add test.php(添加test.php)
svn add *.php(添加当前目录下所有的php文件)
3、将改动的文件提交到版本库
svn commit -m “LogMessage“ [-N] [--no-unlock] PATH(如果选择了保持锁,就使用–no-unlock开关)
例如:svn commit -m “add test file for my test“ test.php
简写:svn ci
4、加锁/解锁
svn lock -m “LockMessage“ [--force] PATH
例如:svn lock -m “lock test file“ test.php
svn unlock PATH
5、更新到某个版本是v你
svn update -r m path
例如:
svn update如果后面没有目录,默认将当前目录以及子目录下的所有文件都更新到最新版本。
svn update -r 200 test.php(将版本库中的文件test.php还原到版本200)
svn update test.php(更新,于版本库同步。如果在提交的时候提示过期的话,是因为冲突,需要先update,修改文件,然后清除svn resolved,最后再提交commit)
简写:svn up
6、查看文件或者目录状态
1)svn status path(目录下的文件和子目录的状态,正常状态不显示)
【?:不在svn的控制中;M:内容被修改;C:发生冲突;A:预定加入到版本库;K:被锁定】M状态一般比较多
2)svn status -v path(显示文件和子目录状态)
第一列保持相同,第二列显示工作版本号,第三和第四列显示最后一次修改的版本号和修改人。
注:svn status、svn diff和 svn revert这三条命令在没有网络的情况下也可以执行的,原因是svn在本地的.svn中保留了本地版本的原始拷贝。
简写:svn st
7、删除文件
svn delete path -m “delete test fle“
例如:svn delete svn://192.168.1.1/pro/domain/test.php -m “delete test file”
或者直接svn delete test.php 然后再svn ci -m ‘delete test file‘,推荐使用这种
简写:svn (del, remove, rm)
8、查看日志
svn log path
例如:svn log test.php 显示这个文件的所有修改记录,及其版本号的变化
9、查看文件详细信息
svn info path
例如:svn info test.php
10、比较差异
svn diff path(将修改的文件与基础版本比较)
例如:svn diff test.php
svn diff -r m:n path(对版本m和版本n比较差异)
例如:svn diff -r 200:201 test.php
简写:svn di
11、将两个版本之间的差异合并到当前文件
svn merge -r m:n path
例如:svn merge -r 200:205 test.php(将版本200与205之间的差异合并到当前文件,但是一般都会产生冲突,需要处理一下)
12、SVN 帮助
svn help
svn help ci
——————————————————————————
以上是常用命令,下面写几个不经常用的
——————————————————————————
13、版本库下的文件和目录列表
svn list path
显示path目录下的所有属于版本库的文件和目录
简写:svn ls
14、创建纳入版本控制下的新目录
svn mkdir: 创建纳入版本控制下的新目录。
用法: 1、mkdir PATH…
2、mkdir URL…
创建版本控制的目录。
1、每一个以工作副本 PATH 指定的目录,都会创建在本地端,并且加入新增
调度,以待下一次的提交。
2、每个以URL指定的目录,都会透过立即提交于仓库中创建。
在这两个情况下,所有的中间目录都必须事先存在。
15、恢复本地修改
svn revert: 恢复原始未改变的工作副本文件 (恢复大部份的本地修改)。revert:
用法: revert PATH…
注意: 本子命令不会存取网络,并且会解除冲突的状况。但是它不会恢复
被删除的目录
16、代码库URL变更
svn switch (sw): 更新工作副本至不同的URL。
用法: 1、switch URL [PATH]
      2、switch –relocate FROM TO [PATH...]
  1、更新你的工作副本,映射到一个新的URL,其行为跟“svn update”很像,也会将服务器上文件与本地文件合并。这是将工作副本对应到同一仓库中某个分支或者标记的方法。
  2、改写工作副本的URL元数据,以反映单纯的URL上的改变。当仓库的根URL变动
(比如方案名或是主机名称变动),但是工作副本仍旧对映到同一仓库的同一目录时使用
这个命令更新工作副本与仓库的对应关系。
17、解决冲突
svn resolved: 移除工作副本的目录或文件的“冲突”状态。
用法: resolved PATH…
注意: 本子命令不会依语法来解决冲突或是移除冲突标记;它只是移除冲突的
相关文件,然后让 PATH 可以再次提交。
18、输出指定文件或URL的内容。
svn cat 目标[@版本]…如果指定了版本,将从指定的版本开始查找。

svn cat -r PREV filename > filename (PREV 是上一版本,也可以写具体版本号,这样输出结果是可以提交的)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章