Branching and Merging of PubMan subversion projects

From MPDLMediaWiki
Jump to navigation Jump to search

Please Note: Page under development

Create branch[edit]

  • Create new development branches in the affected repositories.
$ svn copy https://subversion.mpdl.mpg.de/repos/<repo>/trunk/<top-module> \
           https://subversion.mpdl.mpg.de/repos/<repo>/branches/<name-of-new-branch>/<top-module> \
           -m "Creating a branch of /<repo>/trunk/<top-module> for ..."

where <repo>={common,pubman,...}, <top-module>={common_services,pubman,...}.

  • Checkout branches in new local working directory
$ mkdir path_to_escidoc_dir/branches/<name-of-new-branch>
$ cd path_to_escidoc_dir/branches/<name-of-new-branch>
$ svn co https://subversion.mpdl.mpg.de/repos/<repo>/branches/<name-of-new-branch>/<top-module>

Eclipse setup[edit]

Prerequisites[edit]

  • subclipse plugin (1.6.10+)
  • maven plugin (0.10.0+)

Create new eclipse workspace[edit]

  1. File->Switch Workspace->Other
  2. Add new name of workbench, e.g. "<path_to_eclipse_workspaces>/workspace_<name-of-new-branch>"
  3. Check Copy Settings->Workbench Layout

Import eSciDoc top-modules[edit]

in created workspace as Maven Projects (is needed for SVN update of top-module and changes in <top-module>/pom.xml, etc.)

  1. File->Import->Existing Maven Projects->Next->Root Directory->Browse
  2. Select <top-module> folder in path_to_escidoc_dir/branches/<name-of-new-branch>/<top-module>
  3. Uncheck all sub-modules
  4. Press button "Finish"
    The top-modules can be added to the eclipse Working Set of Package Explorer, it can be named, e.g. "Top modules".

Import eSciDoc sub-modules[edit]

which will be changed as Maven Projects. Same procedure as top-module above

Workcycle[edit]

Switching between main trunk and development branch[edit]

Modules, which will not be changed can be switched to the main trunk. It ensures a recent state of the modules after svn update

  • Right mouse button click on the module->Team->Switch to another Branch/Tag/Revision ...
  • Select...->trunk/<top-module>/<module>->OK

As soon as a module is supposed to be changed, it should be switched to the branch

  • Right mouse button click on the module->Team->Switch to another Branch/Tag/Revision ...
  • Select...->branches/<name-of-the-new-branch>/<top-module>/<module>->OK
    Subversion url of the selected module can be checked in Properties->Subversion

You can work now on the branch and you need not be afraid to make any changes in main trunk

Merging[edit]

main trunk -> branch[edit]

is needed to replicate the changes in the main trunk to your branch. It can happen if development of your branch and main trunk goes parallel.

  1. check status of the branch with
    $ cd path_to_escidoc_dir/branches/<name-of-new-branch>/<top-module>
    $ svn status
    or in eclipse (Package Explorer subversion icons)
  2. commit changes in the branch, if changes have been done
  3. Right mouse button click on the module->Team->Merge->Merge a range of revisions->Button Next->Merge from: (Select trunk/<top-module>/<module>)
  4. Check radio button "Select revisions on next page"->Button Next
  5. Check all revisions in the list since the branch has been created.
    You can check the start revision of the branch in svn history of <top-module>
  6. Press Next Button
  7. Resolve merging conflicts if needed
    You can revert merge results with Right mouse button click on the module->Team->Revert
  8. commit changes to the branch

branch -> main trunk[edit]

is needed after complete implementation of the features in the branch.

  1. switch url of the branched module to the url of main trunc module.
  2. commit changes

Related links[edit]

Please add your comments: Talk:Subversion_Branching_and_Merging