Merge lp:~jelmer/brz/fix-diff-using 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/fix-diff-using
Merge into: lp:brz
Diff against target: 93 lines (+15/-11)
2 files modified
breezy/diff.py (+13/-9)
breezy/tests/blackbox/test_diff.py (+2/-2)
To merge this branch: bzr merge lp:~jelmer/brz/fix-diff-using
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+426326@code.launchpad.net

Commit message

Fix handling of --diff-options.

Description of the change

Fix handling of --diff-options.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/diff.py'
2--- breezy/diff.py 2022-01-21 17:19:24 +0000
3+++ breezy/diff.py 2022-07-06 00:01:49 +0000
4@@ -19,6 +19,7 @@
5 import os
6 import re
7 import sys
8+from typing import Optional, List, Union
9
10 from .lazy_import import lazy_import
11 lazy_import(globals(), """
12@@ -29,7 +30,6 @@
13
14 from breezy import (
15 controldir,
16- osutils,
17 textfile,
18 timestamp,
19 views,
20@@ -41,12 +41,13 @@
21
22 from . import (
23 errors,
24+ osutils,
25 )
26 from .registry import (
27 Registry,
28 )
29 from .trace import mutter, note, warning
30-from .tree import FileTimestampUnavailable
31+from .tree import Tree, FileTimestampUnavailable
32
33
34 DEFAULT_CONTEXT_AMOUNT = 3
35@@ -494,10 +495,10 @@
36
37 def show_diff_trees(old_tree, new_tree, to_file, specific_files=None,
38 external_diff_options=None,
39- old_label='a/', new_label='b/',
40+ old_label: str = 'a/', new_label: str = 'b/',
41 extra_trees=None,
42- path_encoding='utf8',
43- using=None,
44+ path_encoding: str = 'utf8',
45+ using: Optional[str] = None,
46 format_cls=None,
47 context=DEFAULT_CONTEXT_AMOUNT):
48 """Show in text form the changes from one tree to another.
49@@ -770,15 +771,18 @@
50
51 class DiffFromTool(DiffPath):
52
53- def __init__(self, command_template, old_tree, new_tree, to_file,
54+ def __init__(self, command_template: Union[str, List[str]],
55+ old_tree: Tree, new_tree: Tree, to_file,
56 path_encoding='utf-8'):
57 DiffPath.__init__(self, old_tree, new_tree, to_file, path_encoding)
58 self.command_template = command_template
59 self._root = osutils.mkdtemp(prefix='brz-diff-')
60
61 @classmethod
62- def from_string(klass, command_template, old_tree, new_tree, to_file,
63- path_encoding='utf-8'):
64+ def from_string(klass,
65+ command_template: Union[str, List[str]],
66+ old_tree: Tree, new_tree: Tree, to_file,
67+ path_encoding: str = 'utf-8'):
68 return klass(command_template, old_tree, new_tree, to_file,
69 path_encoding)
70
71@@ -787,7 +791,7 @@
72 def from_diff_tree(diff_tree):
73 full_command_string = [command_string]
74 if external_diff_options is not None:
75- full_command_string += ' ' + external_diff_options
76+ full_command_string.extend(external_diff_options.split())
77 return klass.from_string(full_command_string, diff_tree.old_tree,
78 diff_tree.new_tree, diff_tree.to_file)
79 return from_diff_tree
80
81=== modified file 'breezy/tests/blackbox/test_diff.py'
82--- breezy/tests/blackbox/test_diff.py 2021-11-15 17:27:44 +0000
83+++ breezy/tests/blackbox/test_diff.py 2022-07-06 00:01:49 +0000
84@@ -464,9 +464,9 @@
85 self.requireFeature(features.diff_feature)
86 self.make_example_branch()
87 self.build_tree_contents([('hello', b'Foo\n')])
88- out, err = self.run_bzr('diff --diff-options -i --using diff',
89+ out, err = self.run_bzr('diff --diff-options -i --diff-options -a --using diff',
90 retcode=1)
91- self.assertEqual("=== modified file 'hello'\n", out)
92+ self.assertEqual("=== modified file 'hello'\n1c1\n< foo\n---\n> Foo\n", out)
93 self.assertEqual('', err)
94
95

Subscribers

People subscribed via source and target branches