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

Re: [PATCH] enhance svn diff by adding --diff-copy-from switch

From: Prabhu Gnana Sundar <prabhugs_at_collab.net>
Date: Thu, 16 Dec 2010 19:21:09 +0530

Thanks Gavin :)

I am aware of it. I have been working in a different approach to solve
the same problem.
 Since I felt that my current approach would make the "diff" to have a
uniform behaviour throughout, without the "--diff-copy-from" switch, I
did not ping this thread. Hoping to get back to solve this problem in a
much better new patch :)

Thanks and regards
Prabhu

On Thu, 2010-12-16 at 23:46 +1100, Gavin Beau Baumanis wrote:
> Ping. This patch has received no more comments.
>
> Gavin "Beau" Baumanis
>
>
>
> On 30/11/2010, at 12:35 AM, Prabhu Gnana Sundar wrote:
>
> > Hi Julian,
> >
> > $ svn diff -r1029227:1029240 subversion/tests/libsvn_wc/utils.h
> >
> > The above command would work fine since the "full" target is given
> > explicitly and because of the *continuity of history*.
> >
> > What if the file has been removed or renamed (which can occur often)..
> > In such cases, the normal "svn diff" shows the entire content as
> > deletion or addition, whereas with the "diff-copy-from" switch, the "svn
> > diff" would show a more granular output with only the injected
> > modifications(along with copy commit) that were done.
> >
> >
> >
> > On Mon, 2010-11-29 at 11:09 +0000, Julian Foad wrote:
> >> On Sun, 2010-11-28, Prabhu Gnana Sundar Ponnarasu wrote:
> >>> [[[
> >>> Make svn diff to accept "--diff-copy-from" inorder to compare/diff
> >>> against the copy-source file.
> >>
> >> Hi Prabhu.
> >>
> >> I'm not clear about the precise change in behaviour that you are making.
> >> The current behaviour of "svn diff" seems to be to show the difference
> >> against the copy source in some cases, but not in other cases:
> >
> > the cases where it does *not* work is listed below,
> >
> > * where the file has been renamed or reinstated
> > * where we may *not* be explicitly giving the full target (but only upto
> > the root path).
> >
> > The "diff-copy-from" switch bridges the gap in the history of the file.
> >
> >
> > To address this difference between diff behaviour,
> >
> > * we can either make current default behaviour to give diff always as
> > 'all adds and all deletes".
> >
> > * Make diff-copy-from the default *implicit* behaviour by removing the
> > diff-copy-from option from my patch and retain rest.
> >
> >>
> >> [[[
> >> $ svn log -vq -c1029240
> >> [...]
> >> A /subversion/trunk/subversion/tests/libsvn_wc/utils.h (from /subversion/trunk/subversion/tests/svn_test_utils.h:1029227)
> >>
> >> $ svn diff -r1029227:1029240 subversion/tests/libsvn_wc/utils.h
> >> Index: subversion/tests/libsvn_wc/svn_test_utils.h
> >> ===================================================================
> >> --- subversion/tests/libsvn_wc/svn_test_utils.h (.../svn_test_utils.h) (revision 1029227)
> >> +++ subversion/tests/libsvn_wc/svn_test_utils.h (.../libsvn_wc/utils.h) (revision 1029240)
> >> @@ -1,7 +1,7 @@
> >> -/* svn_test_utils.h --- test utilities
> >> +/* utils.h --- wc/client test utilities
> >> [...]
> >>
> >> $ svn diff -r1029227:1029240 subversion/tests/
> >> Index: subversion/tests/svn_test_utils.h
> >> ===================================================================
> >> --- subversion/tests/svn_test_utils.h (revision 1029227)
> >> +++ subversion/tests/svn_test_utils.h (revision 1029240)
> >> @@ -1,64 +0,0 @@
> >> -/* svn_test_utils.h --- test utilities
> >> [...]
> >> Index: subversion/tests/libsvn_wc/utils.h
> >> ===================================================================
> >> --- subversion/tests/libsvn_wc/utils.h (revision 0)
> >> +++ subversion/tests/libsvn_wc/utils.h (revision 1029240)
> >> @@ -0,0 +1,64 @@
> >> +/* utils.h --- wc/client test utilities
> >> [...]
> >> ]]]
> >>
> >> The current doc strings do not appear to describe this. I think it is
> >> important that we clarify what the current behaviour is - in other
> >> words, what the new behaviour will be when --diff-copy-from is not
> >> present or when diff_copy_from = FALSE. Can you help by describing
> >> that?
> >>
> >
> > By default the diff_copy_from is FALSE, so the absence of
> > --diff-copy-from would give the normal "svn diff".
> > See if the below explanation makes the intention clear...
> > $ vi file1
> > $ svn add file1
> > A file1
> > $ svn ci -m "added file1"
> > Adding file1
> > Transmitting file data .
> > Committed revision 1.
> >
> > $ svn up
> > At revision 1.
> >
> > $ svn rm file1
> > D file1
> > $ svn ci -m "removed file1"
> > Deleting file1
> >
> > Committed revision 2.
> >
> > $ svn cp file:///tmp/testrepo/file1_at_1 file2
> > A file2
> > $ svn ci -m "coped file1"
> > $ vi file2
> > $ svn ci -m "copied and modified file2"
> > Adding file2
> > Transmitting file data .
> > Committed revision 3.
> >
> > $ svn up
> > At revision 3.
> >
> > $ svn diff -c3
> > Index: file2
> > ===================================================================
> > --- file2 (revision 0)
> > +++ file2 (revision 3)
> > @@ -0,0 +1,8 @@
> > +1
> > +2
> > +3
> > +4
> > +5
> > +6
> > +7
> > +8
> >
> > $ svn diff -c3 --diff-copy-from
> > Index: file2
> > ===================================================================
> > --- file2 (revision 2)
> > +++ file2 (revision 3)
> > @@ -3,3 +3,6 @@
> > 3
> > 4
> > 5
> > +6
> > +7
> > +8
> >> Do we have a way to request the opposite behaviour - to show a diff in
> >> which a copy is *never* diffed against its source? Is that what the
> >> "--show-copies-as-adds" option and show_copies_as_adds API flag does?
> >> If so, then the doc strings need to mention how these two relate: for
> >> example, are they mutually exclusive or does one override the other?
> >>
> >>
> >> [...]
> >>> Index: subversion/svn/main.c
> >>> ===================================================================
> >>> + {"diff-copy-from", opt_diff_copy_from, 0,
> >>> + N_("print copy history of files")},
> >>
> >
> > Sure to change this :) Stefan too had a good suggestion...
> >
> >
> > Thanks and regards
> > Prabhu
> >
> >
>
Received on 2010-12-16 14:58:17 CET

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.