When using "diff -urN" to create a patch, if a file no longer exists, then the date in
the diff heading is reset to 0, and the contents of the file are removed by the diff.
When the "patch" command sees that the date has been reset, it knows to remove the
file rather than just leaving an empty file. Here's an example:
diff -urN test-1.0/mytext.txt test-1.3/mytext.txt
--- test-1.0/mytext.txt Mon May 8 14:22:28 2000
+++ test-1.3/mytext.txt Wed Dec 31 19:00:00 1969
cvs rdiff doesn't do this. It always sets the timestamp from the RCS file. So, you
can't remove files using patches made by cvs rdiff. This is a pain.
Here's my patch:
diff -urN cvs-1.11.1p1-orig/src/patch.c cvs-1.11.1p1-apc/src/patch.c
--- cvs-1.11.1p1-orig/src/patch.c Tue Apr 24 14:14:53 2001
+++ cvs-1.11.1p1-apc/src/patch.c Tue Oct 22 12:37:06 2002
@@ -389,6 +389,8 @@
char *cp1, *cp2;
FILE *fp;
int line_length;
+ time_t nulltime = 0L;
+ char *nulldate;
line1 = NULL;
line1_chars_allocated = 0;
@@ -645,6 +647,17 @@
goto out;
}
}
+
+ /* If file was removed, reset the timestamp */
+ if (!vers_head)
+ {
+ nulldate = ctime(&nulltime);
+ /* Fix non-standard format, like in vers_ts.c */
+ nulldate[24] = 0;
+ if (nulldate[8] == '0') nulldate[8] = ' ';
+ (void) sprintf(cp2, "\t%s\n", nulldate);
+ }
+
assert (current_parsed_root != NULL);
assert (current_parsed_root->directory != NULL);
{
_______________________________________________
Bug-cvs mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-cvs