15

Suppose a remote SVN repository has this structure:

/project
        /src
        /bulk

Now for some reason I already have a copy of bulk (assumed unchanging or rarely changing) elsewhere on my machine. Can I somehow checkout a new copy of the repository, but pre-provide the bulk directory so it doesn't get downloaded again?

To clarify, this hypothetical process should certainly check the checksums on the files in the bulk directory and update those files which aren't correct, so that ultimately I'll have a complete, consistent checkout. I just want to shortcut past downloading those files which I already have verbatim.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Kerrek SB
  • 464,522
  • 92
  • 875
  • 1,084
  • I don't think so but more importantly that leads to the problem that your svn repo is no longer authoritative. In addition what about others (including your future self - on another machine) who don't have the now magic bulk. What exactly is bulk? Data, 3rd party library it might help us direct you to a best practice. – Steve Robillard Dec 11 '11 at 23:57
  • @SteveRobillard: The magic bulk is part of the repo (say it's a collection of sountrack files). I just happen to have downloaded those already, and I want to take advantage of that. I'm very happy for checksums to be verified and all this! – Kerrek SB Dec 11 '11 at 23:59
  • Similar to https://stackoverflow.com/questions/192824/svn-checkout-ignore-folder – Paul Verest Jul 24 '17 at 02:13

3 Answers3

27
  1. Checkout /project, specifying the depth to be 'empty'.
  2. Update /project/src specifying infinite depth.
  3. Copy your current bulk working copy into the project directory working copy.

e.g.

svn checkout --depth empty http://svnserver/project/ project
svn update --set-depth infinity project/src
// copy your current /bulk into /project

Note - this takes advantage of the sparse directories feature introduced in Subversion 1.5.

Adam Ralph
  • 29,453
  • 4
  • 60
  • 67
  • 2
    Could you spell this out a bit further for a complete SVN newbie? :-) – Kerrek SB Dec 11 '11 at 23:58
  • If `/bulk` isn't changing, and you don't intend to check it out from the repo, there's no need for it to be in the repo. Just keep your `/src` folder in the repo. –  Dec 12 '11 at 00:00
  • @bdares: It's not my repo, though! :-) – Kerrek SB Dec 12 '11 at 00:02
  • @KerrekSB Quick, now's your chance to skip SVN and get on the Hg/Git/Foo wagon! ;-) –  Dec 12 '11 at 00:03
  • @Kerrek SB: which SVN client are you using? – Adam Ralph Dec 12 '11 at 00:03
  • @pst: LOL - I couldn't agree more! ;-) – Adam Ralph Dec 12 '11 at 00:04
  • (Practically, I'm talking about the `trunk/sc2/content` directory of the *[Ur-Quan Masters](http://sc2.svn.sourceforge.net/viewvc/sc2/)* repository. Any suggestions for change of RCS should be directed to the project leads who cannot be thanked enough for their work.) – Kerrek SB Dec 12 '11 at 00:04
  • 1
    To see the tree, with empty subdirs: `svn checkout --depth immediates http://svnserver/project/ project` ... and then `cd` to what you need and `svn update --set-depth infinity` within the empty subdir. – stevesliva Sep 08 '15 at 19:56
  • @stevesliva `immediates` - nice tip – Adam Ralph Sep 09 '15 at 07:32
1

Instructions when using TortoiseSVN 1.7 and newer:

  1. "SVN Checkout" to /project, specifying "Checkout Depth" as "Only this item"
  2. "SVN Checkout" to /project/trunk, specifying "Checkout Depth" as "Fully recursive"
Juuso Ohtonen
  • 8,826
  • 9
  • 65
  • 98
-1

Last time I had to do this, I had an enormous number of demo files in a directory, and I just moved these to a new directory out of trunk.

You might consider doing something similar, and adding bulk to svn:ignore, if you need bulk to be in the same directory.

Steve Rukuts
  • 9,167
  • 3
  • 50
  • 72
  • So you mean I should decouple the `bulk` from revision control and just use my local copy for my local machine? I guess that's a workaround, though I was really hoping to be able to "seed" my checkout with the local files. – Kerrek SB Dec 12 '11 at 00:06
  • No, `bulk` would remain in version control, but not in `trunk`. This way you will be able to avoid a large check-out. – Steve Rukuts Dec 12 '11 at 00:08