Differences between revisions 2 and 5 (spanning 3 versions)
Revision 2 as of 2008-03-05 02:07:03
Size: 3733
Editor: RobertWard
Comment:
Revision 5 as of 2008-07-06 23:23:04
Size: 331
Editor: TobinFricke
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Email from Jamie Rollins about populating an SVN archive, while preserving file time stamps: SVN!
Line 3: Line 3:
{{{
 
##################################################
Recipe to populate empty SVN repository with files, preserving ctime
stamps:
We are in the process of installing the 40m directory tree into SVN version control.
Line 9: Line 5:
1. create an empty repository: == Using SVN in the control room ==
Line 11: Line 7:
/path/to/repo $ svnadmin create foo Yoichi will write something here.
Line 13: Line 9:
2. add an "unrestricted" pre-revprop-change script to the repository
hooks directory [0]:
== Getting files from off-site ==
Line 16: Line 11:
/path/to/repo $ cat > foo/hooks/pre-revprop-change
#!/bin/sh
REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"
/path/to/repo $ chmod 755 foo/hooks/pre-revprop-change
You can do something like this:
Line 25: Line 13:
This allows the script to change the "Last Changed" times of the files
to match the ctimes.

3. check out a working copy of the repository:

/path/to/wc $ svn checkout file:///path/to/repo/foo

4. add the files to the working copy, preserving their ctime stamps:

/path/to/wc $ cd foo
/path/to/wc/foo $ cp -a /path/to/oldfiles/ .

5. run the included script [1] in the working copy root:

/path/to/wc/foo $ svn_ctime_checkin

This will add all the files in the working copy to the repository, and
change the SVN "Last Changed" timestamp for every file and directory
to be that of the filesystem ctimes.

6. On every system where you want to checkout a working copy of the
repository, uncomment or add the following line to the SVN client-side
config file [2]:

~ $ cat >> ~/.subversion/config
use-commit-times = yes
~ $

This will tell the SVN client to set file ctimes to be the "Last
Changed" time on checkout/update/etc.

7. Finally, checkout your working copy of the repository, and note
that the original file ctimes are preserved.

A. You might now want to go back and remove the unrestricted
pre-revprop-change script, so that users can't change file properties
in the future:

~ $ rm /path/to/repo/foo/hooks/pre-revprop-change

Here is the test that I ran that demonstrates that it works:

servo:/tmp/cdtemp.sf7635 0$ ls
svn_ctime_checkin
servo:/tmp/cdtemp.sf7635 0$ svnadmin create foo
servo:/tmp/cdtemp.sf7635 0$ cat > foo/hooks/pre-revprop-change
#!/bin/sh
REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"
servo:/tmp/cdtemp.sf7635 0$ chmod 755 foo/hooks/pre-revprop-change
servo:/tmp/cdtemp.sf7635 0$ svn checkout file:///tmp/cdtemp.sf7635/foo bar
Checked out revision 0.
servo:/tmp/cdtemp.sf7635 0$ cd bar
servo:/tmp/cdtemp.sf7635/bar 0$ cp -a ~/matlab/bin/chaos.m .
servo:/tmp/cdtemp.sf7635/bar 0$ ls -l
total 4
-rw-r--r-- 1 jrollins jrollins 248 2005-09-10 16:58 chaos.m
servo:/tmp/cdtemp.sf7635 0$ date +"%Y-%m-%d"
2008-02-12
servo:/tmp/cdtemp.sf7635/bar 0$ ../svn_ctime_checkin
svn propset svn:date 2005-09-10T20:58:09.000000Z --revprop -r HEAD
property 'svn:date' set on repository revision 0
A chaos.m
Adding chaos.m
Transmitting file data .
Committed revision 1.
property 'svn:date' set on repository revision 1
ready
servo:/tmp/cdtemp.sf7635/bar 0$ ls -l
total 4
-rw-r--r-- 1 jrollins jrollins 248 2005-09-10 16:58 chaos.m
servo:/tmp/cdtemp.sf7635/bar 0$ cd ..
servo:/tmp/cdtemp.sf7635 0$ grep use-commit-times ~/.subversion/config
### Set use-commit-times to make checkout/update/switch/revert
use-commit-times = yes
servo:/tmp/cdtemp.sf7635 0$ svn checkout file:///tmp/cdtemp.sf7635/foo qux
A qux/chaos.m
Checked out revision 1.
servo:/tmp/cdtemp.sf7635 0$ ls -l qux/
total 4
-rw-r--r-- 1 jrollins jrollins 248 2005-09-10 16:58 chaos.m
servo:/tmp/cdtemp.sf7635 0$

[0] http://svnbook.red-bean.com/en/1.4/svn.ref.reposhooks.pre-revprop-change.html
[1] http://svn.haxx.se/users/archive-2006-10/1345.shtml
[2] http://svnbook.red-bean.com/en/1.4/svn.advanced.confarea.html#svn.advanced.confarea.opts.config

}}}
{{{svn co svn+ssh://controls@nodus.ligo.caltech.edu/cvs/cds/caltech/svn/trunk/medm}}}

SVN!

We are in the process of installing the 40m directory tree into SVN version control.

Using SVN in the control room

Yoichi will write something here.

Getting files from off-site

You can do something like this:

svn co svn+ssh://controls@nodus.ligo.caltech.edu/cvs/cds/caltech/svn/trunk/medm

How_To/Use_the_SVN_archive (last edited 2017-11-18 05:16:31 by GabrielevajenteATligoDOTorg)