mac,svn

mac svn操作

创建svn repository

svnadmin create /path/svn/pro  //仓库位置,svn是svn的目录,pro是一个版本库的目录

PS:这里有个歧义,按这样的方式添加 SVN 后,在启动 SVN 服务的时候,记得要用 /path/svn 这个路径,而不能用 /path/svn/pro 这个路径,不然会报 doesn’t exist

配置svn的用户权限

主要是修改 /svn/mycode/conf 目录下的三个文件:authz,passwd,svnserve.conf

  • 打开 svnserve.conf,将下列配置项前面的#和空格都去掉 
# anon-access = read
# auth-access = write

# password-db = passwd

# authz-db = authz

四行前的 # 号去掉,再将 anon-access = read 改为 anon-access = none,这样禁止匿名访问,需要帐号密码才能访问

-打开passwd,在[users]下面添加帐号和密码

[users]
# harry = harryssecret
# sally = sallyssecret
admin = admin
  • 打开authz,配置用户组和权限

我们可以将在 passwd 里添加的用户分配到不同的用户组里,以后的话,就可以对不同用户组设置不同的权限,没有必要对每个用户进行单独设置权限。 在 [groups]下面添加组名和用户名,多个用户之间用逗号(,)隔开

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

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
admingroup = admin

[/]
@admingroup = rw

PS:用户组前要用 @ 符号,如果是用户,直接写用户名就可以了。rm 代表可读写,显然只读就是 r 了

启动svn服务

svnserve -d -r /Users/brieftime/svn/

特别注意,路径一定是 SVN 的目录,不是其中一个版本库的目录,不然,能正常启动,就是访问有问题

没有任何输出,则启动成功

打开实用工具里面的“活动监视器”,搜索svn可以找到svnserve进程

使用svn客户端功能

  • svn status:
brieftimedeMacBook-Pro:cardbang brieftime$ svn status
M       app.json
?       pages/addgroup
M       pages/canvasshare/canvas.js
M       pages/carddetail/carddetail.js
?       pages/carddetail/carddetail.json
?       pages/cardgroup
M       pages/doc-info/doc-info.js
M       pages/doc-info/doc-info.wxml
M       pages/doc-info/doc-info.wxss
M       pages/findv2/find.wxml
?       pages/group-info
M       pages/home/index.js
M       pages/index/index.js
M       pages/leader/stories/stories.js
M       pages/personal/personal.js
M       pages/personal/personal.wxml
M       pages/personal/personal.wxss
M       pages/writecard/writecard.js
?       pages/writecard/writecard.json
  • svn add
brieftimedeMacBook-Pro:cardbang brieftime$ svn add pages/addgroup/
A         pages/addgroup
A         pages/addgroup/addgroup.js
A         pages/addgroup/addgroup.wxss
A         pages/addgroup/addgroup.wxml
A         pages/addgroup/addgroup.json
  • svn commit
brieftimedeMacBook-Pro:cardbang brieftime$ svn commit -m "cardbang 1.4.1 支持群组功能及打卡口令"

更新服务器端的代码到客户端

在终端中定位到客户端代码目录后,然后再输入指令:

brieftimedeMacBook-Pro:src brieftime$ svn update
Updating '.':
At revision 16.

svn的其他用法,可以在终端输入

brieftimedeMacBook-Pro:src brieftime$ svn help
usage: svn <subcommand> [options] [args]
Subversion command-line client.
Type 'svn help <subcommand>' for help on a specific subcommand.
Type 'svn --version' to see the program version and RA modules
  or 'svn --version --quiet' to see just the version number.

Most subcommands take file and/or directory arguments, recursing
on the directories.  If no arguments are supplied to such a
command, it recurses on the current directory (inclusive) by default.

Available subcommands:
   add
   auth
   blame (praise, annotate, ann)
   cat
   changelist (cl)
   checkout (co)
   cleanup
   commit (ci)
   copy (cp)
   delete (del, remove, rm)
   diff (di)
   export
   help (?, h)
   import
   info
   list (ls)
   lock
   log
   merge
   mergeinfo
   mkdir
   move (mv, rename, ren)
   patch
   propdel (pdel, pd)
   propedit (pedit, pe)
   propget (pget, pg)
   proplist (plist, pl)
   propset (pset, ps)
   relocate
   resolve
   resolved
   revert
   status (stat, st)
   switch (sw)
   unlock
   update (up)
   upgrade

Subversion is a tool for version control.
For additional information, see http://subversion.apache.org/