summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/src/no_diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/cvs/src/no_diff.c')
-rw-r--r--contrib/cvs/src/no_diff.c120
1 files changed, 41 insertions, 79 deletions
diff --git a/contrib/cvs/src/no_diff.c b/contrib/cvs/src/no_diff.c
index a0d00f5..384800f 100644
--- a/contrib/cvs/src/no_diff.c
+++ b/contrib/cvs/src/no_diff.c
@@ -17,20 +17,22 @@
#include "cvs.h"
int
-No_Difference (file, vers, entries, repository, update_dir)
- char *file;
+No_Difference (finfo, vers)
+ struct file_info *finfo;
Vers_TS *vers;
- List *entries;
- char *repository;
- char *update_dir;
{
Node *p;
- char tmp[L_tmpnam+1];
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 */
@@ -39,91 +41,51 @@ No_Difference (file, vers, entries, repository, update_dir)
else
options = xstrdup ("");
- retcode = RCS_checkout (vers->srcfile->path, NULL, vers->vn_user, options,
- tmpnam (tmp), 0, 0);
+ tocvsPath = wrap_tocvs_process_file (finfo->file);
+ retcode = RCS_cmp_file (vers->srcfile, vers->vn_user, options,
+ tocvsPath == NULL ? finfo->file : tocvsPath);
if (retcode == 0)
{
-#if 0
- /* Why would we want to munge the modes? And only if the timestamps
- are different? And even for commands like "cvs status"???? */
- if (!iswritable (file)) /* fix the modes as a side effect */
- xchmod (file, 1);
-#endif
-
- tocvsPath = wrap_tocvs_process_file (file);
-
- /* do the byte by byte compare */
- if (xcmp (tocvsPath == NULL ? file : tocvsPath, tmp) == 0)
- {
-#if 0
- /* Why would we want to munge the modes? And only if the
- timestamps are different? And even for commands like
- "cvs status"???? */
- if (cvswrite == FALSE) /* fix the modes as a side effect */
- xchmod (file, 0);
-#endif
-
- /* no difference was found, so fix the entries file */
- ts = time_stamp (file);
- Register (entries, file,
- vers->vn_user ? vers->vn_user : vers->vn_rcs, ts,
- options, vers->tag, vers->date, (char *) 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, (char *) 0);
#ifdef SERVER_SUPPORT
- if (server_active)
- {
- /* We need to update the entries line on the client side. */
- server_update_entries
- (file, update_dir, repository, SERVER_UPDATED);
- }
+ 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);
+ free (ts);
- /* update the entdata pointer in the vers_ts structure */
- p = findnode (entries, file);
- vers->entdata = (Entnode *) p->data;
+ /* update the entdata pointer in the vers_ts structure */
+ p = findnode (finfo->entries, finfo->file);
+ vers->entdata = (Entnode *) 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. */
- if (trace)
- (void) fprintf (stderr, "%c-> unlink (%s)\n",
-#ifdef SERVER_SUPPORT
- (server_active) ? 'S' : ' ',
-#else
- ' ',
-#endif
- tocvsPath);
- if (unlink (tocvsPath) < 0)
- error (0, errno, "could not remove %s", tocvsPath);
- }
+ ret = 0;
}
else
- {
- if (update_dir[0] == '\0')
- error (0, retcode == -1 ? errno : 0,
- "could not check out revision %s of %s",
- vers->vn_user, file);
- else
- error (0, retcode == -1 ? errno : 0,
- "could not check out revision %s of %s/%s",
- vers->vn_user, update_dir, file);
- ret = -1; /* different since we couldn't tell */
- }
+ ret = 1; /* files were really different */
- if (trace)
+ if (tocvsPath)
+ {
+ /* Need to call unlink myself because the noexec variable
+ * has been set to 1. */
+ if (trace)
+ (void) fprintf (stderr, "%c-> unlink (%s)\n",
#ifdef SERVER_SUPPORT
- (void) fprintf (stderr, "%c-> unlink2 (%s)\n",
- (server_active) ? 'S' : ' ', tmp);
+ (server_active) ? 'S' : ' ',
#else
- (void) fprintf (stderr, "-> unlink (%s)\n", tmp);
+ ' ',
#endif
- if (unlink (tmp) < 0)
- error (0, errno, "could not remove %s", tmp);
+ tocvsPath);
+ if ( CVS_UNLINK (tocvsPath) < 0)
+ error (0, errno, "could not remove %s", tocvsPath);
+ }
+
free (options);
return (ret);
}
OpenPOWER on IntegriCloud