home *** CD-ROM | disk | FTP | other *** search
/ Peanuts NeXT Software Archives / Peanuts-Update.iso / NEXTSTEP / unix / developer / cvs.HOWTO.README / cvs.HOWTO / cvswrappers-HOWTO.1.1.rtfd / TRH-cvs-1.9.diff < prev    next >
Encoding:
Text File  |  1997-07-11  |  8.6 KB  |  290 lines

  1. ChangeLog:
  2.  
  3. Fri Nov 15 13:06:03 1996  Tom Hageman  <tom@basil.icce.rug.nl>
  4.  
  5.     * checkin.c (Checkin): Backup original of cvswrapped file, and
  6.     restore it in case of no differences due to checkin, or on error.
  7.  
  8.     * diff.c (diff_fileproc): In printing error messages, use the
  9.     correct filename for which the error occurred.
  10.  
  11.     * filesubr.c (deep_remove_dir): If necessary, make second pass
  12.     over directory to remove stale NFS handles.
  13.     
  14.     * import.c (update_rcs_file): Compare just checked-out file with
  15.     cvswrapped file, if any, instead of original.
  16.     (add_rev): Work around ci smartness: move cvswrapped file in place
  17.     of original before checkin, and restore original afterward.
  18.  
  19. *** cvs-1.9/src/%checkin.c    Wed Oct  2 08:03:56 1996
  20. --- cvs-1.9/src/checkin.c    Sun Nov 10 18:02:08 1996
  21. *************** Checkin (type, finfo, rcs, rev, tag, opt
  22. *** 50,57 ****
  23.           if (tocvsPath)
  24.       {
  25. !             copy_file (tocvsPath, fname);
  26. !         if (unlink_file_dir (finfo->file) < 0)
  27.           if (! existence_error (errno))
  28. !             error (1, errno, "cannot remove %s", finfo->fullname);
  29.           copy_file (tocvsPath, finfo->file);
  30.       }
  31. --- 50,59 ----
  32.           if (tocvsPath)
  33.       {
  34. !         /* Backup the current version of the file. */
  35. !         if (unlink_file_dir (fname) < 0)
  36.           if (! existence_error (errno))
  37. !             error (1, errno, "cannot remove %s", fname);
  38. !         rename_file (finfo->file, fname);
  39. !         /* Copy the wrapped file to the current directory then go to work */
  40.           copy_file (tocvsPath, finfo->file);
  41.       }
  42. *************** Checkin (type, finfo, rcs, rev, tag, opt
  43. *** 62,65 ****
  44. --- 64,68 ----
  45.       }
  46.   
  47. +     /* ??? [TRH] do we really go ahead even if noexec is set? */
  48.       switch (RCS_checkin (rcs, NULL, message, rev, 0))
  49.       {
  50. *************** Checkin (type, finfo, rcs, rev, tag, opt
  51. *** 89,94 ****
  52.   
  53.           xchmod (finfo->file, 1);
  54. !         if (xcmp (finfo->file, fname) == 0)
  55.           {
  56.           rename_file (fname, finfo->file);
  57.           /* the time was correct, so leave it alone */
  58. --- 92,103 ----
  59.   
  60.           xchmod (finfo->file, 1);
  61. !         /* [TRH] FIXME: what if noexec? */
  62. !         if (xcmp (finfo->file, tocvsPath ? tocvsPath : fname) == 0)
  63.           {
  64. +         /* Cannot rename directory back over existing file. */
  65. +         if (unlink_file_dir (finfo->file) < 0)
  66. +             if (! existence_error (errno))
  67. +             error (1, errno, "cannot remove %s", finfo->file);
  68.           rename_file (fname, finfo->file);
  69.           /* the time was correct, so leave it alone */
  70. *************** Checkin (type, finfo, rcs, rev, tag, opt
  71. *** 97,108 ****
  72.           else
  73.           {
  74. !         if (unlink_file (fname) < 0)
  75. !             error (0, errno, "cannot remove %s", fname);
  76.           /* sync up with the time from the RCS file */
  77.           set_time = 1;
  78.           }
  79.   
  80. -         wrap_fromcvs_process_file (finfo->file);
  81.           /*
  82.            * If we want read-only files, muck the permissions here, before
  83. --- 106,118 ----
  84.           else
  85.           {
  86. !         wrap_fromcvs_process_file (finfo->file);
  87. !         if (unlink_file_dir (fname) < 0)
  88. !             if (! existence_error (errno))
  89. !             error (0, errno, "cannot remove %s", fname);
  90.           /* sync up with the time from the RCS file */
  91.           set_time = 1;
  92.           }
  93.   
  94.           /*
  95.            * If we want read-only files, muck the permissions here, before
  96. *************** Checkin (type, finfo, rcs, rev, tag, opt
  97. *** 133,138 ****
  98. --- 143,151 ----
  99.   
  100.           if (!noexec)
  101. +         {
  102. +         rename_file (fname, finfo->file);
  103.           error (1, errno, "could not check in %s -- fork failed",
  104.                  finfo->fullname);
  105. +         }
  106.           return (1);
  107.   
  108. *** cvs-1.9/src/%diff.c    Wed Oct  2 08:03:59 1996
  109. --- cvs-1.9/src/diff.c    Fri Nov  8 22:03:08 1996
  110. *************** diff_fileproc (callerdat, finfo)
  111. *** 512,516 ****
  112.       if (unlink_file_dir (fname) < 0)
  113.           if (! existence_error (errno))
  114. !         error (1, errno, "cannot remove %s", finfo->file);
  115.       rename_file (finfo->file, fname);
  116.       /* Copy the wrapped file to the current directory then go to work */
  117. --- 512,516 ----
  118.       if (unlink_file_dir (fname) < 0)
  119.           if (! existence_error (errno))
  120. !         error (1, errno, "cannot remove %s", fname);
  121.       rename_file (finfo->file, fname);
  122.       /* Copy the wrapped file to the current directory then go to work */
  123. *************** diff_fileproc (callerdat, finfo)
  124. *** 610,614 ****
  125.       rename_file (fname,finfo->file);
  126.       if (unlink_file (tocvsPath) < 0)
  127. !         error (1, errno, "cannot remove %s", finfo->file);
  128.       }
  129.   
  130. --- 610,614 ----
  131.       rename_file (fname,finfo->file);
  132.       if (unlink_file (tocvsPath) < 0)
  133. !         error (1, errno, "cannot remove %s", tocvsPath);
  134.       }
  135.   
  136. *** cvs-1.9/src/%filesubr.c    Wed Sep 25 16:42:48 1996
  137. --- cvs-1.9/src/filesubr.c    Fri Nov  8 22:21:35 1996
  138. *************** deep_remove_dir (path)
  139. *** 469,474 ****
  140. --- 469,482 ----
  141.       struct dirent *dp;
  142.       char       buf[PATH_MAX];
  143. +     int           status;
  144. +     int           attempt = 2;
  145.   
  146. + #if 0
  147.       if (rmdir (path) != 0 && (errno == ENOTEMPTY || errno == EEXIST)) 
  148. + #endif
  149. +     /* This is an attempt to defeat stale .nfsXXXXX handles,
  150. +        as left around by NeXTSTEPs NFS at least. */
  151. +     while ((status = rmdir (path)) != 0 && attempt-- > 0 &&
  152. +        (errno == ENOTEMPTY || errno == EEXIST)) 
  153.       {
  154.       if ((dirp = opendir (path)) == NULL)
  155. *************** deep_remove_dir (path)
  156. *** 507,515 ****
  157.       }
  158.       closedir (dirp);
  159.       return rmdir (path);
  160. !     }
  161.   
  162.       /* Was able to remove the directory return 0 */
  163.       return 0;
  164.   }
  165.   
  166. --- 515,528 ----
  167.       }
  168.       closedir (dirp);
  169. + #if 0
  170.       return rmdir (path);
  171. ! #endif
  172. !     }
  173.   
  174. + #if 0
  175.       /* Was able to remove the directory return 0 */
  176.       return 0;
  177. + #endif
  178. +     return status;
  179.   }
  180.   
  181. *** cvs-1.9/src/%import.c    Wed Oct  2 08:04:00 1996
  182. --- cvs-1.9/src/import.c    Fri Nov  8 22:26:14 1996
  183. *************** update_rcs_file (message, vfile, vtag, t
  184. *** 532,536 ****
  185.   
  186.       tocvsPath = wrap_tocvs_process_file (vfile);
  187. !     different = xcmp (xtmpfile, vfile);
  188.       if (tocvsPath)
  189.           if (unlink_file_dir (tocvsPath) < 0)
  190. --- 532,536 ----
  191.   
  192.       tocvsPath = wrap_tocvs_process_file (vfile);
  193. !     different = xcmp (xtmpfile, (tocvsPath ? tocvsPath : vfile));
  194.       if (tocvsPath)
  195.           if (unlink_file_dir (tocvsPath) < 0)
  196. *************** add_rev (message, rcs, vfile, vers)
  197. *** 590,593 ****
  198. --- 590,594 ----
  199.       int locked, status, ierrno;
  200.       char *tocvsPath;
  201. +     char backup[PATH_MAX];
  202.   
  203.       if (noexec)
  204. *************** add_rev (message, rcs, vfile, vers)
  205. *** 629,637 ****
  206.       }
  207.       }
  208.       status = RCS_checkin (rcs->path, tocvsPath == NULL ? vfile : tocvsPath,
  209.                 message, vbranch,
  210.                 (RCS_FLAGS_QUIET
  211.                  | (use_file_modtime ? RCS_FLAGS_MODTIME : 0)));
  212.       ierrno = errno;
  213.   
  214. --- 630,662 ----
  215.       }
  216.       }
  217. ! #if 0
  218. !     /* [TRH  8-Nov-96] This soes not work for wrapped files since RCS ci
  219. !        is too smart for its own good and refuses to check in the temporary
  220. !        file into the given repository name.  Sigh...
  221. !        So the correct (although cumbersome) way to do it is like in diff.c,
  222. !        by temporary moving the original file out of the way and copying
  223. !        the temporary into its place, and restoring afterwards. */
  224.       status = RCS_checkin (rcs->path, tocvsPath == NULL ? vfile : tocvsPath,
  225.                 message, vbranch,
  226.                 (RCS_FLAGS_QUIET
  227.                  | (use_file_modtime ? RCS_FLAGS_MODTIME : 0)));
  228. + #endif
  229. +     else /* (tocvsPath != NULL) */
  230. +     {
  231. +     /* Backup the current version of the file to ,,filename */
  232. +     sprintf(backup,"%s%s", CVSPREFIX, vfile);
  233. +     if (unlink_file_dir (backup) < 0)
  234. +         if (! existence_error (errno))
  235. +         error (1, errno, "cannot remove %s", backup);
  236. +     rename_file (vfile, backup);
  237. +     /* XXX should check that rename succeeded... */
  238. +     /* Copy the wrapped file to the current directory then go to work */
  239. +     copy_file (tocvsPath, vfile);
  240. +     }
  241. +     status = RCS_checkin (rcs->path, vfile,
  242. +               message, vbranch,
  243. +               (RCS_FLAGS_QUIET
  244. +                | (use_file_modtime ? RCS_FLAGS_MODTIME : 0)));
  245.       ierrno = errno;
  246.   
  247. *************** add_rev (message, rcs, vfile, vers)
  248. *** 639,645 ****
  249.       rename_file (FILE_HOLDER, vfile);
  250.       else
  251.       if (unlink_file_dir (tocvsPath) < 0)
  252.           error (0, errno, "cannot remove %s", tocvsPath);
  253.       if (status)
  254.       {
  255. --- 664,676 ----
  256.       rename_file (FILE_HOLDER, vfile);
  257.       else
  258. +     {
  259. +     if (unlink_file_dir (vfile) < 0)
  260. +         if (! existence_error (errno))
  261. +         error (1, errno, "cannot remove %s", vfile);
  262. +     rename_file (backup, vfile);
  263.       if (unlink_file_dir (tocvsPath) < 0)
  264.           error (0, errno, "cannot remove %s", tocvsPath);
  265. !     }
  266.       if (status)
  267.       {
  268. *** cvs-1.9/src/%version.c    Sat Oct  5 20:07:38 1996
  269. --- cvs-1.9/src/version.c    Fri Nov  8 22:34:07 1996
  270. ***************
  271. *** 13,17 ****
  272.   #include "cvs.h"
  273.   
  274. ! char *version_string = "\nConcurrent Versions System (CVS) 1.9";
  275.   
  276.   #ifdef CLIENT_SUPPORT
  277. --- 13,17 ----
  278.   #include "cvs.h"
  279.   
  280. ! char *version_string = "\nConcurrent Versions System (CVS) 1.9 [TRH#1]";
  281.   
  282.   #ifdef CLIENT_SUPPORT
  283.