Open main menu

Subversion/Repository Layout

< Subversion
Revision as of 18:24, 8 December 2008 by Freephile (talk | contribs) (idea of how to layout a repo with third-party sources)

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)

Typical Layout

See http://svn.code-host.net/svn/example/

This is the top of the Subversion repository.

trunk/ ......... The latest development sources.  When people say
"Get the head of trunk", they mean the latest
revision of this directory tree.

branches/ ...... Various development branches.  Typically a branch
contains a complete copy of trunk/, even if the
changes are isolated to one subdirectory.  Note
that branch copies are generally removed after
they've been merged back into trunk, so what's in
branches/ now does not reflect all the branches
that have ever been created.

[http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.branchmerge.whatis What is a branch?]

tags/ .......... Snapshots of releases.  As a general policy, we
don't change these after they're created; if
something needs to change, we move it to
branches and work on it there.

Moving things

When you move things around, you affect the downstream editors/working copies. Editors may need to update their working copies using svn switch. And you may need to alter the authorization configuration of the repo so that those editors still have access to the same project sources.

Use the --relocate option only when rewriting the URL portion:

svn switch -v --relocate file:///var/svn/myrepo/widgets http://svn.example.com/myrepo/widgets

If you make a mistake, it could cause you to have to do a clean checkout.

Most switches should only involve path changes. A more programmatic approach would be a command like:

svn switch `cat .svn/entries |grep http |cut -d -f 2` http://svn.example.com/myrepo/widgets

Anyway, to find out where a working copy is pointing to, you can simply run svn info

$ svn info
Path: .
URL: http://svn.example.com/myrepo/widgets
Repository UUID: 4341fff5-530e-0410-bccg-gf26c29f061c
Revision: 3047
Node Kind: directory
Schedule: normal
Last Changed Author: buddysum
Last Changed Rev: 1975
Last Changed Date: 2006-08-31 12:11:23 -0400 (Thu, 31 Aug 2006)

Repository Layout Example

vendorsrc
  drupal
    current
    4.6
    4.7
    5.5
    6.6
  websvn
    current
  mediawiki
    current
  phpmyadmin
    current

websites
  www.example.com
    branches
    tags
    trunk
      www
        cms  (svn:externals http://svn.example.com/svn/myproject/vendorsrc/drupal/6.6)
        wiki (svn:externals http://svn.example.com/svn/myproject/vendorsrc/mediawiki/current)