Lobbying for -p1 diffs
Michael Ellerman
michael at ellerman.id.au
Thu Mar 2 05:53:40 GMT 2006
On 3/2/06, Martin Pool <mbp at sourcefrog.net> wrote:
> On 2 Mar 2006, Andrew Bennetts <andrew at canonical.com> wrote:
>
> > Defaulting to -p1 will make my life marginally harder. I do a lot of code
> > reviews of Launchpad code, based on the output of bzr diff. I regularly want to
> > copy-and-paste the paths from diffs into emails (to say "in foo/bar/baz.py, xyz
> > seems wrong.") and into my editor to open up files for more context than the
> > diffs show me.
> >
> > Prefixes like orig/ and mod/ make this a little bit inconvenient.
>
> And slightly more so if the prefixes aren't just that but change from
> one run to another (useful though that might be in other ways).
>
> Given Matthew's point about patch swallowing -p0 patches more easily
> than -p1, I propose that we keep the default behaviour the same but make
> say 'bzr diff -p' do that style.
Matthew has an old/whacky/not-like-mine version of patch. My patch
(v2.5.9, as shipped in Ubuntu Breezy) does not accept -p0 format diffs
unless the file is in the current directory. So there's no gain with
-p0 in terms of usability and a big loss in terms of compatibility
with other systems (git/hg) and convention (lkml).
cheers
concordia ~/test$ bzr dif
=== modified file 'foo/bar'
--- foo/bar
+++ foo/bar
@@ -1,2 +1,1 @@
hi
-there
concordia ~/test$ bzr dif | patch
can't find file to patch at input line 4
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|=== modified file 'foo/bar'
|--- foo/bar
|+++ foo/bar
--------------------------
File to patch:
concordia ~/test$ patch -version
patch 2.5.9
Copyright (C) 1988 Larry Wall
Copyright (C) 2003 Free Software Foundation, Inc.
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
written by Larry Wall and Paul Eggert
More information about the bazaar
mailing list