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

Re: [PATCH] make diff against copy-source by default

From: Prabhu Gnana Sundar <prabhugs_at_collab.net>
Date: Thu, 06 Jan 2011 16:25:57 +0530

Hi Julian,

On Wed, 2011-01-05 at 11:41 +0000, Julian Foad wrote:
> On Thu, 2010-12-30, Prabhu Gnana Sundar wrote:
> [...]
>
> I like this change, in principle.
>

Thank you :)

> For example, maybe some tables
> something like this would be a good way to summarize the changes:
>
> Type of diff shown BEFORE this patch, WITHOUT --show-copies-as-adds:
> +-------------------+---------------+----------------------+-----------+
> | | copied only | copied and modified | ... |
> +-------------------+---------------+----------------------+-----------+
> | | | | |
> | WC-WC diff | | | |
> | | | | |
> | WC-repo diff | | | |
> | | | | |
> | repo-repo diff | | | |
> | | | | |
> +-------------------+---------------+----------------------+-----------+
> Or whatever rows and columns best convey the information.

I made a tabular summary of the change that this patch would make.
Since it displayed weirdly in the mail body I have attached it as a
file(diff-explanation-table.txt) with this mail.

I have also attached the experiment carried out, in another
file(diff-explanation.txt), with this mail.

Please let me know if I am not clear at any point.

>
> Are there any differences with different (old) versions of Subversion
> server? (I seem to recall that copy-from data was not always supplied,
> but I am not sure of the details.)
>

Actually, the send_copyfrom_args was passed even without this patch, but
was not handled. Only for 'svnserve' this was newly introduced by this
patch. So I don't think there's something to worry.

> Isn't it a layering violation for libsvn_wc to know about libsvn_ra?
> Maybe this needs to use callbacks or something, so that all the RA
> knowledge remains in libsvn_client.
>

What you say is correct. :)
But since we need to access a file which is not in our text-base. I had
to get the ra_session to make use of the repository to fetch the file.

Anyway now I am working on this to make use of any function in
libsvn_client that would get me an ra_session. But that seems to me like
a costly work.

Thanks and regards
Prabhu

$ svnadmin create diffrepo

$ svn co file:///tmp/diffrepo diffwc
Checked out revision 0.

$ cd diffwc/

$ vi file1

$ svn add file1
A file1

$ svn ci -m "adding new file"
Adding file1
Transmitting file data .
Committed revision 1.

$ svn cp file1 copiedfile1
A copiedfile1

$ svn ci -m "copied file1 to copiedfile1"
Adding copiedfile1

Committed revision 2.

Copy only:
------------

$ svn up
Updating '.' ...
At revision 2.

(with patch)
$ svn diff -r2:1
Index: copiedfile1
===================================================================
--- copiedfile1 (revision 2)
+++ copiedfile1 (revision 1)
@@ -1,5 +0,0 @@
-1
-2
-3
-4
-5

(without patch)
$ svn diff -r2:1
Index: copiedfile1
===================================================================
--- copiedfile1 (revision 2)
+++ copiedfile1 (revision 1)
@@ -1,5 +0,0 @@
-1
-2
-3
-4
-5

(with patch)
$ svn diff -r2:1 --sca
Index: copiedfile1
===================================================================
--- copiedfile1 (revision 2)
+++ copiedfile1 (revision 1)
@@ -1,5 +0,0 @@
-1
-2
-3
-4
-5

(without patch)
$ svn diff -r2:1 --sca
Index: copiedfile1
===================================================================
--- copiedfile1 (revision 2)
+++ copiedfile1 (revision 1)
@@ -1,5 +0,0 @@
-1
-2
-3
-4
-5

(with patch)
$ svn diff -rBASE:1
Index: copiedfile1
===================================================================
--- copiedfile1 (working copy)
+++ copiedfile1 (revision 1)
@@ -1,5 +0,0 @@
-1
-2
-3
-4
-5

(without patch)
$ svn diff -rBASE:1
Index: copiedfile1
===================================================================
--- copiedfile1 (working copy)
+++ copiedfile1 (revision 1)
@@ -1,5 +0,0 @@
-1
-2
-3
-4
-5

(with patch)
$ svn diff -rBASE:1 --sca
Index: copiedfile1
===================================================================
--- copiedfile1 (working copy)
+++ copiedfile1 (revision 1)
@@ -1,5 +0,0 @@
-1
-2
-3
-4
-5

(without patch)
$ svn diff -rBASE:1 --sca
Index: copiedfile1
===================================================================
--- copiedfile1 (working copy)
+++ copiedfile1 (revision 1)
@@ -1,5 +0,0 @@
-1
-2
-3
-4
-5

$ svn cp file1 copiedfile2
A copiedfile2

(with patch)
$ svn diff

(without patch)
$ svn diff

(with patch)
$ svn diff --sca
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 0)
+++ copiedfile2 (working copy)
@@ -0,0 +1,5 @@
+1
+2
+3
+4
+5

(without patch)
$ svn diff --sca
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 0)
+++ copiedfile2 (working copy)
@@ -0,0 +1,5 @@
+1
+2
+3
+4
+5

copied and modified:
----------------------
$ vi copiedfile2

(with patch)
$ svn diff
Index: copiedfile2
===================================================================
--- copiedfile2 (working copy)
+++ copiedfile2 (working copy)
@@ -3,3 +3,6 @@
 3
 4
 5
+6
+7
+8

(without patch)
prabhugs_at_arwin-desktop:/tmp/diffwc$ ~/binaries/trunkbin/bin/svn diff
Index: copiedfile2
===================================================================
--- copiedfile2 (working copy)
+++ copiedfile2 (working copy)
@@ -3,3 +3,6 @@
 3
 4
 5
+6
+7
+8

(with patch)
$ svn diff --sca
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 0)
+++ copiedfile2 (working copy)
@@ -0,0 +1,8 @@
+1
+2
+3
+4
+5
+6
+7
+8

(without patch)
$ svn diff --sca
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 0)
+++ copiedfile2 (working copy)
@@ -0,0 +1,8 @@
+1
+2
+3
+4
+5
+6
+7
+8

$ svn ci -m "copied and modified"
Adding copiedfile2
Transmitting file data .
Committed revision 3.

$ svn up -r2
Updating '.' ...
D copiedfile2
Updated to revision 2.

(with patch)
$ svn diff -rBASE:3
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 2)
+++ copiedfile2 (revision 3)
@@ -3,3 +3,6 @@
 3
 4
 5
+6
+7
+8

(without patch)
$ svn diff -rBASE:3
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 0)
+++ copiedfile2 (revision 3)
@@ -0,0 +1,8 @@
+1
+2
+3
+4
+5
+6
+7
+8

(with patch)
$ svn diff -rBASE:3 --sca
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 0)
+++ copiedfile2 (revision 3)
@@ -0,0 +1,8 @@
+1
+2
+3
+4
+5
+6
+7
+8

(without patch)
$ svn diff -rBASE:3 --sca
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 0)
+++ copiedfile2 (revision 3)
@@ -0,0 +1,8 @@
+1
+2
+3
+4
+5
+6
+7
+8

(with patch)
$ svn diff -r2:3
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 2)
+++ copiedfile2 (revision 3)
@@ -3,3 +3,6 @@
 3
 4
 5
+6
+7
+8

(without patch)
$ svn diff -r2:3
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 0)
+++ copiedfile2 (revision 3)
@@ -0,0 +1,8 @@
+1
+2
+3
+4
+5
+6
+7
+8

(with patch)
$ svn diff -r2:3 --sca
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 0)
+++ copiedfile2 (revision 3)
@@ -0,0 +1,8 @@
+1
+2
+3
+4
+5
+6
+7
+8

(without patch)
$ svn diff -r2:3 --sca
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 0)
+++ copiedfile2 (revision 3)
@@ -0,0 +1,8 @@
+1
+2
+3
+4
+5
+6
+7
+8

                                        --------------------------------------------------
                                        | WC - WC | REPOS - WC | REPOS - REPOS |
 |---------+------------+---------------+------------+---------------+-------------------+
 | | | | | | |
 | | | only diff | N/A | B | A |
 | | BEFORE |---------------+------------+---------------+-------------------+
 | | | | | | |
 | | | with '--sca' | C | B | A |
 |COPIED +------------+---------------+------------+---------------+-------------------+
 | | | | | | |
 | | | only diff | N/A | B | A |
 | | AFTER |---------------+------------+---------------+-------------------+
 | | | | | | |
 | | | with '--sca' | C | B | A |
 +---------+------------+---------------+------------+---------------+-------------------+
 +---------+------------+---------------+------------+---------------+-------------------+
 | | | | | | |
 | | | only diff | D | G | G |
 | | BEFORE |---------------+------------+---------------+-------------------+
 | | | | | | |
 | | | with '--sca' | E | G | G |
 |COPIED +------------+---------------+------------+---------------+-------------------+
 | & | | | | | |
 |MODIFIED | | only diff | D | F | F |
 | | AFTER |---------------+------------+---------------+-------------------+
 | | | | | | |
 | | | with '--sca' | E | G | G |
 +---------+------------+---------------+------------+---------------+-------------------+

---------
Legends:
---------

A)
Index: copiedfile1
===================================================================
--- copiedfile1 (revision 2)
+++ copiedfile1 (revision 1)
@@ -1,5 +0,0 @@
-1
-2
-3
-4
-5

B)
Index: copiedfile1
===================================================================
--- copiedfile1 (working copy)
+++ copiedfile1 (revision 1)
@@ -1,5 +0,0 @@
-1
-2
-3
-4
-5

C)
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 0)
+++ copiedfile2 (working copy)
@@ -0,0 +1,5 @@
+1
+2
+3
+4
+5

D)
Index: copiedfile2
===================================================================
--- copiedfile2 (working copy)
+++ copiedfile2 (working copy)
@@ -3,3 +3,6 @@
 3
 4
 5
+6
+7
+8

E)
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 0)
+++ copiedfile2 (working copy)
@@ -0,0 +1,8 @@
+1
+2
+3
+4
+5
+6
+7
+8

F)
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 2)
+++ copiedfile2 (revision 3)
@@ -3,3 +3,6 @@
 3
 4
 5
+6
+7
+8

G)
Index: copiedfile2
===================================================================
--- copiedfile2 (revision 0)
+++ copiedfile2 (revision 3)
@@ -0,0 +1,8 @@
+1
+2
+3
+4
+5
+6
+7
+8
Received on 2011-01-06 12:05:28 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.