You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Gustavo Niemeyer <ni...@conectiva.com> on 2002/10/19 00:05:25 UTC
[PATCH] diff label problems
There's an interesting diff behavior which is affecting Subversion.
Please, have a look at these two executions:
% diff -u -L dir/file tmp.8380.00002 tmp.15728.00002
--- dir/file
+++ tmp.15728.00002 Fri Oct 18 20:27:00 2002
@@ -0,0 +1 @@
+foo
% diff -u -L dir/file -L dir/file tmp.8380.00002 tmp.15728.00002
--- dir/file
+++ dir/file
@@ -0,0 +1 @@
+foo
Noticed the diff header? Subversion is currently using the first
form:
% svn diff file:///svnroot/test@12 file:///svnroot/test@13
Index: dir/file
===================================================================
--- dir/file
+++ tmp.15136.00001 Fri Oct 18 20:46:01 2002
@@ -0,0 +1 @@
+foo
At first, this doesn't look like a big problem. But have a look at
this excerpt from the patch man page:
If no named files exist, no RCS, ClearCase, or SCCS
master was found, some names are given, patch is not
conforming to POSIX, and the patch appears to create a
file, patch selects the best name requiring the cre
ation of the fewest directories.
Now, guess what happens if the directory "dir" in the patch above
doesn't exist. :-)
This small patch fixes this behavior:
* subversion/libsvn_subr/io.c
(svn_io_run_diff): Repeat -L option, forcing usage of label for
both files.
Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c
+++ subversion/libsvn_subr/io.c 2002-10-18 21:01:11.000000000 -0300
@@ -1401,7 +1401,7 @@
nargs += 1; /* -u */
if (label != NULL)
- nargs += 2; /* the -L and the label itself */
+ nargs += 4; /* the -L and the label itself, two times */
args = apr_palloc (subpool, nargs * sizeof(char *));
@@ -1421,6 +1421,8 @@
{
args[i++] = "-L";
args[i++] = label;
+ args[i++] = "-L";
+ args[i++] = label;
}
args[i++] = from;
--
Gustavo Niemeyer
[ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ]
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] diff label problems
Posted by Gustavo Niemeyer <ni...@conectiva.com>.
> > This small patch fixes this behavior:
>
> Looks good. Does it work with 2.8 GNU diff? I have 2.7 installed and
> it works with that, but there are differences in the command line
> between 2.7 and 2.8.
Yes. I've tested with 2.7 and 2.8 and they have the same behavior.
Thanks!
--
Gustavo Niemeyer
[ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ]
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] diff label problems
Posted by Gustavo Niemeyer <ni...@conectiva.com>.
> The -L option is deprecated with diff 2.8, in favor of the long
> form "--label". I suggest updating this patch accordingly (replacing
> "-L" by "--label").
You're right, it's mentioned in the NEWS file.
Thank you!
--
Gustavo Niemeyer
[ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ]
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] diff label problems
Posted by Rafael Garcia-Suarez <rg...@free.fr>.
Philip Martin wrote:
> Gustavo Niemeyer <ni...@conectiva.com> writes:
>
> > This small patch fixes this behavior:
>
> Looks good. Does it work with 2.8 GNU diff? I have 2.7 installed and
> it works with that, but there are differences in the command line
> between 2.7 and 2.8.
The -L option is deprecated with diff 2.8, in favor of the long
form "--label". I suggest updating this patch accordingly (replacing
"-L" by "--label").
> > * subversion/libsvn_subr/io.c
> > (svn_io_run_diff): Repeat -L option, forcing usage of label for
> > both files.
> >
> > Index: subversion/libsvn_subr/io.c
> > ===================================================================
> > --- subversion/libsvn_subr/io.c
> > +++ subversion/libsvn_subr/io.c 2002-10-18 21:01:11.000000000 -0300
> > @@ -1401,7 +1401,7 @@
> > nargs += 1; /* -u */
> >
> > if (label != NULL)
> > - nargs += 2; /* the -L and the label itself */
> > + nargs += 4; /* the -L and the label itself, two times */
> >
> > args = apr_palloc (subpool, nargs * sizeof(char *));
> >
> > @@ -1421,6 +1421,8 @@
> > {
> > args[i++] = "-L";
> > args[i++] = label;
> > + args[i++] = "-L";
> > + args[i++] = label;
> > }
> >
> > args[i++] = from;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] diff label problems
Posted by Philip Martin <ph...@codematters.co.uk>.
Gustavo Niemeyer <ni...@conectiva.com> writes:
> This small patch fixes this behavior:
Looks good. Does it work with 2.8 GNU diff? I have 2.7 installed and
it works with that, but there are differences in the command line
between 2.7 and 2.8.
> * subversion/libsvn_subr/io.c
> (svn_io_run_diff): Repeat -L option, forcing usage of label for
> both files.
>
> Index: subversion/libsvn_subr/io.c
> ===================================================================
> --- subversion/libsvn_subr/io.c
> +++ subversion/libsvn_subr/io.c 2002-10-18 21:01:11.000000000 -0300
> @@ -1401,7 +1401,7 @@
> nargs += 1; /* -u */
>
> if (label != NULL)
> - nargs += 2; /* the -L and the label itself */
> + nargs += 4; /* the -L and the label itself, two times */
>
> args = apr_palloc (subpool, nargs * sizeof(char *));
>
> @@ -1421,6 +1421,8 @@
> {
> args[i++] = "-L";
> args[i++] = label;
> + args[i++] = "-L";
> + args[i++] = label;
> }
>
> args[i++] = from;
--
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org