|
Size: 3477
Comment:
|
Size: 2269
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| SVN! aka, Subversion! | |
| Line 2: | Line 3: |
| Email from Jamie Rollins about populating an SVN archive, while preserving file time stamps: | The SVN repository is set up in /cvs/cds/caltech/svn. '''Do not''' try to modify it or put anything on the directory. It is the job of svn command. |
| Line 4: | Line 6: |
| ################################################## Recipe to populate empty SVN repository with files, preserving ctime stamps: |
An apache web server dedicated to handle svn queries is running on nodus. |
| Line 8: | Line 8: |
| 1. create an empty repository: | For more information about svn, please refer to the following web page. http://svnbook.red-bean.com/ |
| Line 10: | Line 11: |
| /path/to/repo $ svnadmin create foo | == Using SVN in the control room == You can access the svn repository from the control room computers by something like {{{svn co file:///cvs/cds/caltech/svn/trunk/}}}. However, it is strongly discouraged to do so unless you are absolutely sure about what you are doing. Use the method below even from the control room computers. |
| Line 12: | Line 14: |
| 2. add an "unrestricted" pre-revprop-change script to the repository hooks directory [0]: |
== Getting files from off-site == There are two methods. Use the first method whenever possible. |
| Line 15: | Line 17: |
| /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 |
Checking out trunk/chans directory |
| Line 24: | Line 19: |
| This allows the script to change the "Last Changed" times of the files to match the ctimes. |
{{{ svn co --username svn40m https://nodus.ligo.caltech.edu:30889/svn/trunk/chans}}} |
| Line 27: | Line 21: |
| 3. check out a working copy of the repository: | The password is written in the standard place. |
| Line 29: | Line 23: |
| /path/to/wc $ svn checkout file:///path/to/repo/foo | Alternative way: |
| Line 31: | Line 25: |
| 4. add the files to the working copy, preserving their ctime stamps: | {{{svn co svn+ssh://controls@nodus.ligo.caltech.edu/cvs/cds/caltech/svn/trunk/chans}}} |
| Line 33: | Line 27: |
| /path/to/wc $ cd foo /path/to/wc/foo $ cp -a /path/to/oldfiles/ . |
== A sample session == '''Task''': Making your own directory under trunk/docs/ and put a draft of your potentially Nobel prize winning paper. |
| Line 36: | Line 30: |
| 5. run the included script [1] in the working copy root: | (1) Make your own directory in the repository. |
| Line 38: | Line 32: |
| /path/to/wc/foo $ svn_ctime_checkin | {{{svn mkdir --username svn40m https://nodus.ligo.caltech.edu:30889/svn/trunk/docs/mydir}}} |
| Line 40: | Line 34: |
| 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. |
(2) Check out the directory you just created to your machine. |
| Line 44: | Line 36: |
| 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]: |
{{{svn co --username svn40m https://nodus.ligo.caltech.edu:30889/svn/trunk/docs/mydir}}} |
| Line 48: | Line 38: |
| ~ $ cat >> ~/.subversion/config use-commit-times = yes ~ $ |
(3) Move to the checked out directory. |
| Line 52: | Line 40: |
| This will tell the SVN client to set file ctimes to be the "Last Changed" time on checkout/update/etc. |
{{{cd mydir}}} |
| Line 55: | Line 42: |
| 7. Finally, checkout your working copy of the repository, and note that the original file ctimes are preserved. |
(4) Put your draft into the directory. |
| Line 58: | Line 44: |
| 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: |
{{{cp /somewhere/ProofOfEverything.tex . }}} |
| Line 62: | Line 46: |
| ~ $ rm /path/to/repo/foo/hooks/pre-revprop-change | (5) Put the file under the svn's control. |
| Line 64: | Line 48: |
| Here is the test that I ran that demonstrates that it works: | {{{svn add ProofOfEverything.tex}}} |
| Line 66: | Line 50: |
| 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$ |
(6) Check it in to the svn repository. {{{svn ci -m "The first draft"}}} You have to put your comment after {{{-m}}} (7) Update your working copy. {{{svn up}}} (8) Now delete the file from the repository because you realized it is totally bullshit. {{{svn delete ProofOfEverything.tex}}} {{{svn ci -m "Oops, I was wrong"}}} However, your crappy paper can still be retrieved from the repository by requesting an old version, because all the history is recorded in the svn world. |
SVN! aka, Subversion!
The SVN repository is set up in /cvs/cds/caltech/svn. Do not try to modify it or put anything on the directory. It is the job of svn command.
An apache web server dedicated to handle svn queries is running on nodus.
For more information about svn, please refer to the following web page. http://svnbook.red-bean.com/
Using SVN in the control room
You can access the svn repository from the control room computers by something like svn co file:///cvs/cds/caltech/svn/trunk/. However, it is strongly discouraged to do so unless you are absolutely sure about what you are doing. Use the method below even from the control room computers.
Getting files from off-site
There are two methods. Use the first method whenever possible.
Checking out trunk/chans directory
svn co --username svn40m https://nodus.ligo.caltech.edu:30889/svn/trunk/chans
The password is written in the standard place.
Alternative way:
svn co svn+ssh://controls@nodus.ligo.caltech.edu/cvs/cds/caltech/svn/trunk/chans
A sample session
Task: Making your own directory under trunk/docs/ and put a draft of your potentially Nobel prize winning paper.
(1) Make your own directory in the repository.
svn mkdir --username svn40m https://nodus.ligo.caltech.edu:30889/svn/trunk/docs/mydir
(2) Check out the directory you just created to your machine.
svn co --username svn40m https://nodus.ligo.caltech.edu:30889/svn/trunk/docs/mydir
(3) Move to the checked out directory.
cd mydir
(4) Put your draft into the directory.
cp /somewhere/ProofOfEverything.tex .
(5) Put the file under the svn's control.
svn add ProofOfEverything.tex
(6) Check it in to the svn repository.
svn ci -m "The first draft"
You have to put your comment after -m
(7) Update your working copy.
svn up
(8) Now delete the file from the repository because you realized it is totally bullshit.
svn delete ProofOfEverything.tex
svn ci -m "Oops, I was wrong"
However, your crappy paper can still be retrieved from the repository by requesting an old version, because all the history is recorded in the svn world.
