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

Re: [PATCH]: Change sort order for 'svn diff'

From: Kean Johnston <jkj_at_sco.com>
Date: 2005-11-20 05:07:37 CET

> For this particular patch, I need to ask: what kinds of diffs does it
> guarantee to be in order? From a quick look, I'd guess BASE-to-working
> diffs in a WC, and repos-to-repos diffs, but not repos-to-WC diffs. Do
> you think that is correct? (I haven't tried it.)

Yes and no. In clients/cmdline/svn, no matter what form of
diff you request, you end up calling one of two functions: either
svn_client_diff_peg3() or svn_client_diff3(). The former ends up
calling do_diff_peg() and the latter ends up calling do_diff().
Both of those will call one of diff_repos_repos(), diff_repos_wc(),
or diff_wc_wc().

diff_wc_wc() calls svn_wc_diff3(), which ends up calling
directory_elements_diff(), which was one of the functions I changed
to adjust the sort order.

diff_repos_repos() and diff_repos_wc() call svn_ra_do_diff2() or
svn_ra_do_diff(), which call the do_diff "virtual" function, which
I believe gets us back to the same place as described for do_diff()
above.

With my patches, and a small local repository I created just for
testing, here's what I did. In all cases the output was from the
`COMMAND | grep ^Index:`. The desired order is:
   Index: parser.y
   Index: uidgid.c
   Index: xfuncs.c
   Index: cdmt/finalpkg.c
   Index: cdmt/finalprd.c
   Index: pkgadd/finalpkg.c
   Index: pkgadd/finalprd.c
   Index: pkgadd/produce.c

COMMAND: svn diff (Base-to-wc diff case)
Pre-patch output:
   Index: uidgid.c
   Index: pkgadd/finalprd.c
   Index: pkgadd/produce.c
   Index: pkgadd/finalpkg.c
   Index: parser.y
   Index: xfuncs.c
   Index: cdmt/finalprd.c
   Index: cdmt/finalpkg.c
Post-patch output:
   (As expected above)

COMMAND: svn diff file:///u1/repo/trunk_at_2 file:///u1/repo/trunk_at_3
   (repos-to-repos case):
Pre-patch output:
   Index: uidgid.c
   Index: pkgadd/finalprd.c
   Index: pkgadd/produce.c
   Index: pkgadd/finalpkg.c
   Index: parser.y
   Index: cdmt/finalprd.c
   Index: cdmt/finalpkg.c
   Index: xfuncs.c
Post-patch output:
   (As expected above)

COMMAND: svn diff -r 2 (repos-to-wc diff case)
Pre-patch output:
   Index: cdmt/finalprd.c
   Index: cdmt/finalpkg.c
   Index: uidgid.c
   Index: pkgadd/finalprd.c
   Index: pkgadd/produce.c
   Index: pkgadd/finalpkg.c
   Index: parser.y
   Index: xfuncs.c
Post-patch output:
   Index: cdmt/finalpkg.c
   Index: cdmt/finalprd.c
   Index: parser.y
   Index: uidgid.c
   Index: xfuncs.c
   Index: pkgadd/finalpkg.c
   Index: pkgadd/finalprd.c
   Index: pkgadd/produce.c

So the repos-to-wc case is clearly being sorted, but it is not
sorting based on node type first. The levels of indirection
make my head hurt, so I dont know why this is the case. I will
start looking in to it but if someone could offer some insight
that will save me time, I would dearly appreciate it.

Kean

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Nov 20 05:08:59 2005

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