Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.naic.edu/~palfa/doc/svn_intro.txt
Дата изменения: Thu Apr 7 17:54:23 2005
Дата индексирования: Sun Apr 10 03:12:09 2016
Кодировка:

Поисковые слова: sojourner
Taken from email from Scott Ransom to PALFA Consortium
March 22, 2005

So over the past week, Arun and I have finally gotten the
subversion repository to work for the PALFA code and
documentation. The big benefits of setting it up the way that
we have (which is non-standard) are:

1) we use ssh to securely access the repository
2) we commit using our AO login names so that if we do
something wonderful or screw something up, we can easily track
down when it happened and who to praise or blame
3) we get all the benefits of subversion over CVS (with the big
advantages being that we can add/move/remove files and
directories)

The repository is currently located on fusion00 which can only
be seen from the AO network. If this is a big problem, perhaps
we can either move the repository to remote.naic.edu or request
that Arun open fusion00 up for ssh access from the outside.

To use the repository, you must be in the palfa group.
Currently, its members are:
cordes,sransom,dunc,desh,satorchi,camilo,nice,iudeneva,
wvlemmin,champion,ramach,istairs,dbacker,pfreire,jhessels

If you will be editing code and/or documentation, you should
request to become a part of this group from Arun. Please cc me
with any requests.

The repository is currently checked out in two different
locations: /home/palfa/subversion which should be visible from
any AO machine, and /home/alfa/subversion on aspmaster. Since
these two directories are effectively accessible by all of the
PALFA consortium, we have to jump through one small hoop in
order to correctly checkout/checkin code from/to the repository
from them. I'll discuss this at the bottom of the note.

In general, the version of the scripts and programs that we are
running for production use should be in these public
directories! We should add symbolic links in our ~/bin
directories pointing to the actual *.py files in the local
subversion repository. This way we will always be using the
most up-to-date versions, which should also be the _only_
versions (easily) available! (Note: It is, of course, possible
to check out earlier versions of the code if we need to revert
for some reason.)

For those of you who will be doing any significant development
of code that will require substantial testing before moving
into "production" use, I _stongly_ recommend checking out your
own version of the code into your AO home directory (or a
subdirectory named for you in /home/alfa on aspmaster). You
will be able to checkin/checkout code from that local version
just as if you were using the two main (but publicly available)
directories that I mentioned above.

----------------------------

Working with your own personal copy of the code can be
accomplished by the following:

1. Login to an Arecibo machine.

2. Checkout (i.e. co) the code:

svn co svn+ssh://USERNAME@fusion00.naic.edu/var/lib/palfa/subversion [DIRNAME]

Where USERNAME is your Arecibo login name (assuming that you
are in the palfa group), and the optional [DIRNAME] is what you
would like the top-level directory to be called. If it is not
specified, it will be called "subversion".

3. Now you should be able to enter that directory and run any
of the svn commands. You can get a list of them by doing "svn
help". You can also get help on specific svn commands by doing
"svn help command". I suggest playing around with some of them
(like info, log, diff, and status) before doing any major code
manipulation. All of the "normal" CVS commands like update,
checkout, and checkin all work, as well as "add", "move", and
"delete" which are very useful for dealing with files and
directories (unlike in CVS).

4. Before editing any files, always make sure that your local
repository is up-to-date (in order to avoid conflicts) by doing:

svn update

A very useful command to use anytime to see what has been
locally modified etc is

svn status

Each file will have a single character identifier next to it
that describes which state it is in (i.e. locally modified,
unknown file, deleted, to be added, in conflict, etc...) Type
"svn help status" for the codes or see:
http://svnbook.red-bean.com/en/1.1/ch03s05.html#svn-ch-3-sect-5.3.1

By doing 'svn status -u' it will actually access the database
to check if any files need updating or if a new conflict has
arisen since your last update. This is a very useful command...

5. Once you have edited code (and thoroughly tested it!) and
are ready to commit or check it in (i.e ci) to the repository
you simply do: "svn ci" from the top-level directory (which
will check-in _all_ of your changes) or

svn ci FILENAME1 FILENAME2 etc...

to check-in those specific files/directories.

You need to have an EDITOR environment variable set in order to
edit your note for the logs. On aspmaster I've set the default
editor to be "pico" which both vi and emacs users should be
able to easily figure out as the commands are listed at the
bottom of the screen. This is a very lightweight editor that
runs in the xterm and so can easily be called remotely.

** When writing your log entry, please use a couple or several
sentences to describe exactly what you changed and why! **

If you have any conflicts, you should *must* read about how to
resolve them in the Subversion manual:
http://svnbook.red-bean.com/en/1.1/ch03s05.html#svn-ch-3-sect-5.4

6. To add, move or remove files or directories, you need to
specify that command first _before_ committing. For example,
to add a new file called foo.py and remove another called
bar.py you would do:

svn add foo.py
svn remove bar.py
svn ci foo.py bar.py

7. You can look at old log entries using the 'svn log'
command, or compare revisions of a file using 'svn diff'. To
check-out earlier versions of a file you simply use
'svn co -r rev# FILENAME'.

For more info, there is a very detailed online book available
here:

http://svnbook.red-bean.com/en/1.1/

----------------------------

Work around for the "public" subversion directories:

If (and only if) you are editing the repositories in
/home/palfa/subversion _or_ on aspmaster in the
/home/alfa/subversion directory, you need to define the
following environment variable _before_ you use any command
that accesses the repository:

setenv SVN_SSH 'ssh -l USERNAME'

assuming you are using the 'C' shell. Use

export SVN_SSH='ssh -l USERNAME'

for a Bash-like shell. USERNAME should be your normal AO
username.

This is required since we have many people using the same local
repositories (i.e. /home/alfa/subversion on aspmaster) but we
want them to be able to check-in changes using their AO
usernames. Everything else is the same as described above.

I think that this will help our currently sporadic and
confusing development "process". But please use it wisely!
Subversion is powerful and as we all know, "with great power
comes great responsibility"! ;-)