Author: buildbot Date: Mon Jul 18 03:01:06 2011 New Revision: 792964 Log: Staging update by buildbot Added: websites/staging/openofficeorg/trunk/content/openofficeorg/svn-basics.html Added: websites/staging/openofficeorg/trunk/content/openofficeorg/svn-basics.html ============================================================================== --- websites/staging/openofficeorg/trunk/content/openofficeorg/svn-basics.html (added) +++ websites/staging/openofficeorg/trunk/content/openofficeorg/svn-basics.html Mon Jul 18 03:01:06 2011 @@ -0,0 +1,284 @@ + + + + + + Subversion Basics + + + + + + + + +
+

Subversion Basics

+

We use Apache Subversion for version control. For a complete reference on Subversion see the Subversion Book. You can browse our repository in your web browser.

+

This page gives instructions on performing basic development tasks using Subversion. This instruction assumes you have Apache Subversion installed.

+

Overview

+

You begin using Subversion by copying a directory from a remote repository to a local directory on your file system. This is known as a checkout of a working copy.

+

Subversion uses a copy-modify-merge model meaning that you can add and edit files and directories in your working copy like any other files on your system, but you should use subversion commands for everything else such as svn copy and svn move instead of the operating system commands.

+

Sub-commands and Abbreviations

+

Subversion's commands can be ran from a command shell such as Bash on Linux. The subversion command is svn followed by optional sub-commands, options, and arguments.

+

to see the program version and modules

+
$ svn --version
+
+ + +

or a sub-command

+
$ svn <subcommand> [options] [args]
+
+ + +

Most sub-commands take file and/or directory arguments, recursing on the directories. If no arguments are supplied to such a command, it recurses on the current directory (inclusive) by default. (from svn help)

+

The following is only a partial list of sub-commands relating to this instruction. For a complete list, see the Subversion Book, or use svn help.

+ +

Client Configuration

+

Committers need to configure their Subversion client to handle the differences in line endings of text files on different operating systems.

+

There are instances where Subversion may need to open an editor. You need to have the environment variable EDITOR set to the editor you would like to use. To set it for the current terminal session in Bash (your path may differ):

+
$ export EDITOR=/usr/bin/vim
+
+ + +

Repository Layout

+

The OOo repository layout uses the following top-level directories branches, site, tags, and trunk.

+ +

Getting the source code

+

From the parent directory of where you want the working copy. In this example the ooo-trunk directory will be created if it does not exist.

+
$ svn co https://svn.apache.org/repos/asf/incubator/ooo/trunk ooo-trunk
+A    ooo-trunk/tools
+A    ooo-trunk/tools/dev
+A    ooo-trunk/tools/dev/fetch-all-cws.sh
+A    ooo-trunk/tools/dev/cws-list.txt
+A    ooo-trunk/tools/dev/fetch-all-web.sh
+A    ooo-trunk/tools/dev/web-list.txt
+A    ooo-trunk/tools/dev/single-hg.sh
+Checked out revision 1145818.
+
+ + +

"A" indicates file or directory is "Added" to working copy

+

Basic Work Cycle

+ +

Adding a File

+

After creating the file "test-file.txt" in the working copy.

+
$ svn status
+?       test-file.txt
+
+ + +

? indicates test-file.txt is not under version control

+

Scheduling a file for addition to repository

+
$ svn add test-file.txt
+A         test-file.txt
+
+$ svn status
+A       test-file.txt
+
+ + +

"A" indicates file is scheduled for addition

+

Running a diff

+
$ svn diff
+Index: test-file.txt
+===================================================================
+--- test-file.txt   (revision 0)
++++ test-file.txt   (revision 0)
+@@ -0,0 +1 @@
++This is a test file for svn-basics.
+
+Property changes on: test-file.txt
+___________________________________________________________________
+Added: svn:eol-style
+   + native
+
+ + +

Committing a file

+
$ svn commit test-file.txt -m "added test-file.txt"
+Adding         test-file.txt
+Transmitting file data .
+Committed revision 2.
+
+ + +

Update the working copy

+
$ svn update
+U    test-file.txt
+Updated to revision 3.
+
+ + +

"U" indicates an "Update" to a file or directory

+

Modify the file (this example uses the vim editor)

+
$ vim test-file.txt
+
+ + +

Check the Status

+
$ svn status
+M       test-file.txt
+
+ + +

"M" indicates the file has been "Modified"

+
$ svn diff
+Index: test-file.txt
+===================================================================
+--- test-file.txt   (revision 3)
++++ test-file.txt   (working copy)
+@@ -1,2 +1,3 @@
+ This is a test file for svn-basics.
+ This is a new line added by someone else.
++This line added by me.
+
+ + +

Resolving Conflicts

+

Suppose someone edits the same line as you before you commit

+
$ svn update
+Conflict discovered in 'test-file.txt'.
+Select: (p) postpone, (df) diff-full, (e) edit,
+        (mc) mine-conflict, (tc) theirs-conflict,
+        (s) show all options:
+
+ + +

This is just like if you had ran the svn resolve command

+

Selecting df displays this:

+
--- .svn/text-base/test-file.txt.svn-base   Sun Jul 17 17:38:52 2011
++++ .svn/tmp/test-file.txt.tmp  Sun Jul 17 21:35:09 2011
+@@ -1,2 +1,7 @@
+ This is a test file for svn-basics.
+ This is a new line added by someone else.
++<<<<<<< .mine
++This line added by me.
++=======
++This line is added by someone else also.
++>>>>>>> .r4
+Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved,
+        (mc) mine-conflict, (tc) theirs-conflict,
+        (s) show all options:
+
+ + +

If you choose e, Subversion will launch an editor with both sets of changes included for you to edit. You can save your changes in the editor and then select r (for resolved).

+
G    test-file.txt
+Updated to revision 4.
+
+ + +

"G" indicates "merGed"

+

Committing the Changes

+
$ svn commit test-file.txt -m "added new line"
+Sending        test-file.txt
+Transmitting file data .
+Committed revision 5.
+
+ + +

For further information see the Basic Work Cycle page from Subversion Book.

+

Submitting Changes By Others

+

Coming Soon

+

Creating Patches

+

Coming Soon

+
+ + + + +