Merge lp:~launchpad/difftacular/breezy into lp:difftacular

Proposed by Colin Watson
Status: Merged
Merged at revision: 10
Proposed branch: lp:~launchpad/difftacular/breezy
Merge into: lp:difftacular
Diff against target: 124 lines (+30/-21)
5 files modified
__init__.py (+10/-10)
command.py (+2/-2)
generate_diff.py (+2/-2)
tests/__init__.py (+2/-2)
tests/test_generate_diff.py (+14/-5)
To merge this branch: bzr merge lp:~launchpad/difftacular/breezy
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) Approve
Canonical Launchpad Engineering Pending
Review via email: mp+368768@code.launchpad.net

Commit message

Port to Breezy.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

This looks reasonable to me.

I'm not sure if this matters, but you could make it compatible with both bazaar and breezy by using relative imports (from ... import commands) and replacing 'bzrlib.plugins.difftacular' in the register_lazy calls with __name__).

review: Approve
lp:~launchpad/difftacular/breezy updated
11. By Colin Watson

Make compatible with both Bazaar and Breezy.

Revision history for this message
Colin Watson (cjwatson) wrote :

It's probably not a big deal, but it doesn't seem like it would hurt. Thanks, done.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '__init__.py'
2--- __init__.py 2011-02-23 21:41:53 +0000
3+++ __init__.py 2019-06-14 09:29:35 +0000
4@@ -17,16 +17,16 @@
5 __doc__ = "Provides diff-ignore-branches and diff-mainline commands."
6
7
8-from bzrlib import commands
9-
10-
11-commands.plugin_cmds.register_lazy(
12- 'cmd_diff_mainline', [], 'bzrlib.plugins.difftacular.command')
13-commands.plugin_cmds.register_lazy(
14- 'cmd_diff_ignore_branches', [], 'bzrlib.plugins.difftacular.command')
15-commands.plugin_cmds.register_lazy(
16- 'cmd_preview_diff', [], 'bzrlib.plugins.difftacular.command')
17+from ... import commands
18+
19+
20+commands.plugin_cmds.register_lazy(
21+ 'cmd_diff_mainline', [], __name__ + '.command')
22+commands.plugin_cmds.register_lazy(
23+ 'cmd_diff_ignore_branches', [], __name__ + '.command')
24+commands.plugin_cmds.register_lazy(
25+ 'cmd_preview_diff', [], __name__ + '.command')
26
27 def test_suite():
28- from bzrlib.plugins.difftacular import tests
29+ from . import tests
30 return tests.test_suite()
31
32=== modified file 'command.py'
33--- command.py 2011-02-23 21:41:53 +0000
34+++ command.py 2019-06-14 09:29:35 +0000
35@@ -14,8 +14,8 @@
36 # along with this program; if not, write to the Free Software
37 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
38
39-from bzrlib import branch, commands, errors, option, trace, urlutils
40-from bzrlib.plugins.difftacular import generate_diff
41+from ... import branch, commands, errors, option, trace, urlutils
42+from . import generate_diff
43
44 class DiffCommand(commands.Command):
45
46
47=== modified file 'generate_diff.py'
48--- generate_diff.py 2012-02-10 22:43:12 +0000
49+++ generate_diff.py 2019-06-14 09:29:35 +0000
50@@ -15,8 +15,8 @@
51 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
52
53
54-from bzrlib import cleanup, diff, revision as _mod_revision
55-from bzrlib.merge import Merge3Merger
56+from ... import cleanup, diff, revision as _mod_revision
57+from ...merge import Merge3Merger
58
59
60 def apply_merges(tree, branch, merges):
61
62=== modified file 'tests/__init__.py'
63--- tests/__init__.py 2010-07-13 16:19:05 +0000
64+++ tests/__init__.py 2019-06-14 09:29:35 +0000
65@@ -16,6 +16,6 @@
66
67
68 def test_suite():
69- from bzrlib.tests.TestUtil import TestLoader
70- from bzrlib.plugins.difftacular.tests import test_generate_diff
71+ from ....tests.TestUtil import TestLoader
72+ from . import test_generate_diff
73 return TestLoader().loadTestsFromModule(test_generate_diff)
74
75=== modified file 'tests/test_generate_diff.py'
76--- tests/test_generate_diff.py 2010-07-15 11:48:55 +0000
77+++ tests/test_generate_diff.py 2019-06-14 09:29:35 +0000
78@@ -17,8 +17,17 @@
79
80 from StringIO import StringIO
81
82-from bzrlib.plugins.difftacular import generate_diff
83-from bzrlib import tests
84+from .. import generate_diff
85+from .... import tests
86+
87+
88+def get_controldir(tree):
89+ try:
90+ # Breezy
91+ return tree.controldir
92+ except AttributeError:
93+ # Bazaar
94+ return tree.bzrdir
95
96
97 class TestMainlineDiff(tests.TestCaseWithTransport):
98@@ -30,7 +39,7 @@
99 self.build_tree_contents([('foo/baz', 'a\nz\n')])
100 foo.add('baz')
101 rev1 = foo.commit('initial commit')
102- bar = foo.bzrdir.sprout('bar').open_workingtree()
103+ bar = get_controldir(foo).sprout('bar').open_workingtree()
104 self.build_tree_contents([('bar/baz', 'c\na\nz\n')])
105 rev2_bar = bar.commit('add c')
106 foo.merge_from_branch(bar.branch)
107@@ -54,7 +63,7 @@
108
109 def create_unignored_merge_scenario(self):
110 foo, bar, rev1, rev2, rev2_bar, rev3 = self.create_diff_scenario()
111- unignored = foo.bzrdir.sprout('unignored').open_workingtree()
112+ unignored = get_controldir(foo).sprout('unignored').open_workingtree()
113 self.build_tree_contents([('unignored/baz', 'c\na\nb\nz\nd\n')])
114 unignored.commit('add d')
115 foo.merge_from_branch(unignored.branch)
116@@ -95,7 +104,7 @@
117 foo.lock_write()
118 self.addCleanup(foo.unlock)
119 rev1 = foo.commit('done')
120- bar = foo.bzrdir.sprout('bar').open_workingtree()
121+ bar = get_controldir(foo).sprout('bar').open_workingtree()
122 rev2b = bar.commit('done')
123 foo.merge_from_branch(bar.branch)
124 rev2 = foo.commit('done')

Subscribers

People subscribed via source and target branches