[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
option to patch 2.5.4 to handle diffs generated by some versions of CVS
From: |
Dan Mosedale |
Subject: |
option to patch 2.5.4 to handle diffs generated by some versions of CVS |
Date: |
Fri, 30 Mar 2001 17:20:49 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux 2.2.17-14d1 i686; en-US; 0.8.1) |
Some versions of CVS generate diffs where the only useful path
information is in the Index: line. I'm told that the CVS 1.10.8 and
later have this bug fixed. Unfortunately, I still have to work with a
server that's older than that. Attachment one contains just such a set
of diffs as a demonstration of the problem. Attachment two is a patch
that adds an option to patch-2.5.4 for handling such diffs without
incorrectly trying to patch stuff in the current directory. I'd love to
see this get included in a future version of patch.
Dan
Index: src/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/js/src/xpconnect/src/Makefile.in,v
retrieving revision 1.48
diff -u -u -w -r1.48 Makefile.in
--- Makefile.in 2001/02/22 09:32:08 1.48
+++ Makefile.in 2001/03/15 23:19:45
@@ -94,5 +94,6 @@
ifdef MOZ_XPCTOOLS
DEFINES += -DXPC_TOOLS_SUPPORT
+REQUIRES += xpctools
endif
Index: tools/src/Makefile.in
===================================================================
RCS file: /cvsroot/mozilla/js/src/xpconnect/tools/src/Makefile.in,v
retrieving revision 1.2
diff -u -u -w -r1.2 Makefile.in
--- Makefile.in 2001/02/01 18:07:08 1.2
+++ Makefile.in 2001/03/15 23:19:45
@@ -42,7 +42,7 @@
MODULE = xpctools
LIBRARY_NAME = xpctools
SHORT_LIBNAME = xpctools
-REQUIRES = xpcom xpconnect js
+REQUIRES = xpcom xpconnect js string
CPPSRCS = \
nsXPCToolsCompiler.o \
Only in patch-2.5.4-new: Makefile
diff -u patch-2.5.4/common.h patch-2.5.4-new/common.h
--- patch-2.5.4/common.h Sun Aug 29 23:20:08 1999
+++ patch-2.5.4-new/common.h Fri Mar 16 21:56:15 2001
@@ -198,6 +198,7 @@
XTERN int patch_get;
XTERN int set_time;
XTERN int set_utc;
+XTERN bool index_only;
enum diff
{
Only in patch-2.5.4-new: config.cache
Only in patch-2.5.4-new: config.h
Only in patch-2.5.4-new: config.status
Common subdirectories: patch-2.5.4/m4 and patch-2.5.4-new/m4
diff -u patch-2.5.4/patch.c patch-2.5.4-new/patch.c
--- patch-2.5.4/patch.c Sun Aug 29 23:20:08 1999
+++ patch-2.5.4-new/patch.c Fri Mar 30 17:04:23 2001
@@ -485,7 +485,7 @@
skip_rest_of_patch = FALSE;
}
-static char const shortopts[] = "bB:cd:D:eEfF:g:i:lnNo:p:r:RstTuvV:x:Y:z:Z";
+static char const shortopts[] = "bB:cd:D:eEfF:g:i:I:lnNo:p:r:RstTuvV:x:Y:z:Z";
static struct option const longopts[] =
{
{"backup", no_argument, NULL, 'b'},
@@ -499,6 +499,7 @@
{"fuzz", required_argument, NULL, 'F'},
{"get", no_argument, NULL, 'g'},
{"input", required_argument, NULL, 'i'},
+ {"index-only", no_argument, NULL, 'I'},
{"ignore-whitespace", no_argument, NULL, 'l'},
{"normal", no_argument, NULL, 'n'},
{"forward", no_argument, NULL, 'N'},
@@ -580,6 +581,7 @@
" -t --batch Ask no questions; skip bad-Prereq patches; assume reversed.",
" -f --force Like -t, but ignore bad-Prereq patches, and assume
unreversed.",
" -s --quiet --silent Work silently unless an error occurs.",
+" -I --index-only Use only the Index: lines to choose which files to
patch.",
" --verbose Output extra information about the work being done.",
" --dry-run Do not actually change any files; just print what would happen.",
" --posix Conform to the POSIX standard.",
@@ -684,6 +686,9 @@
break;
case 'i':
patchname = savestr (optarg);
+ break;
+ case 'I':
+ index_only = TRUE;
break;
case 'l':
canonicalize = TRUE;
diff -u patch-2.5.4/patch.man patch-2.5.4-new/patch.man
--- patch-2.5.4/patch.man Sat Mar 21 07:48:43 1998
+++ patch-2.5.4-new/patch.man Fri Mar 16 22:35:21 2001
@@ -391,6 +391,16 @@
.BR \- ,
read from standard input, the default.
.TP
+\fB\-I\fP or \fB\*=index-only\fP
+When not in
+.BR \*=posix
+mode, always uses the
+.B Index:\&
+line to choose which file to patch. Many versions of
+.B cvs diff
+generate patches which require the use of this switch to avoid
+clobbering identically named files in the current directory.
+.TP
\fB\-l\fP or \fB\*=ignore\-whitespace\fP
Match patterns loosely, in case tabs or spaces
have been munged in your files.
Common subdirectories: patch-2.5.4/pc and patch-2.5.4-new/pc
diff -u patch-2.5.4/pch.c patch-2.5.4-new/pch.c
--- patch-2.5.4/pch.c Sun Aug 29 23:20:08 1999
+++ patch-2.5.4-new/pch.c Fri Mar 16 22:07:04 2001
@@ -513,7 +513,8 @@
{
enum nametype i0 = NONE;
- if (! posixly_correct && (name[OLD] || name[NEW]) && name[INDEX])
+ if (! posixly_correct && ! index_only && (name[OLD] || name[NEW])
+ && name[INDEX])
{
free (name[INDEX]);
name[INDEX] = 0;
@@ -544,7 +545,14 @@
{
int is_empty;
- i = best_name (name, stat_errno);
+ if ( index_only ) {
+ if (name[INDEX])
+ i = INDEX;
+ else
+ i = NONE;
+ } else {
+ i = best_name (name, stat_errno);
+ }
if (i == NONE && patch_get)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- option to patch 2.5.4 to handle diffs generated by some versions of CVS,
Dan Mosedale <=
- Prev by Date:
Question about make problem...
- Next by Date:
B,U.I,L.D, .Y,O.U;R -O;WN, .C;AB-L;E .B,O.X; ;D;ES;CR;AM;BL;ER ((LEGAL))................ 3852
- Previous by thread:
Question about make problem...
- Next by thread:
B,U.I,L.D, .Y,O.U;R -O;WN, .C;AB-L;E .B,O.X; ;D;ES;CR;AM;BL;ER ((LEGAL))................ 3852
- Index(es):