Merge lp:~jelmer/brz/diff-default-p1 into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/diff-default-p1
Merge into: lp:brz
Diff against target: 101 lines (+19/-14)
3 files modified
breezy/builtins.py (+5/-5)
breezy/tests/blackbox/test_diff.py (+11/-9)
doc/en/release-notes/brz-3.0.txt (+3/-0)
To merge this branch: bzr merge lp:~jelmer/brz/diff-default-p1
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+325023@code.launchpad.net

Commit message

Make 'bzr diff' default to -p1 rather than -p0.

Description of the change

Make 'bzr diff' default to -p1 rather than -p0.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

I approve, and disbelieve that the damage is limited to these few tests.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/builtins.py'
--- breezy/builtins.py 2017-05-30 22:59:36 +0000
+++ breezy/builtins.py 2017-06-02 20:54:42 +0000
@@ -2297,9 +2297,9 @@
2297 Same as 'brz diff' but prefix paths with old/ and new/::2297 Same as 'brz diff' but prefix paths with old/ and new/::
22982298
2299 brz diff --prefix old/:new/2299 brz diff --prefix old/:new/
2300 2300
2301 Show the differences using a custom diff program with options::2301 Show the differences using a custom diff program with options::
2302 2302
2303 brz diff --using /usr/bin/diff --diff-options -wu2303 brz diff --using /usr/bin/diff --diff-options -wu
2304 """2304 """
2305 _see_also = ['status']2305 _see_also = ['status']
@@ -2340,16 +2340,16 @@
23402340
2341 @display_command2341 @display_command
2342 def run(self, revision=None, file_list=None, diff_options=None,2342 def run(self, revision=None, file_list=None, diff_options=None,
2343 prefix=None, old=None, new=None, using=None, format=None, 2343 prefix=None, old=None, new=None, using=None, format=None,
2344 context=None):2344 context=None):
2345 from .diff import (get_trees_and_branches_to_diff_locked,2345 from .diff import (get_trees_and_branches_to_diff_locked,
2346 show_diff_trees)2346 show_diff_trees)
23472347
2348 if (prefix is None) or (prefix == '0'):2348 if prefix == '0':
2349 # diff -p0 format2349 # diff -p0 format
2350 old_label = ''2350 old_label = ''
2351 new_label = ''2351 new_label = ''
2352 elif prefix == '1':2352 elif prefix == '1' or prefix is None:
2353 old_label = 'old/'2353 old_label = 'old/'
2354 new_label = 'new/'2354 new_label = 'new/'
2355 elif ':' in prefix:2355 elif ':' in prefix:
23562356
=== modified file 'breezy/tests/blackbox/test_diff.py'
--- breezy/tests/blackbox/test_diff.py 2017-05-21 18:10:28 +0000
+++ breezy/tests/blackbox/test_diff.py 2017-06-02 20:54:42 +0000
@@ -184,8 +184,8 @@
184 out, err = self.run_bzr(cmd, retcode=1)184 out, err = self.run_bzr(cmd, retcode=1)
185 self.assertEqual('', err)185 self.assertEqual('', err)
186 self.assertEqual("=== modified file 'file'\n"186 self.assertEqual("=== modified file 'file'\n"
187 "--- file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"187 "--- old/file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"
188 "+++ file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"188 "+++ new/file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"
189 "@@ -1,1 +1,1 @@\n"189 "@@ -1,1 +1,1 @@\n"
190 "-new content\n"190 "-new content\n"
191 "+contents of branch1/file\n"191 "+contents of branch1/file\n"
@@ -196,8 +196,8 @@
196 out, err = self.run_bzr(cmd, retcode=1)196 out, err = self.run_bzr(cmd, retcode=1)
197 self.assertEqual('', err)197 self.assertEqual('', err)
198 self.assertEqualDiff("=== modified file 'file'\n"198 self.assertEqualDiff("=== modified file 'file'\n"
199 "--- file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"199 "--- old/file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"
200 "+++ file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"200 "+++ new/file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"
201 "@@ -1,1 +1,1 @@\n"201 "@@ -1,1 +1,1 @@\n"
202 "-contents of branch1/file\n"202 "-contents of branch1/file\n"
203 "+new content\n"203 "+new content\n"
@@ -261,8 +261,8 @@
261 retcode=1)261 retcode=1)
262 self.assertEqual('', err)262 self.assertEqual('', err)
263 self.assertEqualDiff("=== modified file 'file'\n"263 self.assertEqualDiff("=== modified file 'file'\n"
264 "--- file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"264 "--- old/file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"
265 "+++ file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"265 "+++ new/file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"
266 "@@ -1,1 +1,1 @@\n"266 "@@ -1,1 +1,1 @@\n"
267 "-new content\n"267 "-new content\n"
268 "+contents of branch1/file\n"268 "+contents of branch1/file\n"
@@ -397,9 +397,11 @@
397 self.assertEqual('', err)397 self.assertEqual('', err)
398 # We have to skip the stuff in the middle, because it depends398 # We have to skip the stuff in the middle, because it depends
399 # on time.time()399 # on time.time()
400 self.assertStartsWith(out, "=== added file 'goodbye'\n"400 self.assertStartsWith(
401 "--- goodbye\t1970-01-01 00:00:00 +0000\n"401 out,
402 "+++ goodbye\t")402 "=== added file 'goodbye'\n"
403 "--- old/goodbye\t1970-01-01 00:00:00 +0000\n"
404 "+++ new/goodbye\t")
403 self.assertEndsWith(out, "\n@@ -0,0 +1 @@\n"405 self.assertEndsWith(out, "\n@@ -0,0 +1 @@\n"
404 "+baz\n\n")406 "+baz\n\n")
405407
406408
=== modified file 'doc/en/release-notes/brz-3.0.txt'
--- doc/en/release-notes/brz-3.0.txt 2017-06-02 11:26:27 +0000
+++ doc/en/release-notes/brz-3.0.txt 2017-06-02 20:54:42 +0000
@@ -22,6 +22,9 @@
22 clashes with upstream Bazaar.22 clashes with upstream Bazaar.
23 (Martin Packman, Jelmer Vernooij)23 (Martin Packman, Jelmer Vernooij)
2424
25 * The --prefix/-p argument for ``bzr diff`` now defaults to -p1 rather
26 than -p0. (Jelmer Vernooij, #1695126)
27
25 * The ``brz register-branch`` command from the Launchpad plugin has been28 * The ``brz register-branch`` command from the Launchpad plugin has been
26 removed, because it has not worked for at least five years: it relies on29 removed, because it has not worked for at least five years: it relies on
27 password authentication rather than SSO, the relevant systems no longer30 password authentication rather than SSO, the relevant systems no longer

Subscribers

People subscribed via source and target branches