Difference between revisions of "OOo and Subversion"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Notes)
m
 
(20 intermediate revisions by 9 users not shown)
Line 1: Line 1:
=OOo and Subversion=
+
{{Old|EN}}
== Migration ==
+
[[Category:SVN]][[Category:SCM]]
see [[SVNMigration|Subversion Migration]]
+
__TOC__
  
== Setting Up Subversion Access ==
+
== CWS Tooling ==
see [[Setting up Subversion Access]].
+
 
+
==CWS tooling==
+
  
 
The CWS tooling has been reworked to adapt to SVN. The basic CWS tool is now simply called <tt>cws</tt> and is invoked as <tt>cws <subcommand></tt> in the style of the SVN client, there are no longer separate tools like <tt>cwsadd</tt>, <tt>cwsresync</tt> etc etc.
 
The CWS tooling has been reworked to adapt to SVN. The basic CWS tool is now simply called <tt>cws</tt> and is invoked as <tt>cws <subcommand></tt> in the style of the SVN client, there are no longer separate tools like <tt>cwsadd</tt>, <tt>cwsresync</tt> etc etc.
  
 +
<div style="background:#888888; padding:10px>
 
Note: the <tt>cws</tt> script will probably change over time as we learn how the usage patterns evolve. If you got a problem with the <tt>cws</tt> script, it might be worthwhile to rebase it to the latest version
 
Note: the <tt>cws</tt> script will probably change over time as we learn how the usage patterns evolve. If you got a problem with the <tt>cws</tt> script, it might be worthwhile to rebase it to the latest version
 
  $ cd <your_CWS>/ooo/solenv/bin
 
  $ cd <your_CWS>/ooo/solenv/bin
Line 15: Line 13:
 
  $ cd modules
 
  $ cd modules
 
  $ svn merge svn+ssh://svn@svn.services.openoffice.org/ooo/trunk/solenv/bin/modules/CwsConfig.pm
 
  $ svn merge svn+ssh://svn@svn.services.openoffice.org/ooo/trunk/solenv/bin/modules/CwsConfig.pm
 +
</div>
  
 +
The most important change in the way CWSs are handled now is that there is no longer a need nor possibility to add modules. Well, there is still a <tt>sw</tt> and <tt>config_office</tt> but all modules of old are now just top level directories, at least as far as SVN is concerned. They still remain a concept of the build system of course.
  
The most important change in the way CWSs are handled now is that there is no longer a need nor possibility to add modules. Well, there is still a <tt>sw</tt> and <tt>config_office</tt> but all modules of old are now just top level directories, at least as far as SVN is concerned.
+
see [http://wiki.services.openoffice.org/wiki/Setting_up_Subversion_Access#CWS_Tooling_Setup|| CWS Tooling Setup] for details on the preparations needed to use the new CWS tooling.
 
+
===CWS config file===
+
 
+
Please keep all your entries in your <tt>$HOME/.cwsrc</tt> for now, you'll need them if you want to work with CWSs for OOo-3.0. Just add the following line to refer to the OpenOffice.org SVN server:
+
 
+
SVN_SERVER=svn+ssh://svn@svn.services.openoffice.org/ooo
+
 
+
Example of a complete <tt>.cwsrc</tt> file:
+
 
+
[CWS_CONFIG]
+
# Network proxy for EIS connections.
+
# Comment in if you need to access EIS via a proxy.
+
# Note: This is just for accessing the EIS database. For SVN have a look here:
+
# http://svnbook.red-bean.com/nightly/en/svn.advanced.confarea.html#svn.advanced.confarea.opts.servers
+
# Example: PROXY=http://myproxy.company.com:8080
+
# PROXY=
+
+
# CWS Database server (SOAP). It's possible specify to several backup server,
+
# currently there are none.
+
CWS_DB_SERVER_1=https://eis.services.openoffice.org/soap/servlet/rpcrouter
+
+
# Your CVS login (for authentication with the CWS database).
+
CVS_ID=<your_ooo_name>
+
+
# Your scrambled CVS password (for authentication with the CWS database).
+
# Take this one from .cvsrc
+
CVS_PASSWORD=<your_current_cvs_scrambled_ooo_password>
+
+
# OOo CVS tunnel
+
# Example: CVS_SERVER_ROOT=pserver:cvs_id@mytunnel.mydomain.de:/cvs
+
CVS_SERVER_ROOT=
+
+
# Path to the cvs binary (optional)
+
# Example: CVS_BINARY=/usr/bin/cvs
+
#CVS_BINARY=
+
+
# SVN server for OOo-3.1 child workspaces
+
# r/w access via svn+ssh pprotocol
+
SVN_SERVER=svn+ssh://svn@svn.services.openoffice.org/ooo
+
# r/o access via svn protocol
+
#SVN_SERVER=svn://svn.services.openoffice.org/ooo
+
  
===Working with the new <tt>cws</tt> tool===
+
=== Solving Common Tasks with the CWS Command ===
  
 
Help can be invoked with:
 
Help can be invoked with:
Line 87: Line 46:
 
The subcommands do more or less what their CVS predecessors did.
 
The subcommands do more or less what their CVS predecessors did.
  
====Create a CWS====
+
==== Create a CWS ====
  
 
Create a CWS with the <tt>cws create</tt> subcommand. Please note that this commands only creates a CWS branch on the OOo server and registers it with EIS. It changes nothing on your hard disk.
 
Create a CWS with the <tt>cws create</tt> subcommand. Please note that this commands only creates a CWS branch on the OOo server and registers it with EIS. It changes nothing on your hard disk.
Line 111: Line 70:
 
for check out.
 
for check out.
  
====Check out a CWS====
+
==== Checking out a CWS ====
  
 
  $ cws fetch -c foo <workspace name>
 
  $ cws fetch -c foo <workspace name>
Line 136: Line 95:
 
will fetch the differences between your working copy in <wc> and the CWS ''foo''
 
will fetch the differences between your working copy in <wc> and the CWS ''foo''
  
====Rebasing a CWS====
+
==== Rebasing a CWS ====
  
 
===== Updating CWS Tooling =====
 
===== Updating CWS Tooling =====
{{Documentation/Caution| If your CWS is based on a milestone earlier than m36, please upgrade the cws utilities first before attempting to rebase. Utility revisions of m36 or later contain vital fixes.}}
+
{{Warn| If your CWS is based on a milestone earlier than DEV300_m36, please upgrade the cws utilities first before attempting to rebase. Utility revisions of m36 or later contain vital fixes.}}
  
 
To upgrade the CWS utilities issue the commands
 
To upgrade the CWS utilities issue the commands
Line 153: Line 112:
  
 
===== Merging changes from master to working copy =====
 
===== Merging changes from master to working copy =====
 +
{{Warn| Always merge into a "clean" working copy:
 +
* no mixed revisions (svn update *is* mandatory)
 +
* no locally modified files}}
 +
 
The successor of the <tt>cwsresync</tt> tool is called <tt>cws rebase</tt>. rebasing is now a two step operation:
 
The successor of the <tt>cwsresync</tt> tool is called <tt>cws rebase</tt>. rebasing is now a two step operation:
  
  export CWS_WORK_STAM=<name of the CWS>
+
  export CWS_WORK_STAMP=<name of the CWS>
 
  cws rebase -m latest <path to the CWS checkout>
 
  cws rebase -m latest <path to the CWS checkout>
  
merge the changes from latest milestone available on the mws into CWS. Please note that PATH_TO_SVN_CHECKOUT is the path of the directory where your CWS is located. A REBASE.LOG logfile will be created for your records in the root directory of the repository. A file named REBASE.CONFIG_DONT_DELETE will also be created after successful merging.  This file will be needed by the subsequent <code>cws rebase -C</code> command.
+
merge the changes from latest milestone available on the mws into CWS. A REBASE.LOG logfile will be created for your records in the root directory of the repository. A file named REBASE.CONFIG_DONT_DELETE will also be created after successful merging.  This file will be needed by the subsequent <code>cws rebase -C</code> command.
 +
 
 +
{{Warn| If you don't see the file named REBASE.CONFIG_DONT_DELETE, that means that the merge was not successfully completed.}}
  
{{Documentation/Caution| If you don't see the file named REBASE.CONFIG_DONT_DELETE, that means that the merge was not successfully completed.}}
+
'' Remark: export doesn't work with all shells. Is a special shell mandatory for a rebase to run? ''
  
 
===== Resolving conflicts =====
 
===== Resolving conflicts =====
Line 180: Line 145:
  
 
commits the merge into your cws.
 
commits the merge into your cws.
 
====How to migrate still active CVS based child workspaces destined for DEV300 to SVN?====
 
 
Let's assume your CVS based CWS is called 'foo42'.
 
 
=====CVS tasks=====
 
 
1) Find out the CVS branch tag and anchor tag of your CWS.
 
 
$ cd <added_module>
 
$ cvs log <some_file_which_already_existed_before_your_cws> | grep -i foo42
 
        CWS_SRC680_FOO42_ANCHOR: 1.36
 
        cws_src680_foo42: 1.36.0.44
 
 
The first tag (<tt>CWS_SRC680_FOO42_ANCHOR</tt>) is your anchor tag, the second tag (<tt>cws_src680_foo42</tt>) is your branch tag. Note them down.
 
 
2) Rebase your CVS based CWS to milestone DEV300 m31 with the old CWS tools
 
 
$ cwsresync -m m31 all
 
... solve conflicts ...
 
$ cwsresync -c all
 
 
3) Create a patch containing all modules. It is recommend to use the "rdiff" CVS command. A "rdiff" is quite handy for this purpose, because it allows the creation of one patch for all "added" modules. Use the "-u" switch for creating a so called "unified context patch".
 
 
$ cvs -d <your_tunnel_setup> rdiff -u -rCWS_SRC680_FOO42_ANCHOR -rcws_src680_foo42 `cwsquery modules` > foo42.patch
 
 
4) Check the patch for consistency. It should contain only stuff you did on your CWS. Throw out trivial changes.
 
 
5) Search the patch for lines which starts with
 
 
diff -u /dev/null <some_file>:<some_revision>
 
 
These files have been added to your CWS. Note the filenames down, you'll need them later.
 
 
6) Search the patch for lines which end with <tt>:removed</tt>
 
 
diff -u <some_file>:<some_revision> <some_file>:removed
 
 
These files have been removed in your CWS. Note the filenames down, you'll need them later.
 
 
=====SVN tasks=====
 
 
7) Check out the OOo trunk with
 
 
$ svn checkout svn+ssh://svn@svn.services.openoffice.org/ooo/trunk my_working_copy
 
 
8) Configure and source the configured script as usual
 
 
$ cd my_working_copy/config_office
 
$ configure
 
...
 
$ cd ..
 
$ source LinuxX86Env.Set.sh  # YMMV
 
 
9) Create the CWS branch in SVN
 
 
$ cws create --migration -m m32 DEV300 foo42
 
 
This command creates the CWS branch in Subversion based on milestone DEV300 m32 and updates the "current milestone" information in EIS. Milestone DEV300 m32 is essentially the same as DEV300 m31 (just a few fixes for SVN and CWS tooling).
 
 
The <tt>--migration</tt> switch tells the <tt>cws create</tt> command that an existing CWS is migrated. Without the switch, EIS will complain that your CWS already exists.
 
 
10) Switch your working copy to your CWS branch
 
 
$ cd my_working_copy
 
$ svn switch svn+ssh://svn@svn.services.openoffice.org/ooo/cws/foo42
 
...
 
$ svn info
 
Path: .
 
URL: svn+ssh://svn@svn.services.openoffice.org/ooo/cws/foo42
 
Repository Root: svn+ssh://svn@svn.services.openoffice.org/ooo
 
Repository UUID: 8da58560-a4e7-4996-a0c2-a735b94b261c
 
...
 
 
Check the URL: line of the output of <tt>svn info</tt>. It should point to your CWS branch. '''Please be extra certain that you never commit anything on trunk.''' You can always check the branch on which you are working with <tt>svn info</tt>.
 
 
11) Apply the patch
 
 
$ cd my_working_copy
 
$ patch -p1 < foo42.diff
 
 
Since DEV300 m31 and DEV300 m32 are almost identical, your patch should apply cleanly. If you get rejects you'll need to fix them manually. The patch tool handles added and removed files quite nicely, the first ones are created by <tt>patch</tt>, the latter ones appear as zero byte sized files in the tree.
 
 
12) Handle added and removed files
 
 
This is pretty straight forward. You need to tell SVN which files have been added or removed by your patch.
 
$ svn add <list_of_added_files>
 
$ rm <list_of_removed_files>
 
$ svn remove <list_of_removed_files>
 
 
13) Commit the changes to your CWS branch
 
 
Review all changes with
 
$ svn status
 
$ svn diff
 
 
and if everything is OK, commit them to your branch
 
$ svn commit -m"#iXXXXX#: migrate CWS foo42 to SVN."
 
 
Remember, always check that your working copy has been switched to the CWS branch before committing.
 
 
=====Do I really need to resync first to DEV300 m31 in CVS? Can I use a later milestone than DEV300 m32 in SVN?=====
 
 
No and yes resp. If you are certain that your patch applies cleanly or you are prepared to handle the rejects, you can skip the resync part of the recipe or/and start of from a newer SVN based milestone. Working with DEV300 m31 (CVS) and DEV300 m32 (SVN) almost ensures that the patch applies cleanly which is why we recommend to work with them.
 
  
 
== Subversion Usage Examples ==
 
== Subversion Usage Examples ==
Line 293: Line 154:
  
 
=== Switching between milestones ===
 
=== Switching between milestones ===
Switch from milestone ''DEV300_m32'' to ''DEV300_m35'' (safes potentially a lot of checkout time):
+
Switch from milestone ''DEV300_m32'' to ''DEV300_m35'' (saves potentially a lot of checkout time):
  
 
  cd DEV300_m32
 
  cd DEV300_m32
Line 299: Line 160:
 
  cd ..
 
  cd ..
 
  mv DEV300_m32 DEV300_m35
 
  mv DEV300_m32 DEV300_m35
 +
 +
You should then:
 +
 +
dmake clean
 +
 +
before trying to build &mdash; some directory names are hard-coded into the generated build data, and you just changed the name of the directory!
  
 
=== Checking out a cws ===
 
=== Checking out a cws ===
Line 310: Line 177:
 
  cd foo
 
  cd foo
 
  svn update
 
  svn update
 +
 +
'' Remark: doesn't work. returns the following line: ''
 +
Skipped '.'
  
 
=== Find out where a working copy originated ===
 
=== Find out where a working copy originated ===
Line 353: Line 223:
 
  $ svn diff http://svn.services.openoffice.org/ooo/tags/DEV300_m32/sw/source/core  http://svn.services.openoffice.org/ooo/cws/swrefactormarks2/sw/source/core@4711
 
  $ svn diff http://svn.services.openoffice.org/ooo/tags/DEV300_m32/sw/source/core  http://svn.services.openoffice.org/ooo/cws/swrefactormarks2/sw/source/core@4711
 
This compares the cws at revision 4711 to the milestone m32
 
This compares the cws at revision 4711 to the milestone m32
 
+
=== Viewing files modified and changelog entries for all commits to a cws ===
 
+
$ svn log -v --stop-on-copy http://svn.services.openoffice.org/ooo/cws/swrefactormarks2
 
+
=== View a changeset ===
 
+
$ svn diff -c266422 svn+ssh://svn@svn.services.openoffice.org/ooo
[[Category:SVN]]
+
=== What did a changeset do to the paths in your working copy? ===
 
+
$ svn diff -c266422
== [[Image:Headline text]] ==
+
=== What did a changeset do to the file gtkframe.cxx in your working copy? ===
 +
$ svn diff -c266422 gtkframe.cxx
 +
== Other Subversion Topics ==
 +
* see [[Setting up Subversion Access]]
 +
* see [[SVNMigration|Subversion Migration]]

Latest revision as of 14:03, 17 November 2018

Book-old.png    This article is outdated.    

CWS Tooling

The CWS tooling has been reworked to adapt to SVN. The basic CWS tool is now simply called cws and is invoked as cws <subcommand> in the style of the SVN client, there are no longer separate tools like cwsadd, cwsresync etc etc.

Note: the cws script will probably change over time as we learn how the usage patterns evolve. If you got a problem with the cws script, it might be worthwhile to rebase it to the latest version

$ cd <your_CWS>/ooo/solenv/bin
$ svn merge svn+ssh://svn@svn.services.openoffice.org/ooo/trunk/solenv/bin/cws.pl
$ cd modules
$ svn merge svn+ssh://svn@svn.services.openoffice.org/ooo/trunk/solenv/bin/modules/CwsConfig.pm

The most important change in the way CWSs are handled now is that there is no longer a need nor possibility to add modules. Well, there is still a sw and config_office but all modules of old are now just top level directories, at least as far as SVN is concerned. They still remain a concept of the build system of course.

see CWS Tooling Setup for details on the preparations needed to use the new CWS tooling.

Solving Common Tasks with the CWS Command

Help can be invoked with:

cws help

which yields

cws -- version: 1.1.2.10
usage: cws <subcommand> [options] [args]
Type 'cws help <subcommand>' for help on a specific subcommand.

Available subcommands:
        help (h,?)
        create
        fetch (f)
        rebase (rb)
        analyze (an)
        query (q)
        task (t)
        integrate *** release engineers only ***
        eisclone *** release engineers only ***
help (h, ?): Describe the usage of this script or its subcommands
usage: help [subcommand]

The subcommands do more or less what their CVS predecessors did.

Create a CWS

Create a CWS with the cws create subcommand. Please note that this commands only creates a CWS branch on the OOo server and registers it with EIS. It changes nothing on your hard disk.

Example: create CWS foo on the latest published milestone of master DEV300.

cws create DEV300 foo

Of course you can specify which milestone you want to use, here is the complete command reference:

cws -- version: 1.1.2.10
create: Create a new child workspace
usage: create [-m milestone] <master workspace> <child workspace>
       -m milestone:          Milestone to base the child workspace on. If ommitted the
                              last published milestone will be used.
       --milestone milestone: Same as -m milestone.

Your CWS branch is then available as

svn://svn.services.openoffice.org/ooo/cws/foo


for check out.

Checking out a CWS

$ cws fetch -c foo <workspace name>

Currently this simply checks out your cws foo just as if you had issued the command. <workspace name> specifies the name of the folder where the cws shall be created in.

$ svn checkout svn+ssh://svn@svn.services.openoffice.org/ooo/cws/foo

A milestone can be fetched with

$ cws fetch -m DEV300_m32

this is equivalent to

$ svn checkout svn+ssh://svn@svn.services.openoffice.org/ooo/tags/DEV300_m32

Over time I'll add a number of convenience functions to cws fetch, like configurable partial checkouts, use of prebuild solvers, switching CWSs etc etc.

Please note that if you have already a OOo SVN working copy lying around, you can save considerable checkout time with the svn switch command.

cd <wc>
svn switch svn+ssh://svn@svn.services.openoffice.org/ooo/cws/foo

will fetch the differences between your working copy in <wc> and the CWS foo

Rebasing a CWS

Updating CWS Tooling
Documentation caution.png If your CWS is based on a milestone earlier than DEV300_m36, please upgrade the cws utilities first before attempting to rebase. Utility revisions of m36 or later contain vital fixes.

To upgrade the CWS utilities issue the commands

cd my_working_copy
cd solenv/bin
svn merge svn+ssh://svn@svn.services.openoffice.org/ooo/trunk/solenv/bin/cws.pl@264325
cd modules
svn merge svn+ssh://svn@svn.services.openoffice.org/ooo/trunk/solenv/bin/modules/Cws.pm@264325
svn merge svn+ssh://svn@svn.services.openoffice.org/ooo/trunk/solenv/bin/modules/CwsConfig.pm@264325
Merging changes from master to working copy
Documentation caution.png Always merge into a "clean" working copy:
  • no mixed revisions (svn update *is* mandatory)
  • no locally modified files

The successor of the cwsresync tool is called cws rebase. rebasing is now a two step operation:

export CWS_WORK_STAMP=<name of the CWS>
cws rebase -m latest <path to the CWS checkout>

merge the changes from latest milestone available on the mws into CWS. A REBASE.LOG logfile will be created for your records in the root directory of the repository. A file named REBASE.CONFIG_DONT_DELETE will also be created after successful merging. This file will be needed by the subsequent cws rebase -C command.

Documentation caution.png If you don't see the file named REBASE.CONFIG_DONT_DELETE, that means that the merge was not successfully completed.

Remark: export doesn't work with all shells. Is a special shell mandatory for a rebase to run?

Resolving conflicts

SVN requires you to mark files with conflicts as 'resolved' before you can commit the result of the conflict resolution:

svn resolve --accept=working <file_with_resolved_conflicts>

Other possible conflict resolutions are:

svn resolve --accept=theirs_full <file_with_conflicts>
svn resolve --accept=mine_full <file_with_conflicts>

for taking the un-merged MWS version resp. the un-merged CWS version of the file as conflict resolution.

Commiting merged changes

After resolving possible conflicts, the next step:

svn up
cws rebase -C <path to the CWS checkout>

commits the merge into your cws.

Subversion Usage Examples

Checking out a milestone

Check out a milestone DEV300 m32 with:

svn checkout svn://svn.services.openoffice.org/ooo/tags/DEV300_m32

Switching between milestones

Switch from milestone DEV300_m32 to DEV300_m35 (saves potentially a lot of checkout time):

cd DEV300_m32
svn switch svn://svn.services.openoffice.org/ooo/tags/DEV300_m35
cd ..
mv DEV300_m32 DEV300_m35

You should then:

dmake clean

before trying to build — some directory names are hard-coded into the generated build data, and you just changed the name of the directory!

Checking out a cws

Check out a child workspace foo:

svn checkout svn://svn.services.openoffice.org/ooo/cws/foo

Updating a working copy

Update working copy of foo:

cd foo
svn update

Remark: doesn't work. returns the following line: Skipped '.'

Find out where a working copy originated

Find out the base (milestone or cws) of working copy wc:

cd wc
svn info

List milestones/cws

List all available milestone and release tags:

svn list svn://svn.services.openoffice.org/ooo/tags

List all available child workspaces:

svn list svn://svn.services.openoffice.org/ooo/cws

(Probably EIS is better suited for these tasks.)

Logs

View commit log on a single file:

svn log file.cxx

View only changes on a branch (for example a cws)

svn log --stop-on-copy file.cxx

Include all paths affected by change sets in log command:

svn log --verbose file.cxx

Attribute blame:

svn annotate file.cxx

Showing the differences between a milestone on the master and a cws

$ svn diff http://svn.services.openoffice.org/ooo/tags/DEV300_m32/ http://svn.services.openoffice.org/ooo/cws/os120/

Showing the differences in a module or directory between a milestone on the master and a cws

$ svn diff http://svn.services.openoffice.org/ooo/tags/DEV300_m32/sw  http://svn.services.openoffice.org/ooo/cws/swrefactormarks2/sw

This shows the differences in module sw between the milestone DEV300_m32 (a tagged version in svn-speech) and the most current checkin on cws swrefactormarks2. Since modules are only directories in svn (not in any way special as they where with CVS), this can be used to compare any directory too. For example:

$ svn diff http://svn.services.openoffice.org/ooo/tags/DEV300_m32/sw/source/core  http://svn.services.openoffice.org/ooo/cws/swrefactormarks2/sw/source/core

A specific revision can be compared to the master like this:

$ svn diff http://svn.services.openoffice.org/ooo/tags/DEV300_m32/sw/source/core  http://svn.services.openoffice.org/ooo/cws/swrefactormarks2/sw/source/core@4711

This compares the cws at revision 4711 to the milestone m32

Viewing files modified and changelog entries for all commits to a cws

$ svn log -v --stop-on-copy http://svn.services.openoffice.org/ooo/cws/swrefactormarks2

View a changeset

$ svn diff -c266422 svn+ssh://svn@svn.services.openoffice.org/ooo

What did a changeset do to the paths in your working copy?

$ svn diff -c266422

What did a changeset do to the file gtkframe.cxx in your working copy?

$ svn diff -c266422 gtkframe.cxx

Other Subversion Topics

Personal tools