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

Re: help creating a patch

From: B. Smith-Mannschott <bsmith.occs_at_gmail.com>
Date: Tue, 21 Apr 2009 17:22:08 +0200

On Tue, Apr 21, 2009 at 07:30, Craig <supkichen_at_gmail.com> wrote:
> Hi all,
> I was trying to create a patch to send to someone the other day, and
> ran into an interesting problem. I had "svn mv"ed a file, and changed
> a few others, then used TortoiseSVN to create the patch. All of the
> changes were included in the patch except the newly added file
> resulting from the move. The end result is that the patch did not
> represent all of the changes in the working copy, and hence was not
> very useful. The same thing happened with "svn diff".
> Any ideas?

A patch can't represent moves. The best it could do is representing
deletion of all lines from the file under its old name long with
insertion of all lines into the file under its new name.

$ cp design.txt added.txt
$ svn add added.txt
A added.txt
$ svn cp design.txt copied.txt
A copied.txt
$ svn mv design.txt moved.txt
A moved.txt
D design.txt

When I svn mv a file, diff on the *uncommitted* working copy shows the
deletion of the fille (well, it's contents) under the old name (this
can be turned off with the option --no-diff-deleted), but does not
show creation of the file under its new name (and I find no option to
turn this on).

If I *commit* the local changes first and then ask for a diff of that
change, then all the changes show up. (but applying this as a patch to
a working copy would lose the historical connection between design.txt
and moved.txt.)

$ svn ci -m "moves, adds, and deletes"
Adding docs/added.txt
Adding docs/copied.txt
Deleting docs/design.txt
Adding docs/moved.txt
Transmitting file data .
Committed revision 215.

$ svn diff -c215 | diffstat
 added.txt | 20 ++++++++++++++++++++
 copied.txt | 20 ++++++++++++++++++++
 design.txt | 20 --------------------
 moved.txt | 20 ++++++++++++++++++++

So to summarize:
You're right, svn diff is a little strange.
However, it still couldn't accurately represent svn mv and svn cp even
if it wasn't "strange".

// ben


To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-04-21 17:32:44 CEST

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