[Babase] Revision control, copying babase to another box, working offline

Karl O. Pinc babase@www.eco.princeton.edu
Fri, 11 Feb 2005 07:27:48 +0000


Hi Y'all,

This message is mostly for Ann, who needs to be able
to work on the project with me in a way that minimizes
the possiblity that we'll step on each other's toes
and eliminiates the possiblity that we'll break
each other's stuff.  But given recent events
(Hunter says Duke's main file server's raid (disks) went
out) I've been spending some time thinking of how to
be able to easily switch development from one box to
another.

Here's the details:

No doubt this won't work as I haven't tried it
all exactly as typed.  (!)

Watchout for commands that end in \. When \ is the last
character on the line it means the line is continued
and you can ether cut and past exactly as is
or omit the \ and type the whole thing on one line.

Try these commands:

  echo hello \
       world
  cd /
  ls
  pwd
  echo ~/foo
  cd
  pwd
  ls


And even then that some arguments are too long to fit on
a single line in this email.
(Also, the URLs are long and need to be all one line.)

You might want to start with the glossary
so you can make sense of the documentation
links.
http://wiki.gnuarch.org/moin.cgi/Glossary


Make sure you've got arch 1.3:
(for this you must be on the net)

 aptitude update
 aptitude upgrade tla tla-doc

Setup to use arch
http://regexps.srparish.net/tutorial-tla/introducing-yourself.html#Introducing_Yourself_to_arch

  tla my-id hubbard.3@netzero.net


Make a place to put archives:

  mkdir ~/archives/


Mirror my archive (the master):
(For this you must be on the net.)
Mirroring will take 5 or 10 minutes as there's almost
400 changes recorded in the archive.
(I'm going to move my archive so you'll have to unregister
and then re-register it after I move it so the
mirroring will continue to work.)
http://wiki.gnuarch.org/moin.cgi/mini_5fMirroringArchives#head-f9f3344dbd05b971d3b1b899a01427c974779ec6

  tla register-archive kop@meme.com--2004-SOURCE \
      sftp://hubbard@albertslab.biology.duke.edu/home/kop/archives/ 
kop@meme.com--2004
  tla mirror-from kop@meme.com--2004-SOURCE \
      ~/archives/kop@meme.com--2004
  tla archive-mirror kop@meme.com--2004

Now, anytime you want to update your local mirror you re-run the
last command, the tla-mirror one, above.

Meanwhile, I think after I move my archive I'm going to stop
using it and start a new archive called
babase@bwf-master.princeton.edu--2005.   When I do that you'll
have to mirror it.


Create your own archive (for babase):
http://regexps.srparish.net/tutorial-tla/new-archive.html#Creating_a_New_Archive

  tla make-archive hubbard.3@netzero.net--2005-babase ~/archives/2005- 
babase
  tla my-default-archive hubbard.3@netzero.net--2005-babase
  tla archive-setup hubbard.3@netzero.net--2005-babase

If you want to you can create yourself another archive for
test.  Maybe to work through the tuitorial if you find
you have trouble.  You'll need to re-run your
my-default-archive command to switch between archives.
(Or use -A, IIRC.)


Now you make your own branch to make your own changes:
http://regexps.srparish.net/tutorial-tla/elementary-branches.html#Elementary_Branches_--_Maintaining_Private_Changes

  tla tag kop@meme.com--2004/babase--devel--2.0 \
      babase--ann-devel--2.0


Up to here we've been working strictly with archives,
except just now when we made a branch.
Time to work with the actual files (called trees.)
But it gets sticky.  First, the website in the
archive contains nothing, almost.  Second
I need to put the conversion code, the
web site, and the database code into different
"categories" (see glossary) in the
archive, that way you can get _just_
the web site and _just_ the web site
can be installed in the webserver's
document root.  So, where you see the
catagory name "babase" in this document
when it shows up in version names
like "babase--devel--2.0" in the
future you'll probably see "babase-db"
"babase-www" and "babase-conv" in version
names like "babase-www--devel--2.0".
Although "babase" will still exist too,
I think.
I'll do this when I switch to a new
archive.


To get a copy of the "live" tree:

We'll put it in ~/babase-live/

  tla get kop@meme.com--2004/babase--devel--2.0 \
      ~/babase-live


To get a copy of "your" branch:

You'll work in this directory.
We'll put it in ~/babase-ann/
  tla get /babase--ann-devel--2.0 ~/babase-ann


For now, we'll use links to put the website
on your webserver:

Your local copy of the live babase website is at
http://r2d2/babase-ann

  ln -s ~/babase-ann/www /var/www/html/babase-ann

Your local copy of your changes to the babase
website is at:
http://r2d2/babase-live

  ln -s ~/babase-live/www /var/www/html/babase-live








Now, you can work in ~/babase-ann/www/
(finallY):

  cd ~/babase-ann/www/


When you want to see what you've done
that's not in the archive:

   tla changes --diffs


When you make a new file, say foo.php,
you tell the archive about it:

   tla add foo.php

You do the same when you make a new directory.


When you want to save your changes in the
archive you do:

  tla commit -s 'summary of what I did' \
      -L 'long explaination'

The -L 'long explanation' is optional.
Or, another way to commit is:

  emacs $(tla make-log)
  tla commit

So you don't have to use -s and -L and type
long command lines.


To commit a file (foo.php) at a time instead of all
the changes at once:

  tla commit -s "Summary of quick fix" -- foo.php


To see a list of the names of your revisions:

  tla logs -s


To see what changes were made between 2 revisions:

  tla delta --diffs patch-2 patch-3

(Above the revision names are patch-2 and patch-3)


To undo changes done between 2 revisions:

  tla delta --diffs patch-2 patch-3 | patch -R


If you "oh my god I've made a bunch of changes
I don't want but have not committed" you can
just:

  cd
  rm -rf babase-ann
  tla get babase--ann-devel--2.0 babase-ann




To bring your tree (your files)
up to date with the master:

You can do this
any time you like without having to commit
back to the master and the more often you do
it the less likely there will be conflicts
that need resolving in merging your changes
with mine.  (Likewise the more often you
merge your changes back to the master
archive the fewer conflicts we will have.)

Make sure all your changes are commited to your archive:
(so you can undo when necessary)

  tla changes -diffs


Make sure you don't have any strange files about
or other odd stuff:

  tla tree-lint


You update your copy of the master archive
from the albertslab computer (must be online):

  tla archive-mirror kop@meme.com--2004


You update your copy of the master tree
(optional, only so you can look at it):

  cd ~/babase-live
  tla update


You merge your changes into your copy
of the master tree:

  cd ~/babase-ann
  tla star-merge kop@meme.com--2004/babase--devel--2.0

Then you fixup any complaints, and try again until
there are none.  Alternately, you don't fix the
complaints and just decide that one version
of where there's a problem is better than
the other, change your copy to be that way
and go from there.

See:
http://wiki.gnuarch.org/moin.cgi/Process_20_2a_2erej_20files

Complaints may have created some files
recording changes that caused problems, find them
with:

  tla tree-lint

And get rid of them so things are tidy.

Now you update your branch archive with all the changes
from the master:

  tla commit \
      -s 'Merge all changes made to the master site'

Now you are up to date with the master archive.



To merge your changes back into the master archive:

The trick here is to tell arch/tla which
archive is to be updated when you do a commit.

Make another copy of your tree (everything):
(We could muck about in your copy but this
is safer.)

  cd ~
  tla get /babase--ann-devel--2.0 babase-temp


Tell it we want to commit to the real
master archive:

  cd babase-temp
  tla set-tree-version \
      kop@meme.com--2004-SOURCE/babase--devel--2.0


Make a log record describing your changes:

  tla log-for-merge >> $(tla make-log)
  emacs $(tla make-log)

Really, this step is sorta optional, but not really
if you've been making lots of changes.  This step
is supposed to make a log file with a record of
all your changes.  You can add more description
when you edit the file.

Commit your changes to the master archive:
(must be on the net)

  tla commit

It may complain when you commit, because I've since made
changes.  See:
http://regexps.srparish.net/tutorial-tla/update-commit.html
In this case
you have to start over all the way from
updating your mirror of the master archive.
(There are shortcuts, but that's another story.)



Clean up.

  cd
  rm -rf babase-temp


The last step is to do some voodoo to update
the web site from the master archive, but that's
for when I figure out how to put the site into
a separate archive.  It'll be a "cd /var/www/html"
followed by a "tla update" most likely.

  ssh hubbard@albertslab.biology.duke.edu
  (do some voodoo)



One thing you can do is turn this document into
html as we'll be wanting a guide we can put
on the web site.  And then go ahead and
use this guide to get it on the web site.



Karl <kop@meme.com>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein