Mirror a remote repository in a local branch

The vendor branches section of the book was written before Subversion grew 
support for foreign repository merges. If I was rewriting that section now, 
I would absolutely mention this feature.

1. 'svn export' the remote branch.

2. 'svn import' the branch stuff into your own repository. Actually, I'd 
recommend doing a local 'svn add' and 'svn commit' so you have the chance to 
make sure the properties on the files and directories match those in the 
foreign repository (see below). In either case, record the version of the 
remote code that you're importing.

3. Make your customizations as normal, cimmit, etc.

4. When you need to sync up your mirror, just use:

    $ svn merge FOREIGN-URL_at_MIRRORED-REV \ 
                FOREIGN-URL_at_HEAD \ 
                mirror-working-copy

    (where MIRRORED-REV was the revision of the code you imported or 
    last merged, of course).

It has some gotcha:

   * renames in the foreign repository can really interfere with the merges 
     that bring them into your own repository.

   * you have to make sure that when you make your initial import of the 
     remote code that your auto-props don't set props on the files in your 
     repository differently than they are in the remote one (or you run the 
     risk of future conflicts)

   * there's no merge tracking support.

But I use this feature myself to maintain vendor branches, and I've been 
pretty happy with the results. 

你可能感兴趣的:(repository)