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

Re: paths in diff output (possible bug)

From: Daniel Shahaf <danielsh_at_elego.de>
Date: Tue, 20 Mar 2012 11:19:59 +0200

Dmitry Pavlenko wrote on Mon, Mar 19, 2012 at 21:54:58 +0100:
> Hello all.
> I'm trying to understand the principles how SVN calculates paths for diff.
>
> I've put repository attached under URL "http://localhost/svn". I'll put its history here:
> ------------------------------------------------------------------------
> r4 | dmit10 | 2012-03-19 20:34:31 +0100 (Пнд, 19 Мар 2012) | 2 lines
> Changed paths:
> A /directory/subdirectory/file1
> A /directory/subdirectory/file2
>
> files again
>
> ------------------------------------------------------------------------
> r3 | dmit10 | 2012-03-19 20:33:55 +0100 (Пнд, 19 Мар 2012) | 2 lines
> Changed paths:
> A /directory/subdirectory
>
> subdirectory
>
> ------------------------------------------------------------------------
> r2 | dmit10 | 2012-03-19 20:33:39 +0100 (Пнд, 19 Мар 2012) | 2 lines
> Changed paths:
> A /directory
>
> directory
>
> ------------------------------------------------------------------------
> r1 | dmit10 | 2012-03-19 20:33:27 +0100 (Пнд, 19 Мар 2012) | 2 lines
> Changed paths:
> A /file1
> A /file2
>
> files
>
> ------------------------------------------------------------------------
>
>
>
> Then I run:
>
> $ svn diff http://localhost/svn/directory/subdirectory@1
> http://localhost/svn/directory/subdirectory@4
>
> (note that neither "http://localhost/svn/directory/subdirectory" nor
> "http://localhost/svn/directory" exist in r1)
>
> And I get
>

I expected you'd get an "/directory/subdirectory_at_1 doesn't exist" error.

> Index: subdirectory/file1
> ===================================================================
> --- subdirectory/file1 (revision 0)
> +++ subdirectory/file1 (revision 4)
> @@ -0,0 +1 @@
> +file1
> Index: subdirectory/file2
> ===================================================================
> --- subdirectory/file2 (revision 0)
> +++ subdirectory/file2 (revision 4)
> @@ -0,0 +1 @@
> +file2-changed
>
>
> i.e. all paths are relative to "http://localhost/svn/directory" that
> is strange for me. I tried to debug the code. All editor calls are
> relative to that path too ("add_file subdirectory/file1").
>
> svn_ra_do_diff3 is called with ra_session pointing to
> "http://localhost/svn",
> url2="http://localhost/svn/directory/subdirectory" and
> target="directory/subdirectory" (that contradicts svn_ra_do_diff3
> documentation --- as I understand it --- stating, that states that
> "diff_target is an optional single path component").
>

"Single path component" means to me "does not contain slashes".

> So I have some "yes-no" questions about that all:
> 1. Do I understand correctly that "target" parameter in
> svn_ra_do_diff3 should never contain '/'?

+1

> 2. Is current diff output really expected (I'm about the paths, the
> files' content is correct) or is there a bug?

Latter IMO, the first target doesn't exist so I'd expect an error.

> 3. Is there any guarantee (suppose, all bugs are fixed if exist) about
> paths in diff output --- relative to what are they (expected to be)?
> As I understand, SVN wants to show them relative to the first ancestor
> of arguments
> which exists in both revisions (in my example --- relative to
> "http://localhost/svn" because "http://localhost/svn/directory" and
> "http://localhost/svn/directory/subdirectory" do not exist in r1).
> Please, confirm or disprove. If
> there's no guarantee, and it is just human-readable, it's ok too, but
> I would like to know.

I odn't know if we make a guarantee, but if we don't we should.

I'd expect paths in the output to be relative to the targets.

>
> Thanks.
Received on 2012-03-20 10:20:42 CET

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