2010年5月26日 星期三

Linux Development - svn

Windows SVN software
TortoiseSVN
http://tortoisesvn.tigris.org/


svn command option -r can set the following values. I will diagnose these values when I am free.
-r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range)
A revision argument can be one of:
NUMBER revision number
'{' DATE '}' revision at start of the date
'HEAD' latest in repository
'BASE' base rev of item's working copy
'COMMITTED' last commit at or before BASE
'PREV' revision just before COMMITTED

Q. HEAD, BASE, COMMITTED, PREV means what in svn?


Commit code to svn
# svn commit -m "message" commited-file

Update codes commited by other one
# svn update

Get the current working directory file status
# svn status

See the file difference
# svn log filename
# svn diff -r r669:676 filename

See the diff summary in a revision comparison
$ svn diff -r1302:1303 --summarize
M XXXX/abcd.h
M YYYY/zxcv.c


check out the specified revision from the svn source trunk
# svn co svn://ipaddress/pathTotheTrunk/trunk -r1232
# svn co svn://ipaddress/pathTotheTrunk/trunk@1232 PATH
PATH is the local-folder name which will store the check-out files

update the file to the latest version of the source trunk
# svn up -rHEAD path-to-the-source-file

update the file to the revision 1232 of the source trunk
# svn up -r1234 path-to-the-source-file


update the code in a specified date
# find . -name .svn -execdir svn update -r {2011-04-04} \;

import project to the svn repository, the below "myproject" is the imported folder
# svn import --no-ignore myproject svn://repository-address/path/to/newproject

After this command, all the files contained in the myproject will upload to the newproject folder of svn repository.
And we can use the following svn-address to check out this new project, like following command
# svn co svn://repository-address/path/to/newproject

we can use the option --no-ignore to avoid svn ignore the default ignored files (include .so ...)
Under version-controlled status
# svn st --no-ignore
# svn add --no-ignore local-folder
Import a directory of non-version-controlled
# svn import --no-ignore localFolder URL

Export the SVN repository files without the version-control tags (clean directory tree) to the local-folder
# svn export URL local-folder

change to the working directory
svn merge source-branch-URL -cSource-Revision
or
svn merge -r9189:HEAD source-branch-URL target-branch-WC


This will be useful when you create a branch for new feature implement,
and you want to reintegrate the implemented new feature back to trunk. The merging process will include 2 phases.


1st,
Keeping a Branch in Sync with trunk
$ pwd
.../your-branch
$ svn merge [--dry-run] ^/trunk
After Sync,
$ # build, test, verify, ...
$ svn commit -m "......"


second,
Reintegrating a Branch back to trunk
you need a clean working copy of the trunk first,
$ pwd
.../your-trunk
$ svn update # (make sure the working copy is up to date)
$ svn merge [--dry-run] --reintegrate ^/branches/your-branch
$ # build, test, verify, ...
$ svn commit -m "......"


How to use the TortoiseSVN to create the new branch or tag?
1. Use the "Log Message" to browase the specified source trunk
Note: remember to enable the "Show All" button in the most bottom screen.
2. type the search string in the "searching-field"
3. The "Log Message" will list all the comformed revision in the screen.
4. Click right button on the spevified revision. Select the "Create branch/tag from revision" from the pop-up menu. Then there will appear a sub window with title "COPY (Branch /Tag)". See the following figure for example.




















5. Select the right path in the "To URL" field. Note that svn-branch will under "branch" folder and svn-tag will under "release" folder.
6. Finally click "OK" will finish the processing.

沒有留言: