On Apr 16, 2009, at 06:17:59 PDT, David Shere
> I have an export of my repository which I wish to make into a working
> Here's my situation:
> I use Subversion to manage my music library. I have a working copy at
> home and at work, and sometimes check out portions in other places. I
> recently deleted my working copy at work and need to restore it. The
> server is hosted at home, so when I check out at work, I'm depending
> my upload bandwidth at home, which is minimal. An export of the
> is 10GB, but a working copy is 21GB. I can bring an export to work on
> my 16GB USB Flash drive, but the flash drive is too small for a
> copy. That's why I want to put an export on my flash drive (at home),
> take it to work, and then convert the export to a working copy.
> This hasn't been an issue in the past because each update at work was
> only a handful of files, since I was adding music to the repository
> album at a time. Now that I have to check out the entire library, it
> becomes a much more bandwidth-hungry operation. I have seen some
> tutorials on how to make an export from a working copy, but not the
> other way around. I would make no changes to the export.
> I realize there are other ways to do this:
> 1. Use the flash drive to copy half of the working copy one day and
> other half the next day
> 2. Run a series of checkout/interrupt iterations at work.
> I'm wondering if there's a tool in Subversion to do the work for me.
Instead you could check out a working copy at home. Remove the
non .svn related files, copy it to your flash drive, take it to work,
copy it to your work machine, restore the regular files, and switch
If you have a unix-like (i.e. Linux/MacOSX) machine at home, here's
how you could do this:
1. For the following assume that when at home the URL to checkout your
working copy is:
and that when you are at work the URL to checkout the same working
2. Assume that the temporary working copy on your home machine is to
be created in:
3. Assume that your flash drive can be found at:
(That's the same path both at home and at work)
4. Assume that at work your final working copy is going to live in:
5. First checkout a fresh working copy at home (you could skip this
step and use an existing working copy provided it has NO modifications
-- svn stat shows nothing -- not recommended though as any
svn:ignore'd files will be removed and you'll have to run a recursive -
R revert on it later)
mkdir -p /tmp/svn/project_towork
svn co file:///svn/project/trunk /tmp/svn/project_towork
6. Now remove all non-.svn files from the new working copy (BE VERY
CARFUL WITH THIS STEP!)
find /tmp/svn/project_towork -name .svn -prune -o -type f -print0 |
xargs -0 rm -f
NOTE: That's actually one line that's been wrapped. If you break
it after the | as shown above the shell will prompt you for the rest
or you can just unwrap it onto one line when you enter it.
BE VERY CAREFUL WITH THIS STEP -- variations of the above command
could remove more than just the non-.svn files in your new working copy.
7. Verify that the newly pared down working copy will fit on your
du -hs /tmp/svn/project_towork # Size of working copy as-is
tar czf - . | wc -c # Size tar archive would be in BYTES
NOTE: you can skip this step or use any other method to verify the
size. The above tar command will take almost as long to run as
actually creating the archive in the first place.
8. Create a tar archive of the newly pared down checkout on your flash
tar czf /Volumes/Flash/svn_towork.tgz .
NOTE: You can just copy the /tmp/svn/project_towork directory
directly to the flash drive, but using a tar archive makes sure you
don't miss any of the "." files and helps reduce the space needed by
consolidating everything into one file.
-- svn_towork.tgz TRAVELS VIA FLASH DRIVE SNEAKER NET TO WORK --
8. Unpack your tar archive at work.
IMPORTANT: Make sure the destination directory doesn't already
exist or it's empty!
mkdir -p /Users/me/project
tar xvf /Volumes/Flash/svn_towork.tgz -C /Users/me/project
NOTE: If you didn't use a tar archive in the first place, just copy
the working copy directory off the flash drive into the /Users/me
directory and then rename it to project.
9. Have svn restore the removed files from the copies in the .svn
svn -R revert /Users/me/project
NOTE: Be sure you get the path in the above command correct or you
could end up reverting files you don't intend to. Also this step
could take a while to run on a large checkout.
10. Switch the working copy URL so that it can be used from work.
svn switch --relocate file:///svn/ svn+ssh://home.machine/svn/
NOTE: You can also use the two full URLs here instead but they
wouldn't fit on the above line.
* This leaves an unused, pared-down working copy in /tmp/svn/
project_towork on your home machine. You can manually delete that or
use something like:
rm -rf /tmp/svn/project_towork # BE VERY CAREFUL ABOUT TYPOS!
* If you used an existing working copy at home (and skipped step 5)
then you'll need to cd to its directory and run this command before
you start using it again:
svn -R revert .
* The pared-down working copy created in step 6 will be just a little
bit larger than an export, but not much -- using a tar archive as
shown above will minimize the difference.
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-04-19 23:05:29 CEST