2. About MacCVS Client
2.1 Introduction
The first port on Macintosh was made by Mike Ladwig using CodeWarrior 9, GUSI 1.7.2 and cvs 1.84. It allowed to use MacCVS as a console program or as a MacPerl command.
A second port was made by Matthias Neeracher. He implemented cvs as a MPW tool and used the cvs 1.9 distribution, dmake and CodeWarrior 9. This version works nicely but was never included into the official release of cvs.
Both use the excellent Matthias Neeracher's GUSI Library (for Grand Unified Sockets Library) which allows to port easily Unix code on Macintosh.
Despite of this ports, the cvs implementation for Macintosh is still experimental and only the client side is avalaible.
This current port uses CodeWarrior Pro 2, the MSL library, cvs 1.9, GUSI 1.8.3 and optionnaly the KClient library (Kerberos authentication, a contribution of Miro Jurisic)
2.2 What is inside
This is my second tentative to port CVS for Macintosh.
The first time I used the port of Mike Ladwig and added a little UI to remember the CVSROOT and provide menu access.
Now using the Matthias Neeracher port, I've added again a little UI and also enhanced or added some capabilities to the MacCVS client to :
- deal with Macintosh files with a resource fork (using a HQX encoding).
- be scriptable by Apple Events.
- allow to import initial modules directly from the macintosh (see the problems relative to the import command).
- use Internet Config to restore Mac signatures.
- provide a work around for files which auto-modify each time you open it (such as CW Pro 2 projects) : this behaviour is not compatible with CVS which checks for the modification date on your disk. We refer to this kind of files as dirty files.
- rewrite the architecture of MacCVS so it uses cvs as a shared library (this has several advantages I discuss in Hacking CVS).
For more informations, look at the Hacking CVS section.
2.3 Binary and Text files
For the macintosh cvs client :
- a binary file is a file with a signature different of "TEXT" (for example a Word document .doc).
- a mac binary file is a file with a signature different of "TEXT" and a resource fork (for example a ResEdit file and most of the mac files).
- a text file is a file with a signature of "TEXT".
Important : You can force a binary file to be handled as plain binary : that's because sometimes you can accidentaly have a resource fork (like a CKID resource) onto a plain binary file (for example on a CW project). If you want to add files types to be handled as plain binary, open the application resource (using ResEdit or Resorcerer) and edit the bin# resource (a TMPL resource located in the application resource should help you to do that easily).
Note : The resource fork on a text file is ignored.
2.4 The "import" problem
The import command in cvs should be seen as inconsistent since it imports initially all the files as text files (so it makes a line feed conversion between the client and the server).
When the initial import is done and all the binary files have the binary attribute, the server and the client agree to not convert this files and everything is working finely.
So the problem appears ONLY during the first import, and cvs user know that the initial import is THE main difficulty with cvs.
Happyfully, there are some turn-arounds :
- Make the initial import directly from the cvs server machine (for now on Unix or Windows platforms). But be careful with the line feeds automatic translation when you copy files from and to !
- Use the cvs wrappers file to mark extensions as binary. But you'll still not be able to import from the client since all the files are initially transfered as text to the server.
That's why the MacCVS port was implemented for :
- Using the advanced command import pre-stats of the MacCVS client, you'll be able to list all the extensions of a folder and to avoid basic errors (like adding a file with a slash) and check which extensions belong to which format.
- Then you will use the cvswrapper administration file on the server to tell which extensions belong to binary files. For example, let say .rsrc belongs to a binary file : the cvswrapper should include the line *.rsrc -k 'b'.
- Finally you can import safely. Both the client and the server will know exactly which files are binary and which one are text. The client knows it by looking at the signature of the file (see the Binary and Text files section). So it will not try to translate line-feeds during the first import on a binary file.
2.5 Getting started
- Be sure to be familiar with the import problem.
- While you use CVS, make sure your "cvswrapper" administration file is always up to date because MacCVS client ignore the -kb option and trust the signature of the file.
- Set in the preferences the CVSROOT and the kind of authentication.
- If you create a new module using the import command, use first the "Pre-import stats" command to detect automatically bad files.
- Use the online-help avalaible on most of the menu entries or dialogs by activating "Show ballons" in the help menu.
2.6 Summary of MacCVS menu commands
- Checkout module... : refer to cvs checkout documentation
- Import module... : refer to cvs import documentation
- Preferences... : the location to set your CVSROOT and several other options
- Command line... : enter here a command line (like "cvs admin -kb toto.c"). Refer to the cvs documentation. Note : You can use quote the refer to a file with a space (ex: cvs status " appruntime.mcp")
- Cancel changes... : pick a file, MacCVS move the file to the trash and ask to update a fresher version for this file.
- Pre-import stats... : look recursively into a folder a detect automatically potential problems (bad file names, aliases...). This command should always be used before importing a module.
- All the other commands refer to the cvs "command" documentation.
2.7 Hacking CVS
The port consists in :
- A shared library with a MixedMode interface which contains the cvs code and mimic the cvs command line. This architecture allow to re-initialize the globals of CVS as well to separate really the implementation of the client and cvs.
- An application which implements a UI, Apple Events, a console and call the shared library to make the stuff.
What I've done after is to change a little bit client.c to oblige the client to convert the file whenever it sends it to the server. This allows to encode/decode the files in HQX format and also the disable/enable the line feed conversion when the file is flat (no resource fork) and is not a text file.
![[ Valid XHTML 1.0! ]](/branding/w3c-valid-xhtml10-44x16.png)
![[ Valid CSS! ]](/branding/w3c-valid-css-44x16.png)
