How to: Keep your home directory in Subversion

From xoa
Jump to: navigation, search

Here's what I (Andy) do whenever I get a new login on a new machine: Check out my standard home directory from Subversion.

[alester@machine alester]$ svn co svn+ssh://andy@svn.petdance.com/svn/home ~
The authenticity of host 'svn.petdance.com (64.81.227.163)' can't be established.
RSA key fingerprint is b2:f9:39:2e:4c:7b:22:80:3c:f4:ce:5f:23:f5:75:7a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'svn.petdance.com,64.81.227.163' (RSA) to the list of known hosts.
andy@svn.petdance.com's password: 
andy@svn.petdance.com's password: 
andy@svn.petdance.com's password: 
A    /home/alester/.mail-aliases
svn: Failed to add file '/home/alester/.bashrc': object of the same name already exists

Typically I'll have a conflict with existing .bash* files, so remove 'em, and update.

[alester@machine alester]$ rm .bashrc 
[alester@machine alester]$ svn up
andy@svn.petdance.com's password: 
A    .bashrc
A    .minicpanrc
A    .perlcriticrc
A    .vimfunc
A    .admin
A    .admin/blog-spammers
A    bin
A    bin/st-deps
A    bin/pwdiff
... many bin/* files....
A    .vim
A    .vim/syntax
A    .vim/syntax/tt2.vim
A    .vim/syntax/tt2html.vim
A    .vim/syntax/hwd.vim
A    .vim/syntax/perl.vim
A    .vim/syntax/perltest.vim
A    .vim/syntax/svk.vim
A    .vim/syntax/wiki.vim
A    .vim/filetype.vim
svn: Failed to add file '.bash_profile': object of the same name already exists  

Ooops, another bash conflict. Update and pull down my lab directory, which is where I put scraps of stuff I play with for safekeeping.

[alester@machine alester]$ rm .bash_profile 
[alester@machine alester]$ svn up
andy@svn.petdance.com's password: 
A    .bash_profile
A    dead.txt
A    .bash_aliases
A    .muttrc
A    .vimrc
A    lab
A    lab/lsum
A    lab/dadsearch.html
A    lab/travesty
... lots of lab stuff ...
Updated to revision 328.
[alester@machine alester]$ 

Now log out, log in again, and everything is how I want it! It also means that I can change a file in one machine, commit it, and svn up elsewhere and get it automagically.

But how do I know if I've updated my home directory? I don't want to type svn update every time I log into a machine, but I also don't want to log into a machine with an ancient home directory and not realize that my scripts and startup files are out of date.

So I added the following to my .bash_profile, thanks to a comment on my LJ:

MAXDAYS=7
if [ "`find ~/.svn/entries -mtime +$MAXDAYS -print`" ] ; then
    printf "\n\n~/ hasn't been updated in over %d days.\n\n" $MAXDAYS
fi
Personal tools