[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Unified context diff...(2) WAS: RE: svn commit: rev 1802 - trunk/subversion/libsvn_delta

From: Kirby C. Bohling <kbohling_at_birddog.com>
Date: 2002-04-29 20:24:28 CEST

Philip Martin wrote:
> "Sander Striker" <striker@apache.org> writes:
>
>
>>I think I have nailed all edge cases now, but it would be nice to be
>>sure. Please people, test the crap out of this! :)
>>
>
> Well, it would be easier with a test suite :-) No point testing the
> stuff you have already tested. However
>
> $ cat zz1
> 999
> 999
> 999
> 999
> 999
> 0
> 1
> 2
> 2
> 1
> 999
> 999
> 999
> $ cat zz2
> 999
> 999
> 999
> 999
> 999
> 0
> 4
> 4
> 0
> 4
> 999
> 999
> 999
> $ ./diff-svn zz1 zz2
> --- zz1 Mon Apr 29 18:35:22 2002
> +++ zz2 Mon Apr 29 18:35:28 2002
> @@ -1,13 +1,13 @@
> 999
> 999
> 999
> 999
> 999
> 0
> -1
> -2
> -2
> -1
> +4
> +4
> +0
> +4
> 999
> 999
> 999
> $ diff -u zz1 zz2
> --- zz1 Mon Apr 29 18:35:22 2002
> +++ zz2 Mon Apr 29 18:35:28 2002
> @@ -4,10 +4,10 @@
> 999
> 999
> 0
> -1
> -2
> -2
> -1
> +4
> +4
> +0
> +4
> 999
> 999
> 999
>
> svn generates too much leading context.
>
>

Uhhh, that is a feature, not a bug IMHO. One of the things I have to
work around in CVS, is I can't tell it when merging I want you to use
8-10 lines of context. (Okay so now I will probably have 10 people tell
me how I could have done it, which I would very very much appreciate if
they did).

Essentially, I have a ton of database code that all looks like this:

void functionName( arg, arg, arg )
{
        Result result;
        Query query;
        Connection connection
        Arguments arg;

        /* Now put code here.*/
}

void functionName2( arg, arg, arg )
{
        Result result;
        Query query;
        Connection connection;
        Arguments arg;

        /* Put code here*/
}

I have one file with probably 50 of these functions that have the same
four lines of declarations in the same order named exactly the same way.
   Well because the context is so very small I will get conflict from
every function in the file after a small change. At 3-4 lines, I always
match on those for variable declarations. So if I add a function in the
middle of the list (near the related functions). Essentially if you add
a functionName3 between the two, it woud say you removed functionName2
and replaced it with functionName3 then add functionName2 down below.

        If you made a change in functionName2 it was much, much harder to spot
because the context diff matched on the 3-4 lines of context for that
file on the 4 idential variable declarations. So the new version of
functionName2 and the old version of functionName2 never got compared.
The old version of functionName2 go compared with the new version of
function3. Not very useful, as they are completely unrelated. So I
would manually examine the diff looking for changes in functionName2.

        When doing repeated merging to and from a branch I had outstanding for 8
months it was very difficult. Ever single line of the file had to be
examined during merge conflicts. Which was really annoying because the
this was the only file I was modifying significantly in the branch. In
the end, I found it easier to take the diff's using cvs diff where I
could pass it all the goofy parameters I wanted for context and then use
patch to apply it with fewer, smaller and simpler conflicts. I was
perfactly happy to wait for it to use more context, and was willing to
deal with lots of small changes close together where there wouldn't be
5-8 lines of context I used. Generally those didn't cross function
boundaries which made life much easier.

        So maybe I should state that more directly. Would it be possible to have
anything that does a diff be able to take parameters to pass to the diff
utility/library? I would very much like to have finer control over the
diff parameters on certain occasions rather then doing svn/cvs diff
followed by a manual patch. Especially because svn does a much better
job of merge history then CVS ever did.

        Thanks,
                Kirby

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Apr 29 20:30:32 2002

This is an archived mail posted to the Subversion Dev mailing list.