diff -Nur --exclude=*.moc cervisia-0.5.0/README.CVS_EDIT_HACK cervisia-0.5.0-cvsedit/README.CVS_EDIT_HACK
--- cervisia-0.5.0/README.CVS_EDIT_HACK	Thu Jan  1 01:00:00 1970
+++ cervisia-0.5.0-cvsedit/README.CVS_EDIT_HACK	Wed Apr 19 21:31:21 2000
@@ -0,0 +1,48 @@
+This hack provides features required for working on "watched"
+projects. It was tested useing kde1 on linux only.
+
+
+Impact
+
+If a project is watched by people, it's necessary to run "cvs
+edit" before starting an edit session for two reasons: first, the
+notification sheme of CVS requires it to work properly, and
+second, the file permissions are readonly.
+
+
+Automagical CVS edit
+
+In case the config option "CVS edit automagically" is checked,
+cervisia checks file permissions before invoking the editor. In
+case of a readonly file, a "cvs edit <filename>" command is
+invoked before calling the editor. If "cvs edit" was successful,
+the file permissions grant read-write access now. If it failed, a
+messages will be printed on stdout.
+Since CVS sets the file permissions back to readonly after
+commiting the changes, a "cvs unedit" is not necessary, and will
+not be performed. To finish an edit session, you just need to
+commit.
+
+
+Installation
+
+Invoke "./configure" as usual. So far there is no "--enable-"
+style option for this hack. After that, you'll need to specify
+the use of this hack, otherwise the binary wouldn't include any
+modified code. To archive that, you'll need to define
+"CVS_EDIT_HACK", i.e. by running:
+make CPPFLAGS=-DCVS_EDIT_HACK
+instead of just runnig make.
+To activate the feature, you'll have to check the "CVS edit
+automagically" topic in the "Options" menu at run time.
+
+
+Feedback and Corrections
+
+Please don't bother Bernd Gehrmann with bug reports or complaints
+about this hack but send your comments to Steffen Dettmer
+<steffen@dett.de> if you feel a need.
+Keep in mind, that this is not an official Cervisia feature, at
+least so far. Additional, this beta code comes as-is without
+any warranties.
+
diff -Nur --exclude=*.moc cervisia-0.5.0/src/toplevel.cpp cervisia-0.5.0-cvsedit/src/toplevel.cpp
--- cervisia-0.5.0/src/toplevel.cpp	Mon Feb 21 20:31:27 2000
+++ cervisia-0.5.0-cvsedit/src/toplevel.cpp	Wed Apr 19 21:30:42 2000
@@ -13,6 +13,10 @@
  * You should have received a copy of the Artistic License with 
  * this Kit, in the file named "Artistic".  If not, I'll be glad
  * to provide one.
+ *
+ * Modified Apr 19 2000 by Steffen Dettmer <steffen@dett.de>
+ * All modifications are marked with CVS_EDIT_HACK
+ * See README.CVS_EDIT_HACK for details
  */
 
 
@@ -38,6 +42,16 @@
 #else
 #include <knewpanner.h>
 #endif
+#ifdef CVS_EDIT_HACK
+  #warning "compiling with CVS_EDIT_HACK"
+  /* for stat(2) */
+  #include <sys/stat.h>
+  #include <unistd.h>
+  #include <assert.h>
+#else
+  #warning "CVS_EDIT_HACK disabled"
+#endif
+
 #include <stdlib.h>
 #include <unistd.h>
 #include "logdlg.h"
@@ -283,7 +297,10 @@
     
     options_commitrecur = options->insertItem( i18n("&Commit recursively"),
                                                this, SLOT(slotCommitRecursive()) );
-
+#ifdef CVS_EDIT_HACK
+    options_autocvsedit = options->insertItem( i18n("CVS &edit automagically"),
+                                               this, SLOT(slotAutoCVSEdit()) );
+#endif
     options->insertSeparator();
     
     options_sett        = options->insertItem( i18n("&Settings..."),
@@ -453,13 +470,38 @@
                     command += filename;
                     command += "&";
                     system(command);
+  #ifdef CVS_EDIT_HACK
+				    if (opt_autoCVSEdit) {
+					    if (prepareEdit(filename)) {
+						    system(command);
+					    } else {
+						    printf("FATAL: CVS edit automagic FAILED!\n");
+					    }
+				    } else {
+					    system(command);
+				    }
+  #else
+				    system(command);
+  #endif
                 }
 #else
 	    QString command = config->readEntry("Editor", "gnuclient");
             command += " ";
 	    command += filename;
 	    command += "&";
+  #ifdef CVS_EDIT_HACK
+		if (opt_autoCVSEdit) {
+			if (prepareEdit(filename)) {
+		    	system(command);
+			} else {
+				printf("FATAL: CVS edit automagic FAILED!\n");
+			}
+		} else {
+	    	system(command);
+		}
+  #else
 	    system(command);
+  #endif
 #endif
 	}
 }
@@ -901,6 +943,13 @@
     options->setItemChecked(options_commitrecur, opt_commitRecursive);
 }
 
+#ifdef CVS_EDIT_HACK
+void TopLevel::slotAutoCVSEdit()
+{
+    opt_autoCVSEdit = !opt_autoCVSEdit;
+    options->setItemChecked(options_autocvsedit, opt_autoCVSEdit);
+}
+#endif
 
 void TopLevel::slotSettings()
 {
@@ -1087,6 +1136,11 @@
     opt_commitRecursive = config->readBoolEntry("Commit Recursive", false);
     options->setItemChecked(options_commitrecur, opt_commitRecursive);
 
+#ifdef CVS_EDIT_HACK
+    opt_autoCVSEdit = config->readBoolEntry("CVS Edit Automagically", false);
+    options->setItemChecked(options_autocvsedit, opt_autoCVSEdit);
+#endif
+
     int splitterpos1 = config->readNumEntry("Splitter Pos 1", 0);
     int splitterpos2 = config->readNumEntry("Splitter Pos 1", 0);
     if (splitterpos1)
@@ -1113,6 +1167,9 @@
     config->writeEntry("Prune Dirs", opt_pruneDirs);
     config->writeEntry("Update Recursive", opt_updateRecursive);
     config->writeEntry("Commit Recursive", opt_commitRecursive);
+#ifdef CVS_EDIT_HACK
+    config->writeEntry("CVS Edit Automagically", opt_autoCVSEdit);
+#endif
 #if QT_VERSION >= 200
     QValueList<int> sizes = splitter->sizes();
     config->writeEntry("Splitter Pos 1", sizes[0]);
@@ -1135,6 +1192,56 @@
     saveOptions(config, true);
 }
 
+#ifdef CVS_EDIT_HACK
+bool TopLevel::prepareEdit(const QString &filename)
+{
+	/* checks file, if readonly it will run cvs edit */
+	struct stat stat_buf;
+	int ret_code;
+
+	/* stat file, return on error */
+	ret_code = stat(filename,&stat_buf);
+	if (ret_code != 0) {
+	   printf("Error %d on file %s\n", ret_code, (const char*) filename);
+	   perror("stat(2)");
+	   return false;
+	}
+
+	/* check for write access */
+	if (stat_buf.st_mode & (S_IWUSR|S_IWGRP|S_IWOTH)) {
+	    return true;
+	} else {
+	    /* try to run "cvs edit" now, return on error */
+    	    QString command = "cvs edit ";
+	    command += filename;
+	    ret_code = system(command);
+		if (ret_code != 0) {
+			printf("Error %d calling %s,\n", ret_code,
+				(const char*) command);
+			perror("system(3)");
+			return false;
+		}
+
+		/* if "cvs edit" was successful, file should be writable now */
+		ret_code = stat(filename,&stat_buf);
+		if (ret_code != 0) {
+			printf("Error %d on file %s,\n", ret_code, 
+				(const char*) filename);
+			perror("stat(2)"); /* may be "success" ... */
+			return false;
+		}
+		if (stat_buf.st_mode & (S_IWUSR|S_IWGRP|S_IWOTH)) {
+			return true; /* feature success */
+		} else {
+			printf("File %s is NOT writeable after cvs edit\n", 
+				(const char*)filename);
+			return false; /* failed for some reason */
+		}
+	}
+	assert( ("line should'n be reached!",false) );
+}
+#endif
+ 
 
 // Local Variables:
 // c-basic-offset: 4
diff -Nur --exclude=*.moc cervisia-0.5.0/src/toplevel.h cervisia-0.5.0-cvsedit/src/toplevel.h
--- cervisia-0.5.0/src/toplevel.h	Mon Feb 21 20:29:11 2000
+++ cervisia-0.5.0-cvsedit/src/toplevel.h	Wed Apr 19 19:41:58 2000
@@ -13,6 +13,10 @@
  * You should have received a copy of the Artistic License with 
  * this Kit, in the file named "Artistic".  If not, I'll be glad
  * to provide one.
+ *
+ * Modified Apr 19 2000 by Steffen Dettmer <steffen@dett.de>
+ * All modifications are marked with CVS_EDIT_HACK
+ * See README.CVS_EDIT_HACK for details 
  */
 
 
@@ -94,6 +98,12 @@
     void slotPruneDirs();
     void slotUpdateRecursive();
     void slotCommitRecursive();
+#ifdef CVS_EDIT_HACK
+    void slotAutoCVSEdit();
+#else
+    /* Since moc(1) is not #ifdef aware, we need to supply a dummy */
+    void slotAutoCVSEdit() { };
+#endif
     void slotSettings();
     void slotConfigureKeys();
     void slotHelp();
@@ -110,6 +120,10 @@
     void importOrCheckout(CheckoutDialog::ActionType action);
     void showJobStart(QString command);
 
+#ifdef CVS_EDIT_HACK
+	bool prepareEdit(const QString &filename); /* runs cvs edit for r/o files */
+#endif
+ 
     KAccel *accel;
     QPopupMenu *file, *view, *options, *repo, *advanced, *help;
     UpdateView *update;
@@ -131,6 +145,9 @@
     int advanced_merge, advanced_addbin;
     int options_create, options_prune;
     int options_updaterecur, options_commitrecur;
+#ifdef CVS_EDIT_HACK
+	int options_autocvsedit;
+#endif
     int options_sett, options_keys;
     int help_help;
 
@@ -138,6 +155,9 @@
     QString changelogstr;
     bool opt_createDirs, opt_pruneDirs;
     bool opt_updateRecursive, opt_commitRecursive;
+#ifdef CVS_EDIT_HACK
+	bool opt_autoCVSEdit;
+#endif
 };
 
 #endif

