Subversion

From Digital Scholarship Group
Jump to navigation Jump to search

Using our Subversion repository

Checking out

svn co https://svn.brown.edu/svn/stg/wwp/website/trunk/[further filepath as needed] Directory/

Where Directory/ is the target directory on your local machine. E.g., to get a local temporary copy of the XML source files to the _Guide_, you might issue svn co https://svn.brown.edu/svn/stg/wwp/website/trunk/encoding/guide/xml/ /tmp/GuideSource/. If you want the new directory plopped into your current directory with the same name as it has in Subversion, leave Directory/ out.

Using Subversion for the WWP website hotsheet

To check out a whole series of revisions of a particular directory to /tmp/

cd /tmp/
for n in $(svn log URL | egrep '^r[0-9]' | awk '{ print $1 }' | perl -pe 's/^r//;' ); do
   echo "---------$n:";
   mkdir thing$n;
   svn co -r $n URL ./thing$n;
   done

where "thing" should probably be something a little more intelligent. :-)

Remote updating

If you have the svnrup.bash command installed on your local system, you can use it to perform an svn update on golf or papa without actually bothering to log in on the remote machine (i.e., golf or papa).

The svnrup.bash command is attached to this page. It only works with a machine that has its sister program, svn_update_via_URL.bash installed, which is currently only golf and papa. To install it onto a Mac OS X or GNU/Linux system:

  1. download it
  2. put it where you want it (typically /usr/local/bin/ or ~/bin/)
  3. make sure it is executable, e.g. chmod a+x /usr/local/bin/svnrup.bash
  4. OPTIONAL: in order to avoid needing to invoke it by its full path, make sure that the path to it is in your $PATH environment variable. Ask Syd if you want a hand with this.

To use it, navigate in your shell to the directory you want to update on golf or papa. You will often already be in that directory, having just issued a svn ci -m "msg" command.

Then issue svnrup.bash. Switches are: -g = update on golf, -p = update on papa, -h or -? = print commandline syntax. You can issue both golf and papa switches: -gp.

What it does

The svnrup.bash command looks up the URL of the Subversion repository that corresponds to your current working directory, and sends that off to the svn_update_via_URL.bash command on golf, papa, or both. (It will even send it to papa twice if you specify -p -p, which is silly.) Note that the "send" command is ssh, which will prompt you for your password on the remote machine. The way it knows which user name to use for you on the remote machine is pretty simple: svnrup.bash just looks at your local user name and looks up the remote user name from that. Nothing clever.

Anyway, svn_update_via_URL.bash then determines the target directory by looking at the URL it was passed. It is done in a way that is a little more complicated than a simple lookup, but the result is the same. I.e., it has to know where we keep our repositories on golf and papa. Right now it only knows about three of them ? thus you can start at any point within the following trees:

We can add more if we need to. We just need to remember to update the command on both golf and papa :-)

Once it knows the correct directory, svn_update_via_URL.bash goes to it and checks to see if there is a potential conflict. If there is a potential conflict, it issues an error message and quits. If not, it does the update and then changes the mode of all files in the directory to group-writable, recursively.

That's it!