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

svn needs a patch subcommand (Was svn ci/up --xml-file)

From: Mo DeJong <supermo_at_bayarea.net>
Date: 2001-09-14 22:29:18 CEST

On Fri, 14 Sep 2001 15:16:36 -0400
Kevin Pilch-Bisson <kevin@pilch-bisson.net> wrote:

> Hey All,
>
> We were talking the other day about patch files that supported properties,
> and it was suggested that our xml-file format could be used to accomplish
> this.
>
> I was thinking about this, and had a couple of thoughts/questions.
>
> For generating patch files, we could use 'svn ci --xml-file patch.xml'. This
> would generate an xml output file as normal, except that it would use:
> 1) gnu diff for textdeltas (if text, svndiff if binary).
> 2) textdeltas would be inline instead of post-fix (for easier reading).
>
> I think the easiest way to do this would be to add an 'apply_patch' file to
> our editor vtables, and a 'type="gnu/svn"' attribute to the text-delta
> tag.
>
> The reason for this is that it would be extremely convoluted to generate a
> diff from our existing text-deltas.
>
> svn up could then read one of these files, and patch the wc accordingly. The
> required change would be to all a revision of SVN_INVALID_REVNUM, indicating
> that update should not modify and revision numbers.
>
> In addition, a straight patch -p0 < patch.xml should work as well (obviously,
> only changing text files not props or binary files).
>
> What do people think of this idea?

These are some really interesting ideas. The one thing that jumps out at me
is that we should NOT depend on an external patch program. Why should
subversion provide the ability to generate deltas but not integrate them
back into a WC? A really common complaint from Windows users is
"I installed CVS, but I don't have this patch program you mentioned".
Windows users then have a fit when you tell them to go install Cygwin
in order to get the patch program. And don't even get me started on
that lame -p 0 < patch business.

I think it is critical that subversion provide a means to integrate patches.
While plain text patches are important, there are things that plain
old patches can't do. For example, lets say you rename a directory
from foo to bar, add a new file, and then generate a patch.

% echo "Hi Mom" > msg
% svn add msg
% svn rename foo bar
% svn diff > add_rename.patch

It might look something like:

% cat add_rename.patch
Index: msg
===================================================================
--- SVN/text-base/msg Fri Sep 14 13:20:32 2001
+++ msg Fri Sep 14 13:20:23 2001
@@ -0,0 +1 @@
+Hi Mom
svn add msg
svn rename foo bar

You could then post this patch to a mailing list and someone could apply it like so:

% svn patch add_rename.patch
% svn commit

Plain old patches are not going to give us this sort of functionality and ease of use.
I have seen some folks mention adding this with special flags to the update or
commit subcommands. Lets please try to avoid that. It just reminds me of
`cvs update -j REV -j REV` to do a branch merge. That kind of piggybacking
of unrelated operations makes CVS hard to learn.

cheers
Mo DeJong

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:41 2006

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