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

svn diff -p1 ?

From: Alexey Dobriyan <adobriyan_at_mail.ru>
Date: 2004-07-31 00:39:04 CEST

This email is the result of my experience of using Subversion for Linux kernel

The problem is that "svn diff" generate "-p0" patches:

--- Makefile
+++ Makefile

However, Linux kernel developers now work with "-p1" patches:

--- linux-2.6.8-rc2/Makefile
+++ linux-2.6.8-rc2-mm1/Makefile

I know that

a) at least one person sent Subversion generated patches to a Linux kernel
   related mailing list and
b) was asked to resubmit them just because of their "-p0" nature.

Myself imported Linux kernel tree, started making changes, but do not sent
'svn diff' patches because:

a) they are "-p0"
b) I'm lazy to write a script to make them "-p1". :)

Possible solutions:

0. Make Subversion generate "-p1" patches always.
   (horrible, my first thought, just for complete picture)

   Two-liner to subversion/libsvn_diff/diff_file.c
- "--- %s" APR_EOL_STR
- "+++ %s" APR_EOL_STR,
+ "--- a/%s" APR_EOL_STR
+ "+++ b/%s" APR_EOL_STR,

1. svn diff -p1 (but not p2, p3, ...)
   (I think is optimal)

   svn_diff_file_output_unified() gets new parameter -
   'unsigned int patch_level'. 0 means "-p0" patches , 1 means "-p1" ones.

   Logic of svn_diff_file_output_unified() becomes
        if (patch_level) {
                printf("--- a/"); ...
                printf("+++ b/"); ...
        } else {
                printf("--- "); ...
                printf("+++ "); ...

   svn_diff_file_output_unified(...) becomes
   svn_diff_file_output_unified(... , 0); to not break other people.

   Next step: get "-p1" option from command line, propagate patch_level down.
   Smells like API change for me. Comments on this are extremely welcome.

   I do not know a project which demands -p2 and greater levels. If there is
   one go to #2. :)

2. svn diff -pN

   Everything like in #1 with an obvious change in output.

So, people, what do you think?


To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jul 31 00:39:34 2004

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.