0

I am writing code inside of an svn repository but I really don't want to test run my code from within the repo. (I have a ../computations directory outside of the repo for this). Ideally, the computations directory would be a one-way symbolic link from the repo so that each edit to the source (inside the repo) will be immediately available to the ../computations directory.

The problem is that there is no such thing as a one-way symbolic link. An rsync shell script is about as close as I can get to a one-way mirror of the repo, but I am trying to minimize the chances of me forgetting to (or becoming tired of) 'updating' the ../computations directory.

What are my options here?

More details: I am working with C++ and Python code that spans more than one - but less than ten - directories, and editing in vim.

Tom Stephens
  • 475
  • 4
  • 15

1 Answers1

0

Alright, here goes:

We have an rsync script named snk in /usr/local/bin that looks like:

#! /bin/bash
# this script will rsync -a the ../repo directory
# with the ../computations directory on various architectures.  
# leave this script here (in the repo!) and create a symlink to it from someplace in your $PATH

# get this host
HOST=${HOSTNAME}

# define various hosts in order to dictate specific rsync commands
hostA="someHost"
hostB="someOtherHost"


if [ "$HOST" = "$hostA" ] 
then
    rsync -zvai --exclude=.svn /full/path/to/repo/on/hostA/ /full/path/to/computations

elif [ "$HOST" = "$hostB" ] 
then
rsync -zvai --exclude=.svn /full/path/to/repo/on/hostB/ /full/path/to/computations
fi

Then we went to the Google and found: this qeustion about 'vim: rsync on save' and gave it a shot. Take a look at this portion of my new .vimrc file:

:if system('pwd') =~ "/full/path/to/base/of/repo"
:  au BufWritePost * !snk
:endif   

This is a first-order approximation to a solution to my problem, I hope it helps!

Thank you vipraptor!

Community
  • 1
  • 1
Tom Stephens
  • 475
  • 4
  • 15