newbie question
Adam Compton
comptona at gmail.com
Fri Nov 3 21:30:43 CET 2006
Hi Pau,
>> Like Ken mentioned, we use Subversion in a different way. Instead of
>> copying your home directory into a different directory somewhere, and
>> checking that into Subversion, we check our home directories themselves
>> directly into Subversion repositories.
>
> This means that you create svn repositories everywhere and then commit
> from those different repositories to your laptop?
>
> So you do something like
>
> svnadmin create --fs-type fsfs /media/disk1/repository1
>
>
> svnadmin create --fs-type fsfs /media/disk1/repository2
>
>
> etc... ???
>
> But then you need a "working copy", right?
>
> I must be really silly because I don't get it.
>
> I would naturally think that you do the following:
>
>
> svnadmin create --fs-type fsfs /media/disk1/repository1
>
>
> svnadmin create --fs-type fsfs /media/disk2/repository2
>
> etc etc (or to another computers)
>
> svn import /home/pau/directory1 (2, 3, etc)
> file:///media/disk1/repository1
>
> svn checkout file:///media/disk1/repository1 /home/pau/MyCheckOutCopy
>
> So that later I can svn commit /home/pau/MyCheckOutCopy to
> /media/disk1/repository1
>
> But this makes no sense to me!
>
> Can you try to give me an example for dummies??
>
> I guess the key is svn:externals, from which I have never heard...
>
> Anyway, thanks for your patience...
>
> Pau
Here is a simple example:
svnadmin create --fs-type fsfs /var/svn/repository
svn import /home/adam
<move or delete your home directory>
svn checkout file:///var/svn/repository /home/adam
And that's it. You need only one repository, and your home directory
itself is the "working copy" for svn's purposes. When you make a change,
you type:
svn add /home/adam/newfile.txt
svn checkin /home/adam -m "Created the file newfile.txt, which is new."
Now the repository is in sync with your "working copy", i.e. your home
directory, since there is a copy of "newfile.txt" in each place. If your
home directory is lost or damaged somehow, you can check out a new
"working copy" right into your home directory, and get back everything
that was there before. Also, if you move to a different machine, you can
check out a copy of your home directory to that machine too, and
magically have all of your files and preferences available to you.
The svn:externals feature is not required for a simple setup like this
one, but I can give you an example of how it works. In my repository, I
have three directories: trunk, tags, and branches. My home directory is
a checkout of a directory in branches (called mac_laptop, for obvious
reasons). Like so:
svn checkout http://<adam's repository
URL>/homedir/branches/mac_laptop /home/adam
That directory, mac_laptop, has a svn:externals property set which pulls
files from the /trunk folder of the repository. Specifically, it allows
me to have a common .bash_profile between all of the different machines
I work on:
svn propedit svn:externals
<in the editor window>
.bash_profile http://<adam's repository
URL>/homedir/trunk/.bash_profile
<and save and quit the editor>
That way, if I'm working on my home computer (linux_desk), I can have a
separate branch for it, with linux-specific binaries and such, but which
uses the same .bash_profile file.
Don't worry if this svn:externals part doesn't make much sense right
now; it took me about six months of daily usage until I started to see
where it would be useful and how I wanted to implement it. Try working
with the simple example I outlined earlier, and let us know how far that
gets you! :-)
- Adam Compton
More information about the vcs-home
mailing list