Latest News
Đẩy log exception của spring boot lên elasticsearch
  • About
  • EmEditor
  • Register Google Adsense

Love Coding

Note anything I want

  • Home
  • Web Development
    • HTML
    • Javascript
    • jQuery
    • CSS
    • PHP
    • ASP
    • JSP
    • Fix Bug
  • Other Development
    • Desktop Java
    • Mobile J2ME
    • VBS
  • Operating System
    • Windows
    • Linux
  • Database
    • MySQL
    • Oracle
  • Software
Home » Linux » Love Coding: Subversion Quick Reference

Subversion Quick Reference

HuyPV
Add Comment
Linux
Monday, October 12, 2009
Source: http://blogs.tech-recipes.com/johnny/subversion-quick-reference/

Having recently switched to doing a lot of development on Ubuntu, I no
longer have the wonderful TortoiseSVN interface to work with, so I’ve
been forced to get familiar with the command line versions. I’ve thrown
together this quick reference guide to help anybody else that feels
daunted by the command line version. It’s really easy, you should learn
it too!

Check out
code from a remote web repository

svn checkout http://svn.collab.net/repos/svn/trunk
subversion
OR
svn co http://svn.collab.net/repos/svn/trunk subversion
This command will check out a working copy of the
subversion source code into a new subdirectory called subversion. Note,
this is just an example, checking out the subversion source could take
a while, so don’t do it. You would generally substitute the URL with
the one you are trying to access, and change the working directory to
something different.
svn checkout –username myuser –password …… On the majority of the commands you can set the –username parameter and the –pasword to help automate things, instead of being prompted for them. Once you create a local working copy, your client should really cache that information, however.


Basic
Subversion Commands

svn update Run this in your project directory to get the latest
changes from the source control server.
svn update -r 123 Run this in your project directory to update to the
specific revision 123
svn stat
OR
svn st
Run this in your project directory, gives you the
status of all the files and directories. If it returns nothing, then
you are in sync. M before a file means modified, and ? means
the file is not in source control.
svn revert This will revert the changes that you have made to your
working copy.
svn diff filename.cpp This will show the differences between filename.cpp and
the working copy. This is most useful after running an svn stat and
seeing that the file is modified. You can then run this command to see
what the differences are.
svn revert filename.cpp This will revert all changes you have made to
filename.cpp back to the copy in the repository.
svn revert -R * This will revert all changes you have made to the
entire project back to the repository version.
svn -v list This will list the files in source control for the
current workspace directory
svn -v list http://svn.collab.net/repos/svn/trunk This will list all files in source control at the
particular subversion repository URL. Fairly useful if you want to see
what the structure is before doing a checkout.
svn info Gives you info about the current working copy,
including the URL of the repository it points to, and the last changed
date/author.
svn commit -m “Adding new function” filename.cpp Commit the changes in filename.cpp, and give it a
useful message. Using the messages is highly important down the road
when you want to figure out what a particular change did. Make sure you
use them.
svn commit -m “Adding lots of new functions” Use this function without the filename to commit all
changes to all files. This is useful when you have a set of changes
spanning multiple files. (common)
svn log
svn log filename.cpp
svn log –limit 5 http://svn.collab.net/repos/svn/trunk
Use this function to take a look at the log messages.
The first one is for the entire working copy, the last one shows just
the last 5 log messages on a web repository.
svn add newfile.cpp Add a file or directory to version control. Note that
you still have to commit to actually send the file to the source
control server. You also can only use this command from within a
working copy directory, meaning if you haven’t used source control on
that directory you will need to import it first.
svn move filename.cpp newfilename.cpp Allows you to rename or move files within source
control. You can either use filenames in your local repository, or you
can even pass in two URL locations to have it be moved/renamed on the
server side.
This command is the same as doing a copy and then a delete.
svn copy MySource MyNewSource Allows you to copy a file or directory, either with
local files, or on the repository using the URL syntax.
svn delete filename.cpp Deletes the filename from source control. Note that the
filename will still exist in older revisions, but will be deleted from
the current revision.
svn blame filename.cpp This is one of my favorite commands in subversion. This
lists out the file, giving the revision and person who changed every
single line in the file. Very useful
Import
Code into Subversion

svn import -m “Importing the files” MySource
http://svn.theserver.net/svnroot/mysource
Imports the directory MySource and all files contained
within into the subversion server. The URL can be several levels deep
or more.

Note: once you import a source code directory, you should remove the
directory and then checkout the directory so that you can have a proper
working copy. Oh, and back up your files before you delete them. I
don’t want any nasty emails about how you lost source code.



For
Administrators

svnadmin create /svnroot/RepositoryName Creates a new repository at RepositoryName. If you are
using the URL model for accessing your site, make sure that the
location you create it at is accessible via your local web server.
svnadmin hotcopy /svnroot/reponame /backups/reponame Makes a “Hot Copy” of the repository, which means a
copy of the repository that can be instantly reusable. This method
seems to work pretty well for full backups.
svn copy -m “Making a new branch for that new feature”
http://svn.server.com/svnroot/trunk
http://svn.server.com/branches/johnnysbranch
Make a branch copy of the trunk into a seperate branch.
This should only be used by power users or people that know what they
are doing.
svn copy -m “Tagging version 1.0″ http://svn.server.com/svnroot/trunk
\
http://svn.server.com/svnroot/versions/version_1.0
Tag a version of the application. This uses the same
copy command that the branching does, and it’s really the same
underlying operation. Copying in subversion does not actually make a
new copy of the file, it just tags the current version. Once changes
are made, then the changes would be stored to the file seperately.
Tweet
Subversion Quick Reference Title: Subversion Quick Reference
Description: Source: http://blogs.tech-recipes.com/johnny/subversion-quick-reference/ Having recently switched to doing a lot of development on Ubuntu, ... ...
Rating: 4

No comments :

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments ( Atom )
Quảng cáo

Popular Posts

  • VBS - Upload file HTTP Post
    Source: http://www.ericphelps.com/scripting/samples/Reference/Web/HTTP_POST.txt   Sub Upload(strUploadUrl, strFilePath, strFileField, strD...
  • Add other collapse div to your forum
    Collapse <div style="height: 16px; padding-right: 4px; font-weight: bold;" class="blockhead"> <span style=...
  • Use the YouTube API with PHP
    Process and integrate data from YouTube into your PHP application with PHP's SimpleXML extension Summary:   The YouTube vide...
  • Check Laravel version
    Đối tác bảo đang code và dùng Laravel, giờ muốn biết version Laravel tương ứng là bao nhiêu để xem mà code theo. Làm sao check? Cách 1: Sử...
  • Trong laravel thì queue:work với queue:listen khác nhau thế nào?
    Trong laravel thì queue:work với queue:listen đều chạy jobs trong queue. Vậy 2 cái này cũng phải có gì đó khác nhau chứ, nếu ko thì nó là ...
  • Hàm chuyển từ ngày dương lịch sang âm lịch (PHP)
    <?php function INT($d) {     return floor($d); } function jdFromDate($dd, $mm, $yy) {     $a = INT((14 - $mm) / 12);     $y = $yy + 4800 ...
  • Character Set và Collation trong MySQL là gì? Tạo DB thì để UTF8_GENERAL_CI hay UTF8_BIN
    Character Set là một tập các ký tự và dạng số hóa của các ký tự đó Collation là một tập các luật để so sánh các xâu được sinh ra từ các ký ...
  • git checkout file from other branch
    Đang làm trên nhánh dev. Muốn lấy 1 file, ví dụ: xxx/helper.php ở trên nhánh master về dev thì làm thế nào? Cách 1: nông dân nhiều bước nh...
  • mysql_error: Undeclared variable: INF
    mysql_error: Undeclared variable: INF PHP Code: $limit = 10; $page = isset($_GET['p']) ? $_GET['p'] : 1; $offset = ($pa...
  • Download media files (video, audio) from VnExpress.Net
    Download media files (video, audio) from VnExpress.Net Example: http://vnexpress.net/GL/Vi-tinh/Giai-tri/2010/02/3BA18A0E/page_4.asp htt...
Back to top!
Copyright 2010 Love Coding - All Rights Reserved Design by Newbie_PC - Powered by Blogger