[Zope] Using CVS with Zope (basic)

Jean Jordaan jean@upfrontsystems.co.za
Sat, 15 Sep 2001 00:21:02 +0200


Hi all

In the hope that it might be useful to someone else, here is how we use
CVS and 'sitecopy' together with Zope.

First, some background: our first need is simply to get all the relevant
textual content in Zope onto the filesystem, so that multiple developers
can work on it there using their text-processing tools of choice. Then
of course we need to get the text back in.

To do this, you need a good tool to automate the process. The best way
I've found is Joe Orton's "sitecopy":http://www.lyra.org/sitecopy/

1. Configure 'sitecopy' to:

   - exclude all the Zope objects that don't have a filesystem
     representation (such as SQL methods, SkinScript, external methods,
     MailHosts, Catalogs and so on). *Note*: while it is logical that
     some of these (such as external methods) don't have filesystem
     representation, others (such as SQL methods) simply lack PUT
     factories.

   - use the WebDAV source port (FTP access is a bit fragile).

   Because a 'sitecopy' site definition is single-rooted (you can't get
   files from different trees in Zope at once) you should define your
   'sitecopy' sites for accessing your "App" directory (from the Zope
   root) and your ZClasses (in 'Control_Panel/Products/SomeName')
   seperately.

2. Use 'sitecopy' to pull down the site::

    sitecopy --fetch app app_zclasses
    sitecopy --sync app app_zclasses

   To prevent 'sitecopy' from uploading *everything* next time you
   update, tell it that the local site is up to date::

    sitecopy --catchup app app_zclasses

3. Import the site into CVS::

    export CVSROOT=/path/to/your/repository
    cd ~/WORKINGDIR/app
    cvs import -m "Importing app" zope/app app start
    cd ~/WORKINGDIR/app_zclasses
    cvs import -m "Importing app_zclasses" zope/app_zclasses app_zclasses
start

   Remove your working directory and check it out from CVS::

    cd ~
    rm -r WORKINGDIR
    cvs checkout zope/app
    cvs checkout zope/app_zclasses

4. Edit away::

    cd ~/zope/app
    gvim (edit away ..)

   Whenever you want to make your edits active in Zope, do::

    sitecopy --update app

   Once you are satisfied that something is working, check it into CVS.

5. Adding Zope objects.

   Since Zope creates DTML Documents for all textfiles uploaded, unless
   the file is uploaded to an existing object, adding needs to be done
   thru the ZMI. When you have created your object, fetch it via FTP and
   add it to CVS::

    ftp zopehost
    > cd dir
    > lcd dir
    > get newMethod
    > bye
    cvs add dir/newMethod

   (It would be really great if there were some way, for example via a
   header block such as the '##data' section at the start of a Python
   script, to describe new objects on the filesystem so that the right
   object is automatically created when they're uploaded.)

6. Don't make any important changes using the ZMI. From now on, the
   authoritative source is the copy on the filesystem. Any TTW changes
   will be overwritten (if it was checked out) or forgotten (if it
   wasn't checked out and added to CVS control). Use the ZMI for
   quick experimentation, as far as code changes are concerned.

Note: this method works fine on Linux, and on Windows if you use the
"Cygwin tools":http://www.cygwin.com . 'sitecopy' is easy to compile
under Cygwin.

I hope this helps someone!

Regards,
Jean