$svn help
Provides a summary of the available commands. 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)
#svn checkout or #svn co
This command is used to pull an SVN tree such as svn://linuxfromscratch.org/BLFS/trunk/BOOK (the BLFS Development book) from the server. You should only need to do this once. If the directory structure is changed (as is sometimes necessary), you may occasionally need to delete your local sand box and re-check it out.
#svn checkout URL[@REV]... [PATH]
Examples:
Check out a working copy into a directory called myrepo:
$ svn checkout svn://linuxfromscratch.org/BLFS/trunk/BOOK myrepo
A myrepo/archive
A myrepo/archive/inetutils.xml
A myrepo/archive/espgs.xml
A myrepo/archive/libosinfo.xml
A myrepo/archive/gimp-print.xml
...
...
$ ls
myrepo
Check out 2 different directories into two separate working copies, but place both into a directory called working-copies:
$ svn checkout file:///tmp/repos/test file:///tmp/repos/quiz working-copies
Check out 2 different directories into two separate working copies:
$ svn checkout file:///tmp/repos/test file:///tmp/repos/quiz
If you interrupt a checkout (or something else interrupts your checkout like loss of connectivity, etc.), you can restart it either by issuing the identical checkout command again, or by updating the incomplete working copy:
#svn add.
When you are creating a new file or directory, you need to tell the SVN server about it. This command does that. Note that the file won't appear in the repository until you do an #svn commit
#svn add PATH...
Available switches:
--targets FILENAME
--non-recursive (-N)
--quiet (-q)
--config-dir DIR
--auto-props
--no-auto-props
--force
Continue the above example:
Go inside the working copy.
#cd myrepo
Create your file using your favourit text editor
#vi foo.c
To add a file to your working copy:
#svn add foo.c
A foo.c
When adding a directory, the default behavior of svn add is to recurse:
First create the directory inside the wokring folder. Then enter the below command.
#svn add testdir
A testdir
A testdir/a
A testdir/b
A testdir/c
A testdir/d
You can add a directory without adding its contents:
#svn add --non-recursive otherdir
A otherdir
Normally, the command svn add * will skip over any directories that are already under version control. Sometimes, however, you may want to add every unversioned object in your working copy, including those hiding deeper down. Passing the --force option makes svn add recurse into versioned directories:
#svn add * --force
A foo.c
A somedir/bar.c
A otherdir/docs/baz.doc
…
#svn propset
Set PROPNAME to PROPVAL on files, directories, or revisions. The first example creates a versioned, local property change in the working copy, and the second creates an unversioned, remote property change on a repository revision.
#svn propset PROPNAME [PROPVAL | -F VALFILE] PATH...
#svn propset PROPNAME --revprop -r REV [PROPVAL | -F VALFILE] [URL]
Available switches:
--file (-F) FILE
--quiet (-q)
--revision (-r) REV
--targets FILENAME
--recursive (-R)
--revprop
--username USER
--password PASS
--no-auth-cache
--non-interactive
--encoding ENC
--force
--config-dir DIR
Continue the above example:
On a UNIX system, if you want a file to have the executable permission set:
#svn propset svn:executable ON foo.c
property 'svn:executable' set on 'foo.c'
Perhaps you have an internal policy to set certain properties for the benefit of your coworkers:
#svn propset owner sharma foo.c
property 'owner' set on 'foo.c'
If you made a mistake in a log message for a particular revision and want to change it, use --revprop and set svn:log to the new log message:
#svn propset --revprop -r 25 svn:log "Journaled about trip to Sri Lanka."
property 'svn:log' set on repository revision '25'
Or, if you don't have a working copy, you can provide a URL.
#svn propset --revprop -r 26 svn:log "Document nap." http://svn.red-bean.com/repos
property 'svn:log' set on repository revision '25'
Lastly, you can tell propset to take its input from a file. You could even use this to set the contents of a property to something binary:
#svn propset owner-pic -F sharma.jpg foo.c
property 'owner-pic' set on 'foo.c'
#svn commit
Send changes from your working copy to the repository. If you do not supply a log message with your commit by using either the --file or --message switch, svn will launch your editor for you to compose a commit message.
svn commit will send found lock tokens and release locks on all PATHS committed (recursively) unless --no-unlock is passed.
svn commit [PATH...]
Available switches:
--message (-m) TEXT
--file (-F) FILE
--quiet (-q)
--no-unlock
--non-recursive (-N)
--targets FILENAME
--force-log
--username USER
--password PASS
--no-auth-cache
--non-interactive
--encoding ENC
--config-dir DIR
Commit a simple modification to a file with the commit message on the command line and an implicit target of your current directory (“.”):
Continue the above example:
#svn commit -m "added file foo.c and directory testdir to the repo"
Adding foo.c
Adding testdir
Transmitting file data .
Committed revision 2.
Commit a modification to the file foo.c (explicitly specified on the command line) with the commit message in a file named msg:
#svn commit -F msg foo.c
Sending foo.c
Transmitting file data .
Committed revision 2.
If you want to use a file that's under version control for your commit message with --file, you need to pass the --force-log switch:
#svn commit --file file_under_vc.txt foo.c
svn: The log message file is under version control
svn: Log message file is a versioned file; use '--force-log' to override
#svn commit --force-log --file file_under_vc.txt foo.c
Sending foo.c
Transmitting file data .
Committed revision 4.
#svn delete
Items specified by PATH are scheduled for deletion upon the next commit. Files (and directories that have not been committed) are immediately removed from the working copy. The command will not remove any unversioned or modified items; use the --force switch to override this behavior.
Items specified by URL are deleted from the repository via an immediate commit. Multiple URLs are committed atomically.
#svn delete PATH...
Available Switches
--force
--force-log
--message (-m) TEXT
--file (-F) FILE
--quiet (-q)
--targets FILENAME
--username USER
--password PASS
--no-auth-cache
--non-interactive
--editor-cmd EDITOR
--encoding ENC
--config-dir DIR
Continue the above example:
Using svn to delete a file from your working copy merely schedules it to be deleted. When you commit, the file is deleted in the repository.
#svn delete foo.c
D myfile
#svn commit -m "Deleted file 'myfile'."
Deleting foo.c
Transmitting file data .
Committed revision 7.
Deleting a URL, however, is immediate, so you have to supply a log message:
#svn delete -m "Deleting file 'yourfile'" file:///tmp/repos/test/yourfile
Committed revision 8.
Here's an example of how to force deletion of a file that has local mods:
#svn delete over-there
svn: Attempting restricted operation for modified resource
svn: Use --force to override this restriction
svn: 'over-there' has local modifications
#svn delete --force over-there
D over-there
#svn status
svn status. This command prints the status of working directories and files. If you have made local changes, it'll show your locally modified items. If you use the --verbose switch, it will show revision information on every item. With the --show-updates (-u) switch, it will show any server out-of-date information.
You should always do a manual svn status --show-updates before trying to commit
changes in order to check that everything is OK and ready to go.
For more details, please refer http://svnbook.red-bean.com/en/1.2/index.html
0 comments:
Post a Comment