taocode SVN

来源:互联网 发布:中原电子 知乎 编辑:程序博客网 时间:2024/04/29 21:57

为了方便在Linux上管理taocode上的代码文件等,在linux上安装svn如下

svn安装

下载安装subversion

[zzx@localhost 3rdparty]$ sudo yum install -y subversion

查看subversion是否安装好

[zzx@localhost 3rdparty]$ rpm -qa | grep subversion
subversion-1.6.11-15.el6_7.i686

本人自己使用的是taocode,所以这个的链接是taocode的,各人可以有不同。

svn checkout path (path是服务器的目录)

简写:svn co path

[zzx@localhost 3rdparty]$ svn co  http://code.taobao.org/svn/yun-iot/

**********************************

如出现下面错误

Authentication realm: <http://code.taobao.org:80> code.taobao.org
Password for 'zzx': 

svn: Server sent unexpected return value (403 Forbidden) in response to OPTIONS request for 'http://code.taobao.org/svn/yun-iot'

是因为当你的虚拟机和SVN的ID不一致,解决方法: svn co --username=SVN的ID path

*********************************

[zzx@localhost 3rdparty]$ svn co --username=xiongzhizhu http://code.taobao.org/svn/yun-iot      //svn的ID是自己taocode注册的用户名

Authentication realm: <http://code.taobao.org:80> code.taobao.org
Password for 'xiongzhizhu': 
-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <http://code.taobao.org:80> code.taobao.org

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/home/zzx/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? Y^H^Hy
Please type 'yes' or 'no': yes

-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <http://code.taobao.org:80> code.taobao.org

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/home/zzx/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes

。。。。。。。。。

上面选择了yes后,会将taocode上的文件全部下载到虚拟机中linux下

[zzx@localhost 3rdparty]$ ls
busybox-1.20.2                 rlwrap-0.30.tar.gz  Wenjian123
busybox-1.20.2.tar.bz2         rt3070              yun-iot
mtd                            sim900              zlib-1.2.3
mtd-snapshot-20050519.tar.tar  sqlite              zlib-1.2.3.tar.tar
mtd-utiles                     sqlite-arm-linux
rlwrap-0.30                    uda1341


svn使用

svn add folder 添加你的文件夹或者你的文件

[zzx@localhost 3rdparty]$ cd yun-iot/

先在linux中新建好文件目录

[zzx@localhost yun-iot]$ mkdir zhuzhixiong
[zzx@localhost yun-iot]$ cd zhuzhixiong/
[zzx@localhost zhuzhixiong]$ mkdir trunk
[zzx@localhost zhuzhixiong]$ cd trunk/
[zzx@localhost trunk]$ mkdir bin
[zzx@localhost trunk]$ mkdir src
[zzx@localhost trunk]$ mkdir doc
[zzx@localhost trunk]$ cd src/
[zzx@localhost src]$ mkdir 3rdparty
[zzx@localhost src]$ mkdir bootloader
[zzx@localhost src]$ mkdir crosstool
[zzx@localhost src]$ mkdir driver
[zzx@localhost src]$ mkdir linux
[zzx@localhost src]$ mkdir program
[zzx@localhost src]$ mkdir shell
[zzx@localhost src]$ ls
3rdparty  bootloader  crosstool  driver  linux  program  shell

使用svn add folder

[zzx@localhost src]$ cd ../../..
[zzx@localhost yun-iot]$ svn add zhuzhixiong/
A         zhuzhixiong
A         zhuzhixiong/trunk
A         zhuzhixiong/trunk/src
A         zhuzhixiong/trunk/src/crosstool
A         zhuzhixiong/trunk/src/program
A         zhuzhixiong/trunk/src/linux
A         zhuzhixiong/trunk/src/bootloader
A         zhuzhixiong/trunk/src/shell
A         zhuzhixiong/trunk/src/3rdparty
A         zhuzhixiong/trunk/src/driver
A         zhuzhixiong/trunk/doc
A         zhuzhixiong/trunk/bin

使用 svn ci 命令将文件提交到taocode上

[zzx@localhost yun-iot]$ svn ci -m "Add zhuzhixiong"
Adding         zhuzhixiong
Adding         zhuzhixiong/trunk
Adding         zhuzhixiong/trunk/bin
Adding         zhuzhixiong/trunk/doc
Adding         zhuzhixiong/trunk/src
Adding         zhuzhixiong/trunk/src/3rdparty
Adding         zhuzhixiong/trunk/src/bootloader
Adding         zhuzhixiong/trunk/src/crosstool
Adding         zhuzhixiong/trunk/src/driver
Adding         zhuzhixiong/trunk/src/linux
Adding         zhuzhixiong/trunk/src/program
Adding         zhuzhixiong/trunk/src/shell
Committed revision 150.
这时可以在PC上登录自己的taocode账户发现会有新建的zhuzhixiong目录

*********************************

若出现下面问题


svn ci 时出现 xx is already under version control,然后无法提交,出现这个问题的原因是你所提交的文件或目录是其他SVN的东西,即下面有.svn的目录,需要先把它们删除才能提交,具体操作如下:

cd到你新增加的那个目录,例如我的是新建的zhuzhixiong文件夹下,然后用下面的命令

$ find . -mindepth 2 -name '.svn' -exec rm -rf '{}' \;

这个命令会递归的删除目录下所有.svn的文件夹,现在,再提交一次试试;哈哈,万一还是不行就删除原来的zhuzhixiong文件夹,自己再重新建一个,用svn -c提交。

**********************************


svn help 可以看到 svn 所支持的全部命令

[zzx@localhost zhuzhixiong]$ svn help
usage: svn <subcommand> [options] [args]
Subversion command-line client, version 1.6.11.
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
   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)
   propdel (pdel, pd)
   propedit (pedit, pe)
   propget (pget, pg)
   proplist (plist, pl)
   propset (pset, ps)
   resolve
   resolved
   revert
   status (stat, st)
   switch (sw)
   unlock
   update (up)

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

将文件checkout到本地目录

需要自己的项目 Checkout 出来。这个过程使用的命令是 svn checkout 或者 svn co

svn checkout path (path是服务器上的目录,例如本人上面操作的)

往版本库中添加新的文件

svn add file 例如svn add test.c(添加test.c)

将改动的文件提交到版本库

对代码进行修改后,需要提交代码到SVN中,这时要用到 svn commit / svn ci 命令。提交的时候,最好使用 –m 带上注释,这样今后查看的时候也比较方便。

更新文件

每次开始编码前,最好更新一下代码,看看其他人是否修改过代码。更新的命令为: svn update / svn up

可以切换到希望更新的目录,直接执行 svn update 而不必跟特定的文件或目录,也可以自己指定需要更新的文件或目录。

查看日志

这个功能在发现代码发生了变化,需要了解都有哪些变化的时候特别有用,前提是每一次的更新大家都写了注释。


删除文件

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)

查看文件详细信息

svn info path
例如:svn info test.c

还有很多使用操作的,但这几个可以应付简单的操作了
**********************************************

出现以下错误


上传提交gprs_bin时,出现svn:××× is not under version control表示这个文件没有在SVN的控制之下

在执行commit操作的时候,只有处于SVN控制之下的文件才能被commit,从update得到的文件是在SVN控制之下的(比如原来就存在的文本文件,你可以对其修改、提交),而新创建的文件(比如这个文件gprs_bin)不在SVN控制之下,这时你需要先对这个新文件执行svn add操作,将其标注为纳入SVN控制,然后才能对其commit

出现下面问题

 

当提交时出现了上面的错误,大意是log信息与一个文件名相同,使用“--force-log”选项强制执行此命令。
其实这个错误时应为log信息和当前文件夹下一个文件的名字相同造成的,随便修改下-m的信息就行了,如上

************************************************

OK!!!


0 0
原创粉丝点击