svn常用语句

svn常用语句

 

1:在覆盖代码时,往往文件夹下面有受控文件.svn,为了不拷贝.svn文件,需要用下面的方式拷贝,而不能用cp命令

    rsync -I -av --exclude=.svn   源文件  目标地址

 

 

2:下载指定时间代码文件

   svn co

 

   ##check out code to your local working copy from svn repository, and your local working copy will include .svn info

 

svn co --ignore-externals  svn地址 

svn co -r 1276 xxx yyy

useful options:

--ignore-externals

--username xxxx  --password yyyy

3: svn export

## Check out code to your local working copy from svn repository, and your local working copy will not include .svn info.

svn export --ignore-externals svn地址  

useful options:

--ignore-externals

--username xxx  --password yyy

--force, If your working copy directory already exists, you need add this option.

4: svn ci

##commit your changes into svn repository from your local working copy

 svn ci -m "Externals updated for 216"  --username xxx --password yyy

 useful options:

 -m , the option is required, you need to add some commit message info.

5: svn add

 ##Add files and directories to your working copy and will be added to svn repository on your next commit.

 ##If you add something before committing, you can cancel the addition using "svn revert".

 svn add --username xxx --password yyy * --no-ignore

 useful options: 

 --no-ignore, this option is required. In default, svn will ignore some files, like *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo *.rej *~ #*# .#* .*.swp .DS_Store.

 You can add all your code using this options.

 

6: svn up

 ###update your working copy, you can get new changes from svn repository.

 svn up --username xxx --password yyy

 

7: svn externals

 # Get svn:externals into a file: 

 o      svn pg svn:externals . > _ext.txt           

 # Edit file externals.txt according to SCs announcements e-mails (tag names)

 o      svn ps svn:externals . -F _ext.txt       

 o   svn ci -m "Externals updated for WN6.0_22.12-216"  --username xxx --password yyy

 

8: svn copy src dest

 ###copy one or more files in a working copy or in the repository.

 svn copy -m "Create tag for WN6.0 22.12-216" --username xxx --password yyy 原目标文件svn地址 目标文件svn地址 

  useful options:

    -m, required      

        If -m option is missed, you will get warning info like this:

        svn: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the --message (-m) or --file (-F) option

    svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no 'editor-cmd' run-time configuration option was found

   src               dest                        description

   dir               existent dir                src is child of dest

   dir               non-existent dir            independent branch 

   example:

   svn copy --username xx --password yy http://10.123.34.67/svn/orginalfoder/ http://10.123.34.67/svn/copyfolder/ -m "copy"

   orginalfoder is existent dir, copyfolder is non-existent dir.

 

 9: svn cat

 ###Output the contents of the specified files or URLs

 svn cat http://10.123.34.67/svn/orginalfoder/test.sh

 

10: svn status

 ###print the status of working copy files and directories.

 svn status setenv.bat

 example(setenv.bat and setenv.sh are locked):

 C:\test>svn status

     K  setenv.bat

     K  setenv.sh

11: svn log 

###Shows you broad information: log messages attached to revisions, and which paths changed in each revision

 svn log -r 5:19    # shows logs 5 through 19 in chronological order

 svn log --stop-on-copy #do not cross copies while traversing history

 svn log http://10.123.34.67/svn/orginalfoder/test.sh 

 #####Show single file logs ####

C:\orginalfoder>svn log test.sh

 

12: svn revert

 ###Reverts any local changes to a file or directory and resolves any conflicted states. Svn revert will revert not only the contents of an item in your working copy, but also any property changes. Finally, you can use it to undo any scheduling operations that you may have performed (e.g., files scheduled for addition or deletion can be “unscheduled”).

###When your local changes have not committed.

 a. revert changes in the directory on working copy

C:\orginalfolder>svn revert -R .

C:\orginalfolder>svn revert -R test 

b. revert single file changes on working copy

C:\orginalfolder>svn revert test.sh

C:\orginalfolder>svn revert test\com.log

C:\orginalfolder>svn revert test.sh test.bat (revert multi-files) 

Note:

cd yourWorkingCopy

svn log(check which version you will revert to) or svn diff

svn revert

svn commit

 

12: svn merge

###revert working copy to old version

##When your changes have committed.

C:\orginalfolder>svn merge -r 1259:1258  http://10.123.34.67/svn/orginalfoder/

svn merge -r 1259:1258  http://10.123.34.67/svn/orginalfoder/ C:\orginalfoder

C:\orginalfolder>svn merge -r HEAD:1242  http://10.123.34.67/svn/orginalfoder/

##merge single file

C:\orginalfolder>svn merge -r HEAD:1239 startup.sh

 

13: svn diff

###compare your working copy and BASE

C:\orginalfolder>svn diff

C:\orginalfolder>svn diff -r 1102 test.sh

###compare different urls

#you have working copy

C:\orginalfolder>svn diff -r HEAD:1102

C:\orginalfolder>svn diff -r HEAD:1238 startup.sh

#you have not working copy

svn diff http://10.123.34.67/svn/orginalfoder@1259 http://10.123.34.67/svn/orginalfoder@1102

svn diff -r HEAD:1102 http://10.123.34.67/svn/orginalfoder/

 

14: svn lock

###lock the file

svn status

###check the status of the file

C:\orginalfolder>svn status -u

K-被用户自己锁定, O-被其他用户锁定

使用svn info查看被谁锁定

如果看到文件被锁定了,想打破这个锁定,可以使用

svn unlock --force  --username xx --password xx/test.sh

 

15: svn list

 ###Output the lists of the specified folders or URLs

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值