1 /* 2 * Copyright (c) 1992, Brian Berliner and Jeff Polk 3 * Copyright (c) 1989-1992, Brian Berliner 4 * 5 * You may distribute under the terms of the GNU General Public License as 6 * specified in the README file that comes with the CVS source distribution. 7 * 8 * No Difference 9 * 10 * The user file looks modified judging from its time stamp; however it needn't 11 * be. No_difference() finds out whether it is or not. If it is not, it 12 * updates the administration. 13 * 14 * returns 0 if no differences are found and non-zero otherwise 15 */ 16 17 #include "cvs.h" 18 19 int 20 No_Difference (finfo, vers) 21 struct file_info *finfo; 22 Vers_TS *vers; 23 { 24 Node *p; 25 int ret; 26 char *ts, *options; 27 int retcode = 0; 28 char *tocvsPath; 29 30 /* If ts_user is "Is-modified", we can only conclude the files are 31 different (since we don't have the file's contents). */ 32 if (vers->ts_user != NULL 33 && strcmp (vers->ts_user, "Is-modified") == 0) 34 return -1; 35 36 if (!vers->srcfile || !vers->srcfile->path) 37 return (-1); /* different since we couldn't tell */ 38 39 #ifdef PRESERVE_PERMISSIONS_SUPPORT 40 /* If special files are in use, then any mismatch of file metadata 41 information also means that the files should be considered different. */ 42 if (preserve_perms && special_file_mismatch (finfo, vers->vn_user, NULL)) 43 return 1; 44 #endif 45 46 if (vers->entdata && vers->entdata->options) 47 options = xstrdup (vers->entdata->options); 48 else 49 options = xstrdup (""); 50 51 tocvsPath = wrap_tocvs_process_file (finfo->file); 52 retcode = RCS_cmp_file (vers->srcfile, vers->vn_user, options, 53 tocvsPath == NULL ? finfo->file : tocvsPath); 54 if (retcode == 0) 55 { 56 /* no difference was found, so fix the entries file */ 57 ts = time_stamp (finfo->file); 58 Register (finfo->entries, finfo->file, 59 vers->vn_user ? vers->vn_user : vers->vn_rcs, ts, 60 options, vers->tag, vers->date, (char *) 0); 61 #ifdef SERVER_SUPPORT 62 if (server_active) 63 { 64 /* We need to update the entries line on the client side. */ 65 server_update_entries 66 (finfo->file, finfo->update_dir, finfo->repository, SERVER_UPDATED); 67 } 68 #endif 69 free (ts); 70 71 /* update the entdata pointer in the vers_ts structure */ 72 p = findnode (finfo->entries, finfo->file); 73 vers->entdata = (Entnode *) p->data; 74 75 ret = 0; 76 } 77 else 78 ret = 1; /* files were really different */ 79 80 if (tocvsPath) 81 { 82 /* Need to call unlink myself because the noexec variable 83 * has been set to 1. */ 84 if (trace) 85 (void) fprintf (stderr, "%s-> unlink (%s)\n", 86 CLIENT_SERVER_STR, tocvsPath); 87 if ( CVS_UNLINK (tocvsPath) < 0) 88 error (0, errno, "could not remove %s", tocvsPath); 89 } 90 91 free (options); 92 return (ret); 93 } 94