[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Cvs-cvs] ccvs/src cvs.h filesubr.h vers_ts.h add.c check... [signed-com
From: |
Derek Robert Price |
Subject: |
[Cvs-cvs] ccvs/src cvs.h filesubr.h vers_ts.h add.c check... [signed-commits3] |
Date: |
Tue, 10 Jan 2006 18:42:39 +0000 |
CVSROOT: /cvsroot/cvs
Module name: ccvs
Branch: signed-commits3
Changes by: Derek Robert Price <address@hidden> 06/01/10 18:42:39
Modified files:
src : cvs.h filesubr.h vers_ts.h add.c checkin.c
checkout.c classify.c commit.c diff.c ignore.c
import.c log.c ls.c no_diff.c recurse.c
remove.c server.c status.c subr.c update.c
watch.c wrapper.c
Added files:
src : no_diff.h wrapper.h
Log message:
* no_diff.h, wrapper.h: New files with decls from...
* cvs.h: ...here. Some decls moved to...
* filesubr.h, vers_ts.h: ...here.
* add.c, checkin.c, checkout.c, classify.c, commit.c, diff.c,
ignore.c, import.c, log.c, ls.c, no_diff.c, recurse.c, remove.c,
server.c, status.c, subr.c, update.c, watch.c, wrapper.c: Use stricter
include formatting.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/no_diff.h?only_with_tag=signed-commits3&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/wrapper.h?only_with_tag=signed-commits3&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/cvs.h.diff?only_with_tag=signed-commits3&tr1=1.345.4.3&tr2=1.345.4.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/filesubr.h.diff?only_with_tag=signed-commits3&tr1=1.1.6.1&tr2=1.1.6.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/vers_ts.h.diff?only_with_tag=signed-commits3&tr1=1.1.4.1&tr2=1.1.4.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/add.c.diff?only_with_tag=signed-commits3&tr1=1.121.6.3&tr2=1.121.6.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/checkin.c.diff?only_with_tag=signed-commits3&tr1=1.56.2.3&tr2=1.56.2.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/checkout.c.diff?only_with_tag=signed-commits3&tr1=1.145.2.2&tr2=1.145.2.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/classify.c.diff?only_with_tag=signed-commits3&tr1=1.37.6.3&tr2=1.37.6.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/commit.c.diff?only_with_tag=signed-commits3&tr1=1.257.2.3&tr2=1.257.2.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/diff.c.diff?only_with_tag=signed-commits3&tr1=1.116.6.3&tr2=1.116.6.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/ignore.c.diff?only_with_tag=signed-commits3&tr1=1.56.6.2&tr2=1.56.6.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/import.c.diff?only_with_tag=signed-commits3&tr1=1.175.6.3&tr2=1.175.6.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/log.c.diff?only_with_tag=signed-commits3&tr1=1.103.6.3&tr2=1.103.6.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/ls.c.diff?only_with_tag=signed-commits3&tr1=1.18.8.2&tr2=1.18.8.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/no_diff.c.diff?only_with_tag=signed-commits3&tr1=1.38&tr2=1.38.8.1&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/recurse.c.diff?only_with_tag=signed-commits3&tr1=1.114.6.2&tr2=1.114.6.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/remove.c.diff?only_with_tag=signed-commits3&tr1=1.63.6.2&tr2=1.63.6.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/server.c.diff?only_with_tag=signed-commits3&tr1=1.453.2.4&tr2=1.453.2.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/status.c.diff?only_with_tag=signed-commits3&tr1=1.68.6.2&tr2=1.68.6.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/subr.c.diff?only_with_tag=signed-commits3&tr1=1.148.6.3&tr2=1.148.6.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/update.c.diff?only_with_tag=signed-commits3&tr1=1.259.2.3&tr2=1.259.2.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/watch.c.diff?only_with_tag=signed-commits3&tr1=1.45.6.2&tr2=1.45.6.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/cvs/ccvs/src/wrapper.c.diff?only_with_tag=signed-commits3&tr1=1.47&tr2=1.47.6.1&r1=text&r2=text
Patches:
Index: ccvs/src/add.c
diff -u ccvs/src/add.c:1.121.6.3 ccvs/src/add.c:1.121.6.4
--- ccvs/src/add.c:1.121.6.3 Fri Jan 6 20:37:13 2006
+++ ccvs/src/add.c Tue Jan 10 18:42:38 2006
@@ -43,6 +43,7 @@
#include "fileattr.h"
#include "ignore.h"
#include "logmsg.h"
+#include "wrapper.h"
#include "cvs.h"
Index: ccvs/src/checkin.c
diff -u ccvs/src/checkin.c:1.56.2.3 ccvs/src/checkin.c:1.56.2.4
--- ccvs/src/checkin.c:1.56.2.3 Fri Jan 6 20:37:13 2006
+++ ccvs/src/checkin.c Tue Jan 10 18:42:38 2006
@@ -27,9 +27,10 @@
/* CVS */
#include "base.h"
#include "edit.h"
+#include "fileattr.h"
+#include "wrapper.h"
#include "cvs.h"
-#include "fileattr.h"
Index: ccvs/src/checkout.c
diff -u ccvs/src/checkout.c:1.145.2.2 ccvs/src/checkout.c:1.145.2.3
--- ccvs/src/checkout.c:1.145.2.2 Fri Jan 6 20:37:13 2006
+++ ccvs/src/checkout.c Tue Jan 10 18:42:38 2006
@@ -45,6 +45,7 @@
/* CVS headers. */
#include "ignore.h"
#include "recurse.h"
+#include "wrapper.h"
#include "cvs.h"
Index: ccvs/src/classify.c
diff -u ccvs/src/classify.c:1.37.6.3 ccvs/src/classify.c:1.37.6.4
--- ccvs/src/classify.c:1.37.6.3 Fri Jan 6 20:37:13 2006
+++ ccvs/src/classify.c Tue Jan 10 18:42:38 2006
@@ -20,6 +20,8 @@
#include "classify.h"
/* CVS Headers. */
+#include "no_diff.h"
+
#include "cvs.h"
static void sticky_ck (struct file_info *finfo, int aflag,
Index: ccvs/src/commit.c
diff -u ccvs/src/commit.c:1.257.2.3 ccvs/src/commit.c:1.257.2.4
--- ccvs/src/commit.c:1.257.2.3 Fri Jan 6 20:37:13 2006
+++ ccvs/src/commit.c Tue Jan 10 18:42:38 2006
@@ -28,13 +28,13 @@
/* CVS headers. */
#include "edit.h"
+#include "fileattr.h"
#include "ignore.h"
#include "logmsg.h"
#include "recurse.h"
-#include "sign.h"
+#include "wrapper.h"
#include "cvs.h"
-#include "fileattr.h"
#include "hardlink.h"
static Dtype check_direntproc (void *callerdat, const char *dir,
Index: ccvs/src/cvs.h
diff -u ccvs/src/cvs.h:1.345.4.3 ccvs/src/cvs.h:1.345.4.4
--- ccvs/src/cvs.h:1.345.4.3 Fri Jan 6 20:37:13 2006
+++ ccvs/src/cvs.h Tue Jan 10 18:42:38 2006
@@ -426,7 +426,6 @@
char *entries_time (time_t unixtime);
time_t unix_time_stamp (const char *file);
-char *time_stamp (const char *file);
typedef int (*CALLPROC) (const char *repository, const char *value,
void *closure);
@@ -448,7 +447,6 @@
* resurrected file done and print the fact otherwise.
*/
void write_letter (struct file_info *finfo, int letter);
-int xcmp (const char *file1, const char *file2);
void *valloc (size_t bytes);
int Create_Admin (const char *dir, const char *update_dir,
@@ -542,55 +540,17 @@
pid_t waitpid (pid_t, int *, int);
-/*
- * a struct vers_ts contains all the information about a file including the
- * user and rcs file names, and the version checked out and the head.
- *
- * this is usually obtained from a call to Version_TS which takes a
- * tag argument for the RCS file if desired
- */
-
#include "vers_ts.h"
-Vers_TS *Version_TS (struct file_info *finfo, char *options, char *tag,
- char *date, int force_tag_match,
- int set_time);
-void freevers_ts (Vers_TS ** versp);
-
/* Miscellaneous CVS infrastructure which layers on top of the recursion
processor (for example, needs struct file_info). */
int Checkin (int type, struct file_info *finfo, char *rev,
char *tag, char *options, char *message);
-int No_Difference (struct file_info *finfo, Vers_TS *vers);
/* TODO: can the finfo argument to special_file_mismatch be changed? -twp */
int special_file_mismatch (struct file_info *finfo,
char *rev1, char *rev2);
-/* Wrappers. */
-
-typedef enum { WRAP_MERGE, WRAP_COPY } WrapMergeMethod;
-typedef enum {
- /* -t and -f wrapper options. Treating directories as single files. */
- WRAP_TOCVS,
- WRAP_FROMCVS,
- /* -k wrapper option. Default keyword expansion options. */
- WRAP_RCSOPTION
-} WrapMergeHas;
-
-void wrap_setup (void);
-int wrap_name_has (const char *name,WrapMergeHas has);
-char *wrap_rcsoption (const char *fileName, int asFlag);
-char *wrap_tocvs_process_file (const char *fileName);
-int wrap_merge_is_copy (const char *fileName);
-void wrap_fromcvs_process_file (const char *fileName);
-void wrap_add_file (const char *file,int temp);
-void wrap_add (char *line,int temp);
-void wrap_send (void);
-#if defined(SERVER_SUPPORT) || defined(CLIENT_SUPPORT)
-void wrap_unparse_rcs_options (char **, int);
-#endif /* SERVER_SUPPORT || CLIENT_SUPPORT */
-
/* Pathname expansion */
char *expand_path (const char *name, const char *cvsroot, bool formatsafe,
const char *file, int line);
Index: ccvs/src/diff.c
diff -u ccvs/src/diff.c:1.116.6.3 ccvs/src/diff.c:1.116.6.4
--- ccvs/src/diff.c:1.116.6.3 Fri Jan 6 20:37:13 2006
+++ ccvs/src/diff.c Tue Jan 10 18:42:38 2006
@@ -26,6 +26,7 @@
/* CVS headers. */
#include "ignore.h"
#include "recurse.h"
+#include "wrapper.h"
#include "cvs.h"
Index: ccvs/src/filesubr.h
diff -u ccvs/src/filesubr.h:1.1.6.1 ccvs/src/filesubr.h:1.1.6.2
--- ccvs/src/filesubr.h:1.1.6.1 Wed Dec 21 13:25:10 2005
+++ ccvs/src/filesubr.h Tue Jan 10 18:42:38 2006
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 The Free Software Foundation, Inc.
+ * Copyright (C) 2006 The Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,5 +43,6 @@
void force_copy_file (const char *from, const char *to);
void xchmod (const char *fname, bool writable);
void force_xchmod (const char *fname, bool writable);
+int xcmp (const char *file1, const char *file2);
#endif /* FILESUBR_H */
Index: ccvs/src/ignore.c
diff -u ccvs/src/ignore.c:1.56.6.2 ccvs/src/ignore.c:1.56.6.3
--- ccvs/src/ignore.c:1.56.6.2 Fri Jan 6 20:37:13 2006
+++ ccvs/src/ignore.c Tue Jan 10 18:42:38 2006
@@ -28,6 +28,8 @@
#include "lstat.h"
/* CVS headers. */
+#include "wrapper.h"
+
#include "cvs.h"
Index: ccvs/src/import.c
diff -u ccvs/src/import.c:1.175.6.3 ccvs/src/import.c:1.175.6.4
--- ccvs/src/import.c:1.175.6.3 Fri Jan 6 20:37:13 2006
+++ ccvs/src/import.c Tue Jan 10 18:42:38 2006
@@ -32,6 +32,7 @@
/* CVS headers. */
#include "ignore.h"
#include "logmsg.h"
+#include "wrapper.h"
#include "cvs.h"
Index: ccvs/src/log.c
diff -u ccvs/src/log.c:1.103.6.3 ccvs/src/log.c:1.103.6.4
--- ccvs/src/log.c:1.103.6.3 Fri Jan 6 20:37:13 2006
+++ ccvs/src/log.c Tue Jan 10 18:42:38 2006
@@ -31,6 +31,7 @@
#include "gpg.h"
#include "ignore.h"
#include "recurse.h"
+#include "wrapper.h"
#include "cvs.h"
Index: ccvs/src/ls.c
diff -u ccvs/src/ls.c:1.18.8.2 ccvs/src/ls.c:1.18.8.3
--- ccvs/src/ls.c:1.18.8.2 Fri Jan 6 20:37:13 2006
+++ ccvs/src/ls.c Tue Jan 10 18:42:38 2006
@@ -21,6 +21,7 @@
/* CVS headers. */
#include "ignore.h"
#include "recurse.h"
+#include "wrapper.h"
#include "cvs.h"
Index: ccvs/src/no_diff.c
diff -u /dev/null ccvs/src/no_diff.c:1.38.8.1
--- /dev/null Tue Jan 10 18:42:39 2006
+++ ccvs/src/no_diff.c Tue Jan 10 18:42:38 2006
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 1986-2006 The Free Software Foundation, Inc.
+ *
+ * Portions Copyright (C) 1998-2005 Derek Price, Ximbiot <http://ximbiot.com>,
+ * and others.
+ *
+ * Portions Copyright (C) 1992, Brian Berliner and Jeff Polk
+ * Portions Copyright (C) 1989-1992, Brian Berliner
+ *
+ * You may distribute under the terms of the GNU General Public License as
+ * specified in the README file that comes with the CVS source distribution.
+ *
+ * No Difference
+ *
+ * The user file looks modified judging from its time stamp; however it needn't
+ * be. No_Difference() finds out whether it is or not. If it is not, it
+ * updates the administration.
+ *
+ * returns 0 if no differences are found and non-zero otherwise
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Verify interface. */
+#include "no_diff.h"
+
+/* ANSI C headers. */
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* GNULIB headers. */
+#include "error.h"
+#include "xalloc.h"
+
+/* CVS headers. */
+#include "rcs.h"
+#include "server.h"
+#include "system.h"
+#include "vers_ts.h"
+#include "wrapper.h"
+
+
+
+int
+No_Difference (struct file_info *finfo, Vers_TS *vers)
+{
+ Node *p;
+ int ret;
+ char *ts, *options;
+ int retcode = 0;
+ char *tocvsPath;
+
+ /* If ts_user is "Is-modified", we can only conclude the files are
+ different (since we don't have the file's contents). */
+ if (vers->ts_user != NULL
+ && strcmp (vers->ts_user, "Is-modified") == 0)
+ return -1;
+
+ if (!vers->srcfile || !vers->srcfile->path)
+ return (-1); /* different since we couldn't tell */
+
+#ifdef PRESERVE_PERMISSIONS_SUPPORT
+ /* If special files are in use, then any mismatch of file metadata
+ information also means that the files should be considered different. */
+ if (preserve_perms && special_file_mismatch (finfo, vers->vn_user, NULL))
+ return 1;
+#endif
+
+ if (vers->entdata && vers->entdata->options)
+ options = xstrdup (vers->entdata->options);
+ else
+ options = xstrdup ("");
+
+ tocvsPath = wrap_tocvs_process_file (finfo->file);
+ retcode = RCS_cmp_file (vers->srcfile, vers->vn_user, NULL, NULL, options,
+ tocvsPath == NULL ? finfo->file : tocvsPath);
+ if (retcode == 0)
+ {
+ /* no difference was found, so fix the entries file */
+ ts = time_stamp (finfo->file);
+ Register (finfo->entries, finfo->file,
+ vers->vn_user ? vers->vn_user : vers->vn_rcs, ts,
+ options, vers->tag, vers->date, NULL);
+#ifdef SERVER_SUPPORT
+ if (server_active)
+ {
+ /* We need to update the entries line on the client side. */
+ server_update_entries (finfo->file, finfo->update_dir,
+ finfo->repository, SERVER_UPDATED);
+ }
+#endif
+ free (ts);
+
+ /* update the entdata pointer in the vers_ts structure */
+ p = findnode (finfo->entries, finfo->file);
+ assert (p);
+ vers->entdata = p->data;
+
+ ret = 0;
+ }
+ else
+ ret = 1; /* files were really different */
+
+ if (tocvsPath)
+ {
+ /* Need to call unlink myself because the noexec variable
+ * has been set to 1. */
+ TRACE (TRACE_FUNCTION, "unlink (%s)", tocvsPath);
+ if (CVS_UNLINK (tocvsPath) < 0)
+ error (0, errno, "could not remove %s", tocvsPath);
+ }
+
+ free (options);
+ return ret;
+}
Index: ccvs/src/no_diff.h
diff -u /dev/null ccvs/src/no_diff.h:1.1.2.1
--- /dev/null Tue Jan 10 18:42:39 2006
+++ ccvs/src/no_diff.h Tue Jan 10 18:42:38 2006
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2006 The Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NO_DIFF_H
+#define NO_DIFF_H
+
+#include <stdbool.h>
+#include <stddef.h>
+
+#include "rcs.h"
+#include "vers_ts.h"
+
+int No_Difference (struct file_info *finfo, Vers_TS *vers);
+
+#endif /* NO_DIFF_H */
Index: ccvs/src/recurse.c
diff -u ccvs/src/recurse.c:1.114.6.2 ccvs/src/recurse.c:1.114.6.3
--- ccvs/src/recurse.c:1.114.6.2 Fri Jan 6 20:37:13 2006
+++ ccvs/src/recurse.c Tue Jan 10 18:42:38 2006
@@ -25,9 +25,11 @@
#include "save-cwd.h"
/* CVS headers. */
-#include "cvs.h"
-#include "fileattr.h"
#include "edit.h"
+#include "fileattr.h"
+#include "wrapper.h"
+
+#include "cvs.h"
Index: ccvs/src/remove.c
diff -u ccvs/src/remove.c:1.63.6.2 ccvs/src/remove.c:1.63.6.3
--- ccvs/src/remove.c:1.63.6.2 Fri Jan 6 20:37:13 2006
+++ ccvs/src/remove.c Tue Jan 10 18:42:38 2006
@@ -27,6 +27,7 @@
/* CVS headers. */
#include "ignore.h"
#include "recurse.h"
+#include "wrapper.h"
#include "cvs.h"
Index: ccvs/src/server.c
diff -u ccvs/src/server.c:1.453.2.4 ccvs/src/server.c:1.453.2.5
--- ccvs/src/server.c:1.453.2.4 Tue Jan 10 02:27:46 2006
+++ ccvs/src/server.c Tue Jan 10 18:42:38 2006
@@ -29,12 +29,13 @@
#include "base.h"
#include "buffer.h"
#include "edit.h"
+#include "fileattr.h"
#include "gpg.h"
#include "ignore.h"
+#include "watch.h"
+#include "wrapper.h"
#include "cvs.h"
-#include "fileattr.h"
-#include "watch.h"
Index: ccvs/src/status.c
diff -u ccvs/src/status.c:1.68.6.2 ccvs/src/status.c:1.68.6.3
--- ccvs/src/status.c:1.68.6.2 Fri Jan 6 20:37:13 2006
+++ ccvs/src/status.c Tue Jan 10 18:42:38 2006
@@ -21,6 +21,7 @@
#include "classify.h"
#include "ignore.h"
#include "recurse.h"
+#include "wrapper.h"
#include "cvs.h"
Index: ccvs/src/subr.c
diff -u ccvs/src/subr.c:1.148.6.3 ccvs/src/subr.c:1.148.6.4
--- ccvs/src/subr.c:1.148.6.3 Tue Jan 10 02:27:47 2006
+++ ccvs/src/subr.c Tue Jan 10 18:42:39 2006
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1986-2005 The Free Software Foundation, Inc.
+ * Copyright (C) 1986-2006 The Free Software Foundation, Inc.
*
* Portions Copyright (C) 1998-2005 Derek Price, Ximbiot <http://ximbiot.com>,
* and others.
@@ -20,14 +20,18 @@
/* Verify interface. */
#include "subr.h"
-#include "cvs.h"
-
+/* GNULIB headers. */
#include "canonicalize.h"
#include "canon-host.h"
#include "getline.h"
#include "vasprintf.h"
#include "vasnprintf.h"
+/* CVS headers. */
+#include "wrapper.h"
+
+#include "cvs.h"
+
/* Get wint_t. */
#ifdef HAVE_WINT_T
# include <wchar.h>
Index: ccvs/src/update.c
diff -u ccvs/src/update.c:1.259.2.3 ccvs/src/update.c:1.259.2.4
--- ccvs/src/update.c:1.259.2.3 Fri Jan 6 20:37:13 2006
+++ ccvs/src/update.c Tue Jan 10 18:42:39 2006
@@ -58,12 +58,14 @@
#include "buffer.h"
#include "classify.h"
#include "edit.h"
+#include "fileattr.h"
#include "ignore.h"
+#include "no_diff.h"
#include "recurse.h"
+#include "watch.h"
+#include "wrapper.h"
#include "cvs.h"
-#include "watch.h"
-#include "fileattr.h"
#include "hardlink.h"
Index: ccvs/src/vers_ts.h
diff -u ccvs/src/vers_ts.h:1.1.4.1 ccvs/src/vers_ts.h:1.1.4.2
--- ccvs/src/vers_ts.h:1.1.4.1 Wed Dec 21 13:25:10 2005
+++ ccvs/src/vers_ts.h Tue Jan 10 18:42:38 2006
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 The Free Software Foundation, Inc.
+ * Copyright (C) 2006 The Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,6 +22,13 @@
#include "entries.h"
#include "rcs.h"
+/*
+ * a struct vers_ts contains all the information about a file including the
+ * user and rcs file names, and the version checked out and the head.
+ *
+ * this is usually obtained from a call to Version_TS which takes a
+ * tag argument for the RCS file if desired
+ */
struct vers_ts
{
/* rcs version user file derives from, from CVS/Entries.
@@ -85,4 +92,9 @@
};
typedef struct vers_ts Vers_TS;
+Vers_TS *Version_TS (struct file_info *finfo, char *options, char *tag,
+ char *date, int force_tag_match, int set_time);
+void freevers_ts (Vers_TS **versp);
+char *time_stamp (const char *file);
+
#endif /* VERS_TS_H */
Index: ccvs/src/watch.c
diff -u ccvs/src/watch.c:1.45.6.2 ccvs/src/watch.c:1.45.6.3
--- ccvs/src/watch.c:1.45.6.2 Fri Jan 6 20:37:13 2006
+++ ccvs/src/watch.c Tue Jan 10 18:42:39 2006
@@ -18,14 +18,16 @@
# include <config.h>
#endif
+/* Verify interface. */
+#include "watch.h"
+
/* CVS headers. */
#include "edit.h"
+#include "fileattr.h"
#include "ignore.h"
#include "recurse.h"
#include "cvs.h"
-#include "fileattr.h"
-#include "watch.h"
Index: ccvs/src/wrapper.c
diff -u /dev/null ccvs/src/wrapper.c:1.47.6.1
--- /dev/null Tue Jan 10 18:42:39 2006
+++ ccvs/src/wrapper.c Tue Jan 10 18:42:39 2006
@@ -0,0 +1,590 @@
+/*
+ * Copyright (C) 2006 The Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Verify interface. */
+#include "wrapper.h"
+
+/* GNULIB headers. */
+#include "getline.h"
+
+/* CVS headers. */
+#include "cvs.h"
+
+
+
+/*
+ Original Author: address@hidden <Andrew C. Athan> 2/1/94
+ Modified By: address@hidden
+
+ This package was written to support the NEXTSTEP concept of
+ "wrappers." These are essentially directories that are to be
+ treated as "files." This package allows such wrappers to be
+ "processed" on the way in and out of CVS. The intended use is to
+ wrap up a wrapper into a single tar, such that that tar can be
+ treated as a single binary file in CVS. To solve the problem
+ effectively, it was also necessary to be able to prevent rcsmerge
+ application at appropriate times.
+
+ ------------------
+ Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
+
+ wildcard [option value][option value]...
+
+ where option is one of
+ -m update methodology value: MERGE or COPY
+ -k default -k rcs option to use on import or add
+
+ and value is a single-quote delimited value.
+
+ E.g:
+ *.nib -f 'gunzipuntar' -t 'targzip' -m 'COPY'
+*/
+
+
+typedef struct {
+ char *wildCard;
+ char *tocvsFilter;
+ char *fromcvsFilter;
+ char *rcsOption;
+ WrapMergeMethod mergeMethod;
+} WrapperEntry;
+
+static WrapperEntry **wrap_list=NULL;
+static WrapperEntry **wrap_saved_list=NULL;
+
+static int wrap_size=0;
+static int wrap_count=0;
+static int wrap_tempcount=0;
+
+/* FIXME: the relationship between wrap_count, wrap_tempcount,
+ * wrap_saved_count, and wrap_saved_tempcount is not entirely clear;
+ * it is certainly suspicious that wrap_saved_count is never set to a
+ * value other than zero! If the variable isn't being used, it should
+ * be removed. And in general, we should describe how temporary
+ * vs. permanent wrappers are implemented, and then make sure the
+ * implementation is actually doing that.
+ *
+ * Right now things seem to be working, but that's no guarantee there
+ * isn't a bug lurking somewhere in the murk.
+ */
+
+static int wrap_saved_count=0;
+
+static int wrap_saved_tempcount=0;
+
+#define WRAPPER_GROW 8
+
+void wrap_add_entry (WrapperEntry *e,int temp);
+void wrap_kill (void);
+void wrap_kill_temp (void);
+void wrap_free_entry (WrapperEntry *e);
+void wrap_free_entry_internal (WrapperEntry *e);
+void wrap_restore_saved (void);
+
+void wrap_setup(void)
+{
+ /* FIXME-reentrancy: if we do a multithreaded server, will need to
+ move this to a per-connection data structure, or better yet
+ think about a cleaner solution. */
+ static int wrap_setup_already_done = 0;
+ char *homedir;
+
+ if (wrap_setup_already_done != 0)
+ return;
+ else
+ wrap_setup_already_done = 1;
+
+ if (!current_parsed_root->isremote)
+ {
+ char *file;
+
+ /* Then add entries found in repository, if it exists. */
+ file = Xasprintf ("%s/%s/%s", current_parsed_root->directory,
+ CVSROOTADM, CVSROOTADM_WRAPPER);
+ if (isfile (file))
+ {
+ wrap_add_file(file,0);
+ }
+ free (file);
+ }
+
+ /* Then add entries found in home dir, (if user has one) and file
+ exists. */
+ homedir = get_homedir ();
+ /* If we can't find a home directory, ignore ~/.cvswrappers. This may
+ make tracking down problems a bit of a pain, but on the other
+ hand it might be obnoxious to complain when CVS will function
+ just fine without .cvswrappers (and many users won't even know what
+ .cvswrappers is). */
+ if (homedir != NULL)
+ {
+ char *file = strcat_filename_onto_homedir (homedir, CVSDOTWRAPPER);
+ if (isfile (file))
+ {
+ wrap_add_file (file, 0);
+ }
+ free (file);
+ }
+
+ /* FIXME: calling wrap_add() below implies that the CVSWRAPPERS
+ * environment variable contains exactly one "wrapper" -- a line
+ * of the form
+ *
+ * FILENAME_PATTERN FLAG OPTS [ FLAG OPTS ...]
+ *
+ * This may disagree with the documentation, which states:
+ *
+ * `$CVSWRAPPERS'
+ * A whitespace-separated list of file name patterns that CVS
+ * should treat as wrappers. *Note Wrappers::.
+ *
+ * Does this mean the environment variable can hold multiple
+ * wrappers lines? If so, a single call to wrap_add() is
+ * insufficient.
+ */
+
+ /* Then add entries found in CVSWRAPPERS environment variable. */
+ wrap_add (getenv (WRAPPER_ENV), 0);
+}
+
+#ifdef CLIENT_SUPPORT
+/* Send -W arguments for the wrappers to the server. The command must
+ be one that accepts them (e.g. update, import). */
+void
+wrap_send (void)
+{
+ int i;
+
+ for (i = 0; i < wrap_count + wrap_tempcount; ++i)
+ {
+ if (wrap_list[i]->tocvsFilter != NULL
+ || wrap_list[i]->fromcvsFilter != NULL)
+ /* For greater studliness we would print the offending option
+ and (more importantly) where we found it. */
+ error (0, 0, "\
+-t and -f wrapper options are not supported remotely; ignored");
+ if (wrap_list[i]->mergeMethod == WRAP_COPY)
+ /* For greater studliness we would print the offending option
+ and (more importantly) where we found it. */
+ error (0, 0, "\
+-m wrapper option is not supported remotely; ignored");
+ send_to_server ("Argument -W\012Argument ", 0);
+ send_to_server (wrap_list[i]->wildCard, 0);
+ send_to_server (" -k '", 0);
+ if (wrap_list[i]->rcsOption != NULL)
+ send_to_server (wrap_list[i]->rcsOption, 0);
+ else
+ send_to_server ("kv", 0);
+ send_to_server ("'\012", 0);
+ }
+}
+#endif /* CLIENT_SUPPORT */
+
+#if defined(SERVER_SUPPORT) || defined(CLIENT_SUPPORT)
+/* Output wrapper entries in the format of cvswrappers lines.
+ *
+ * This is useful when one side of a client/server connection wants to
+ * send its wrappers to the other; since the receiving side would like
+ * to use wrap_add() to incorporate the wrapper, it's best if the
+ * entry arrives in this format.
+ *
+ * The entries are stored in `line', which is allocated here. Caller
+ * can free() it.
+ *
+ * If first_call_p is nonzero, then start afresh. */
+void
+wrap_unparse_rcs_options (char **line, int first_call_p)
+{
+ /* FIXME-reentrancy: we should design a reentrant interface, like
+ a callback which gets handed each wrapper (a multithreaded
+ server being the most concrete reason for this, but the
+ non-reentrant interface is fairly unnecessary/ugly). */
+ static int i;
+
+ if (first_call_p)
+ i = 0;
+
+ if (i >= wrap_count + wrap_tempcount) {
+ *line = NULL;
+ return;
+ }
+
+ *line = Xasprintf ("%s -k '%s'",
+ wrap_list[i]->wildCard,
+ wrap_list[i]->rcsOption
+ ? wrap_list[i]->rcsOption : "kv");
+ ++i;
+}
+#endif /* SERVER_SUPPORT || CLIENT_SUPPORT */
+
+/*
+ * Remove fmt str specifier other than %% or %s. And allow
+ * only max_s %s specifiers
+ */
+static void
+wrap_clean_fmt_str(char *fmt, int max_s)
+{
+ while (*fmt) {
+ if (fmt[0] == '%' && fmt[1])
+ {
+ if (fmt[1] == '%')
+ fmt++;
+ else
+ if (fmt[1] == 's' && max_s > 0)
+ {
+ max_s--;
+ fmt++;
+ } else
+ *fmt = ' ';
+ }
+ fmt++;
+ }
+}
+
+/*
+ * Open a file and read lines, feeding each line to a line parser. Arrange
+ * for keeping a temporary list of wrappers at the end, if the "temp"
+ * argument is set.
+ */
+void
+wrap_add_file (const char *file, int temp)
+{
+ FILE *fp;
+ char *line = NULL;
+ size_t line_allocated = 0;
+
+ wrap_restore_saved ();
+ wrap_kill_temp ();
+
+ /* Load the file. */
+ fp = CVS_FOPEN (file, "r");
+ if (fp == NULL)
+ {
+ if (!existence_error (errno))
+ error (0, errno, "cannot open %s", file);
+ return;
+ }
+ while (getline (&line, &line_allocated, fp) >= 0)
+ wrap_add (line, temp);
+ if (line)
+ free (line);
+ if (ferror (fp))
+ error (0, errno, "cannot read %s", file);
+ if (fclose (fp) == EOF)
+ error (0, errno, "cannot close %s", file);
+}
+
+void
+wrap_kill(void)
+{
+ wrap_kill_temp();
+ while(wrap_count)
+ wrap_free_entry(wrap_list[--wrap_count]);
+}
+
+void
+wrap_kill_temp(void)
+{
+ WrapperEntry **temps=wrap_list+wrap_count;
+
+ while(wrap_tempcount)
+ wrap_free_entry(temps[--wrap_tempcount]);
+}
+
+void
+wrap_free_entry(WrapperEntry *e)
+{
+ wrap_free_entry_internal(e);
+ free(e);
+}
+
+void
+wrap_free_entry_internal(WrapperEntry *e)
+{
+ free (e->wildCard);
+ if (e->tocvsFilter)
+ free (e->tocvsFilter);
+ if (e->fromcvsFilter)
+ free (e->fromcvsFilter);
+ if (e->rcsOption)
+ free (e->rcsOption);
+}
+
+void
+wrap_restore_saved(void)
+{
+ if(!wrap_saved_list)
+ return;
+
+ wrap_kill();
+
+ free(wrap_list);
+
+ wrap_list=wrap_saved_list;
+ wrap_count=wrap_saved_count;
+ wrap_tempcount=wrap_saved_tempcount;
+
+ wrap_saved_list=NULL;
+ wrap_saved_count=0;
+ wrap_saved_tempcount=0;
+}
+
+void
+wrap_add (char *line, int isTemp)
+{
+ char *temp;
+ char ctemp;
+ WrapperEntry e;
+ char opt;
+
+ if (!line || line[0] == '#')
+ return;
+
+ memset (&e, 0, sizeof(e));
+
+ /* Search for the wild card */
+ while (*line && isspace ((unsigned char) *line))
+ ++line;
+ for (temp = line;
+ *line && !isspace ((unsigned char) *line);
+ ++line)
+ ;
+ if(temp==line)
+ return;
+
+ ctemp=*line;
+ *line='\0';
+
+ e.wildCard=xstrdup(temp);
+ *line=ctemp;
+
+ while(*line){
+ /* Search for the option */
+ while(*line && *line!='-')
+ ++line;
+ if(!*line)
+ break;
+ ++line;
+ if(!*line)
+ break;
+ opt=*line;
+
+ /* Search for the filter commandline */
+ for(++line;*line && *line!='\'';++line);
+ if(!*line)
+ break;
+
+ for(temp=++line;*line && (*line!='\'' || line[-1]=='\\');++line)
+ ;
+
+ /* This used to "break;" (ignore the option) if there was a
+ single character between the single quotes (I'm guessing
+ that was accidental). Now it "break;"s if there are no
+ characters. I'm not sure either behavior is particularly
+ necessary--the current options might not require ''
+ arguments, but surely some future option legitimately
+ might. Also I'm not sure that ignoring the option is a
+ swift way to handle syntax errors in general. */
+ if (line==temp)
+ break;
+
+ ctemp=*line;
+ *line='\0';
+ switch(opt){
+ case 'f':
+ /* Before this is reenabled, need to address the problem in
+ commit.c (see
+ <http://ximbiot.com/cvs/cvshome/docs/infowrapper.html>). */
+ error (1, 0,
+ "-t/-f wrappers not supported by this version of CVS");
+
+ if(e.fromcvsFilter)
+ free(e.fromcvsFilter);
+ /* FIXME: error message should say where the bad value
+ came from. */
+ e.fromcvsFilter =
+ expand_path (temp, current_parsed_root->directory, false,
+ "<wrapper>", 0);
+ if (!e.fromcvsFilter)
+ error (1, 0, "Correct above errors first");
+ break;
+ case 't':
+ /* Before this is reenabled, need to address the problem in
+ commit.c (see
+ <http://ximbiot.com/cvs/cvshome/docs/infowrapper.html>). */
+ error (1, 0,
+ "-t/-f wrappers not supported by this version of CVS");
+
+ if(e.tocvsFilter)
+ free(e.tocvsFilter);
+ /* FIXME: error message should say where the bad value
+ came from. */
+ e.tocvsFilter = expand_path (temp, current_parsed_root->directory,
+ false, "<wrapper>", 0);
+ if (!e.tocvsFilter)
+ error (1, 0, "Correct above errors first");
+ break;
+ case 'm':
+ if(*temp=='C' || *temp=='c')
+ e.mergeMethod=WRAP_COPY;
+ else
+ e.mergeMethod=WRAP_MERGE;
+ break;
+ case 'k':
+ if (e.rcsOption)
+ free (e.rcsOption);
+ e.rcsOption = strcmp (temp, "kv") ? xstrdup (temp) : NULL;
+ break;
+ default:
+ break;
+ }
+ *line=ctemp;
+ if(!*line)break;
+ ++line;
+ }
+
+ wrap_add_entry(&e, isTemp);
+}
+
+void
+wrap_add_entry (WrapperEntry *e, int temp)
+{
+ int x;
+ if (wrap_count + wrap_tempcount >= wrap_size)
+ {
+ wrap_size += WRAPPER_GROW;
+ wrap_list = xnrealloc (wrap_list, wrap_size, sizeof (WrapperEntry *));
+ }
+
+ if (!temp && wrap_tempcount)
+ {
+ for (x = wrap_count + wrap_tempcount - 1; x >= wrap_count; --x)
+ wrap_list[x + 1] = wrap_list[x];
+ }
+
+ x = (temp ? wrap_count + (wrap_tempcount++) : (wrap_count++));
+ wrap_list[x] = xmalloc (sizeof (WrapperEntry));
+ *wrap_list[x] = *e;
+}
+
+/* Return 1 if the given filename is a wrapper filename */
+int
+wrap_name_has (const char *name, WrapMergeHas has)
+{
+ int x,count=wrap_count+wrap_tempcount;
+ char *temp;
+
+ for(x=0;x<count;++x)
+ if (CVS_FNMATCH (wrap_list[x]->wildCard, name, 0) == 0){
+ switch(has){
+ case WRAP_TOCVS:
+ temp=wrap_list[x]->tocvsFilter;
+ break;
+ case WRAP_FROMCVS:
+ temp=wrap_list[x]->fromcvsFilter;
+ break;
+ case WRAP_RCSOPTION:
+ temp = wrap_list[x]->rcsOption;
+ break;
+ default:
+ abort ();
+ }
+ if(temp==NULL)
+ return (0);
+ else
+ return (1);
+ }
+ return (0);
+}
+
+static WrapperEntry *wrap_matching_entry (const char *);
+
+static WrapperEntry *
+wrap_matching_entry (const char *name)
+{
+ int x,count=wrap_count+wrap_tempcount;
+
+ for(x=0;x<count;++x)
+ if (CVS_FNMATCH (wrap_list[x]->wildCard, name, 0) == 0)
+ return wrap_list[x];
+ return NULL;
+}
+
+/* Return the RCS options for FILENAME in a newly malloc'd string. If
+ ASFLAG, then include "-k" at the beginning (e.g. "-kb"), otherwise
+ just give the option itself (e.g. "b"). */
+char *
+wrap_rcsoption (const char *filename, int asflag)
+{
+ WrapperEntry *e = wrap_matching_entry (filename);
+
+ if (e == NULL || e->rcsOption == NULL || (*e->rcsOption == '\0'))
+ return NULL;
+
+ return Xasprintf ("%s%s", asflag ? "-k" : "", e->rcsOption);
+}
+
+char *
+wrap_tocvs_process_file(const char *fileName)
+{
+ WrapperEntry *e=wrap_matching_entry(fileName);
+ static char *buf = NULL;
+ char *args;
+
+ if(e==NULL || e->tocvsFilter==NULL)
+ return NULL;
+
+ if (buf != NULL)
+ free (buf);
+ buf = cvs_temp_name ();
+
+ wrap_clean_fmt_str (e->tocvsFilter, 2);
+ args = Xasprintf (e->tocvsFilter, fileName, buf);
+ run_setup (args);
+ run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL | RUN_REALLY );
+ free (args);
+
+ return buf;
+}
+
+int
+wrap_merge_is_copy (const char *fileName)
+{
+ WrapperEntry *e=wrap_matching_entry(fileName);
+ if(e==NULL || e->mergeMethod==WRAP_MERGE)
+ return 0;
+
+ return 1;
+}
+
+void
+wrap_fromcvs_process_file(const char *fileName)
+{
+ char *args;
+ WrapperEntry *e = wrap_matching_entry(fileName);
+
+ if (e != NULL && e->fromcvsFilter != NULL)
+ {
+ wrap_clean_fmt_str (e->fromcvsFilter, 1);
+ args = Xasprintf (e->fromcvsFilter, fileName);
+ run_setup (args);
+ run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL);
+ free (args);
+ }
+ return;
+}
Index: ccvs/src/wrapper.h
diff -u /dev/null ccvs/src/wrapper.h:1.1.2.1
--- /dev/null Tue Jan 10 18:42:39 2006
+++ ccvs/src/wrapper.h Tue Jan 10 18:42:38 2006
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2006 The Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WRAPPER_H
+#define WRAPPER_H
+
+typedef enum { WRAP_MERGE, WRAP_COPY } WrapMergeMethod;
+typedef enum {
+ /* -t and -f wrapper options. Treating directories as single files. */
+ WRAP_TOCVS,
+ WRAP_FROMCVS,
+ /* -k wrapper option. Default keyword expansion options. */
+ WRAP_RCSOPTION
+} WrapMergeHas;
+
+void wrap_setup (void);
+int wrap_name_has (const char *name, WrapMergeHas has);
+char *wrap_rcsoption (const char *fileName, int asFlag);
+char *wrap_tocvs_process_file (const char *fileName);
+int wrap_merge_is_copy (const char *fileName);
+void wrap_fromcvs_process_file (const char *fileName);
+void wrap_add_file (const char *file, int temp);
+void wrap_add (char *line, int temp);
+void wrap_send (void);
+#if defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT)
+void wrap_unparse_rcs_options (char **, int);
+#endif /* SERVER_SUPPORT || CLIENT_SUPPORT */
+
+#endif /* WRAPPER_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Cvs-cvs] ccvs/src cvs.h filesubr.h vers_ts.h add.c check... [signed-commits3],
Derek Robert Price <=