From Fedora Project Wiki

< Docs‎ | Drafts

m (→‎Importing a Book: adding content w00t)
m (→‎Checkout a Book Branch: adding content /me is sick of pointless commit messages)
Line 77: Line 77:


This command only checkouts the book specified by <code>My_New_Book/path/to/branch</code>. The <code>-N</code> option is non-recursive, so only the directory or branch specified is downloaded, instead of the entire book.
This command only checkouts the book specified by <code>My_New_Book/path/to/branch</code>. The <code>-N</code> option is non-recursive, so only the directory or branch specified is downloaded, instead of the entire book.
=== Checkout a Book Revision ===
Run the <code>svn log filename</code> command to display the revision history. The following is an example revision entry:
<pre>
------------------------------------------------------------------------
r1785 | user@something.comd | 2007-12-14 12:00:09 +1000 (Fri, 14 Dec 2007) | 2 lines
rename title logo in text
------------------------------------------------------------------------
</pre>
<code>r1785</code> is the revision number. Run the following command to checkout a specific revision of a book:
<pre>
svn co -r x https://path/to/svn/repository/My_New_Book
</pre>
Replace <code>x</code> with a revision number, for example, <code>1785</code>. Run the <code>svn help checkout</code> command for a full list of options.

Revision as of 02:17, 31 July 2008

Subversion

Note to Red Hat employees: the content in the following sections was copied with permission.

Subversion (SVN) is a version control system. It replaces CVS and, like its forebear, keeps track of changes made to books. The Subversion project is hosted by Tigris.org and a command reference can be downloaded in PostScript format from the site. (NB: Evince, the PDF and PostScript file viewer included with Fedora can display PostScript files.)

Configuring an SVN Editor

Add the following line to your ~/.bashrc file to see a list of files that will be committed during an SVN commit:

export SVN_EDITOR=/bin/vi

After configuring the SVN_EDITOR variable, running the svn ci command displays list of files that have been modified. This is useful if you accidentally modified a file that you do not want to commit back into SVN. Running the svn ci -m "this is a log file" command does display which files have changed, that is, the files that are being committed back into SVN.

Commonly used Terms

Familiarize yourself with the following terms before proceeding:

  • import: import a local copy of a book into SVN. If you create a book using the publican create_book command, you need to import this copy onto the server. Running the svn import command copies your local copy onto the SVN server.
  • checkout: checkout a book from an SVN server. This copies an existing book from an SVN server onto your local machine. You only need to checkout a book once. Periodically run the svn up command to update your local copy with changes other people have made.
  • commit: commit your changes back into SVN. This updates the server copy with the changes you have made. Run the svn ci command to update the server copy with your changes.

SVN Basics

Below are the most basic SVN functions and commands you need to learn:

Getting Help

  • Run the svn help command to display a list of SVN subcommands.
  • Run the svn help subcommand command, where subcommand is an SVN subcommand, to display the help for that subcommand. For example, running the svn help add command displays help for the svn add command.

Importing a Book

If you created a new book using the publican create_book command, you need to import your local copy into an SVN repository. Run the following command to add your local copy to the server:

svn import /local/path/to/My_New_Book https://path/to/svn/repository/My_New_Book

The svn import command imported your local copy into SVN, but has not marked your local copy as a checked-out version of the newly created repository. To resolve this, first backup your local copy:

mv My_New_Book My_New_Book.backup

Check the book out using the <command>svn co command:

svn co https://path/to/svn/repository/My_New_Book

When you are happy that the book has been checked-out correctly, remove the backup copy. Be very careful with this command:

rm /local/path/to/My_New_Book.backup -rf

Checkout a Book

You only need to checkout a book once. Checking out a book will store a local copy on your machine. Change into the directory where you want to store a local copy of the book, and run the following command:

svn co https://path/to/svn/repository/My_New_Book

Checkout a Book Branch

Run the following command to checkout a book branch:

svn co -N https://path/to/svn/repository/My_New_Book/path/to/branch

This command only checkouts the book specified by My_New_Book/path/to/branch. The -N option is non-recursive, so only the directory or branch specified is downloaded, instead of the entire book.

Checkout a Book Revision

Run the svn log filename command to display the revision history. The following is an example revision entry:

------------------------------------------------------------------------
r1785 | user@something.comd | 2007-12-14 12:00:09 +1000 (Fri, 14 Dec 2007) | 2 lines
	
rename title logo in text
	
------------------------------------------------------------------------

r1785 is the revision number. Run the following command to checkout a specific revision of a book:

svn co -r x https://path/to/svn/repository/My_New_Book

Replace x with a revision number, for example, 1785. Run the svn help checkout command for a full list of options.