tags:

views:

38

answers:

2

If I use svn copy to take a snapshot of a portion of a repository, how can I update that snapshot?

Use case:

myrepo/
  trunk/
    src/
      something.c
      something.h
  tags/
  branches/

mkdir branches/user1/trusted

svn add branches/user1/

svn copy trunk/src branches/user1/trusted

myrepo/
  trunk/
    src/
      something.c
      something.h
  tags/
  branches/
    user1/
      trusted/
        src/
          something.c
          something.h

--- commits and changes happen in trunk/src/something.* here ---

myrepo/
  trunk/
    src/
      neatstuff.c           // new file
      something.c           // modified
      big_ugly_include.h    // was something.h, it got renamed
  tags/
  branches/
    user1/
      trusted/
        src/
          something.c
          something.h

Now I want branches/user1/trusted/src to be the latest version of trunk/src. How can I do this?

+3  A: 

this operation is called merge. The Subversion book covers it in detail.

edit with a bit more detail:

As Rob and sgreeve mention, deleting and recreating the branch is another option. I suggested merge because your example had you creating a branch - the purpose of which is concurrent modification. If your repository copies aren't to be modified after they're created, you're best off to create a tag rather than a branch.

DDaviesBrackett
Specifically, this section of the book deals with your scenario.http://svnbook.red-bean.com/en/1.5/svn.branchmerge.basicmerging.html#svn.branchemerge.basicmerging.stayinsync
sgreeve
+2  A: 

As an alternative to merging, if you're simply after a straightforward tag update, you could delete the copy and re-create it.

Rob
I agree: it's only worth doing a merge if the files under /branches are being updated in parallel with updates being made to the trunk. If you literally want to take a snapshot of the trunk, better to recreate the branch using svn copy.
sgreeve
thanks! [[useless filler to deal with the 15-char minimum]]
Jason S