Merge lp:~jelmer/bzrtools/no-more-branches into lp:bzrtools

Proposed by Jelmer Vernooij
Status: Rejected
Rejected by: Aaron Bentley
Proposed branch: lp:~jelmer/bzrtools/no-more-branches
Merge into: lp:bzrtools
Diff against target: 313 lines (+17/-91)
13 files modified
__init__.py (+0/-1)
branches.py (+0/-12)
bzrtools.py (+6/-33)
cbranch.py (+0/-1)
command_classes.py (+0/-18)
heads.py (+1/-2)
hunk_selector.py (+1/-1)
patch.py (+1/-2)
progress.py (+0/-2)
rspush.py (+0/-2)
shelf.py (+2/-3)
tests/blackbox.py (+0/-13)
tests/test_link_tree.py (+6/-1)
To merge this branch: bzr merge lp:~jelmer/bzrtools/no-more-branches
Reviewer Review Type Date Requested Status
Jonathan Riddell (community) Approve
Aaron Bentley Pending
Review via email: mp+73276@code.launchpad.net

Description of the change

Remove the implementation of the 'bzr branches' command, which should
be available as 'bzr branches --scan' in bzr 2.5.

To post a comment you must log in.
Revision history for this message
Jonathan Riddell (jr) wrote :

Looks fine

review: Approve
Revision history for this message
Aaron Bentley (abentley) wrote :

Jonathan, I actually have misgivings about removing the command entirely, which is why I haven't gone ahead and merged it. Bzrtools is mostly backwards-compatible with older bzrs and I don't know if I want to remove a command that they could use and have traditionally had.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Hmm, I can't seem to mark my own MPs as rejected.

Revision history for this message
Aaron Bentley (abentley) wrote :

What's the deal with --scan? I don't want to mask the bzr version of 'branches', but I don't want to remove the bzrtools version if there's no reasonable alternative.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

"bzr branches --recursive" (renamed from --scan) has now landed on bzr.dev, and provides similar functionality to "bzr branches" from bzrtools.

Revision history for this message
Aaron Bentley (abentley) wrote :

Okay, so I think the strategy should be for "list-branches" to recomment "branches --recursive" in bzrs that have it.

Revision history for this message
Aaron Bentley (abentley) wrote :

recommend, not recomment.

Unmerged revisions

779. By Jelmer Vernooij

Remove implementation of branches command, which now is "bzr branches --scan".

778. By Jelmer Vernooij

Merge fix-bzr.dev-compat.

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-05-10 01:53:58 +0000
3+++ __init__.py 2011-08-29 18:43:22 +0000
4@@ -27,7 +27,6 @@
5
6
7 commands = {
8- 'cmd_branches': [],
9 'cmd_branch_history': [],
10 'cmd_cbranch': [],
11 'cmd_cdiff': [],
12
13=== removed file 'branches.py'
14--- branches.py 2007-12-22 02:01:03 +0000
15+++ branches.py 1970-01-01 00:00:00 +0000
16@@ -1,12 +0,0 @@
17-from bzrlib import errors
18-from bzrlib.bzrdir import BzrDir
19-from bzrlib.transport import get_transport
20-from bzrtools import list_branches
21-
22-
23-def branches(location=None):
24- if location is None:
25- location = '.'
26- t = get_transport(location)
27- for branch in list_branches(t):
28- print branch.base[len(t.base):].rstrip('/')
29
30=== modified file 'bzrtools.py'
31--- bzrtools.py 2009-03-11 01:19:53 +0000
32+++ bzrtools.py 2011-08-29 18:43:22 +0000
33@@ -25,19 +25,13 @@
34
35 import bzrlib
36 from bzrlib import revision as _mod_revision, trace, urlutils
37-import bzrlib.errors
38 from bzrlib.errors import (
39 BzrCommandError,
40 BzrError,
41- ConnectionError,
42 NotBranchError,
43 NoSuchFile,
44- NoWorkingTree,
45- PermissionDenied,
46- UnsupportedFormatError,
47- TransportError,
48 )
49-from bzrlib.bzrdir import BzrDir, BzrDirFormat
50+from bzrlib.bzrdir import BzrDir
51 from bzrlib.transport import get_transport
52
53 def temp_tree():
54@@ -303,7 +297,7 @@
55 if working_tree:
56 clean, non_source = is_clean(tree)
57 if not clean:
58- raise bzrlib.errors.BzrCommandError(
59+ raise BzrCommandError(
60 'This tree has uncommitted changes or unknown'
61 ' (?) files. Use "bzr status" to list them.')
62 sys.exit(1)
63@@ -319,16 +313,16 @@
64 try:
65 if not history_subset(push_location, tree.branch,
66 _rsync=my_rsync):
67- raise bzrlib.errors.BzrCommandError(
68+ raise BzrCommandError(
69 "Local branch is not a newer version of remote"
70 " branch.")
71 except RsyncNoFile:
72 if not empty_or_absent(push_location):
73- raise bzrlib.errors.BzrCommandError(
74+ raise BzrCommandError(
75 "Remote location is not a bzr branch (or empty"
76 " directory)")
77 except RsyncStreamIO:
78- raise bzrlib.errors.BzrCommandError("Rsync could not use the"
79+ raise BzrCommandError("Rsync could not use the"
80 " specified location. Please ensure that"
81 ' "%s" is of the form "machine:/path".' % push_location)
82 trace.note("Pushing to %s", push_location)
83@@ -355,7 +349,7 @@
84 t._remote_path = lambda x: t.base
85 try:
86 lines = t.get('')
87- except bzrlib.errors.NoSuchFile:
88+ except NoSuchFile:
89 return
90 expr = re.compile('<a[^>]*href="([^>]*)\/"[^>]*>', flags=re.I)
91 for line in lines:
92@@ -370,27 +364,6 @@
93 yield url.rstrip('/')
94
95
96-def list_branches(t):
97- def is_inside(branch):
98- return bool(branch.base.startswith(t.base))
99-
100- if t.base.startswith('http://'):
101- def evaluate(bzrdir):
102- try:
103- branch = bzrdir.open_branch()
104- if is_inside(branch):
105- return True, branch
106- else:
107- return True, None
108- except NotBranchError:
109- return True, None
110- return [b for b in BzrDir.find_bzrdirs(t, list_current=apache_ls,
111- evaluate=evaluate) if b is not None]
112- elif not t.listable():
113- raise BzrCommandError("Can't list this type of location.")
114- return [b for b in BzrDir.find_branches(t) if is_inside(b)]
115-
116-
117 def evaluate_branch_tree(bzrdir):
118 try:
119 tree, branch = bzrdir._get_tree_branch()
120
121=== modified file 'cbranch.py'
122--- cbranch.py 2008-03-20 15:36:35 +0000
123+++ cbranch.py 2011-08-29 18:43:22 +0000
124@@ -17,7 +17,6 @@
125
126 from bzrlib import ui
127 from bzrlib.bzrdir import BzrDir
128-from bzrlib.branch import Branch
129 from bzrlib.config import LocationConfig
130 from bzrlib.errors import BzrCommandError, NoSuchFile
131 from bzrlib.osutils import pathjoin, basename, abspath
132
133=== modified file 'command_classes.py'
134--- command_classes.py 2011-04-12 04:51:37 +0000
135+++ command_classes.py 2011-08-29 18:43:22 +0000
136@@ -16,8 +16,6 @@
137 # along with this program; if not, write to the Free Software
138 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
139
140-import errno
141-
142 import bzrlib
143
144 from bzrlib.lazy_import import lazy_import
145@@ -29,21 +27,12 @@
146 from command import BzrToolsCommand
147 from errors import CommandError
148 from patchsource import BzrPatchSource
149-import sys
150-import os.path
151
152-import bzrlib.builtins
153 import bzrlib.commands
154 from bzrlib.branch import Branch
155-from bzrlib.bzrdir import BzrDir
156 from bzrlib.commands import get_cmd_object
157 from bzrlib.errors import BzrCommandError
158-import bzrlib.ignores
159-from bzrlib.trace import note
160 from bzrlib.option import Option, RegistryOption
161-from bzrlib.workingtree import WorkingTree
162-
163-from command import BzrToolsCommand
164
165
166 class cmd_graph_ancestry(BzrToolsCommand):
167@@ -448,13 +437,6 @@
168 hardlink=hardlink)
169
170
171-class cmd_branches(BzrToolsCommand):
172- """Scan a location for branches"""
173- takes_args = ["location?"]
174- def run(self, location=None):
175- from branches import branches
176- return branches(location)
177-
178 class cmd_trees(BzrToolsCommand):
179 """Scan a location for trees"""
180 takes_args = ['location?']
181
182=== modified file 'heads.py'
183--- heads.py 2008-05-12 04:14:21 +0000
184+++ heads.py 2011-08-29 18:43:22 +0000
185@@ -18,11 +18,10 @@
186 """Show all 'heads' in a repository"""
187
188
189-import os
190 import time
191
192 import bzrlib
193-from bzrlib.commands import Command, display_command, register_command
194+from bzrlib.commands import Command, display_command
195 from bzrlib import errors
196 from bzrlib.option import Option
197 from bzrlib.urlutils import unescape_for_display
198
199=== modified file 'hunk_selector.py'
200--- hunk_selector.py 2007-04-04 18:12:00 +0000
201+++ hunk_selector.py 2011-08-29 18:43:22 +0000
202@@ -1,7 +1,7 @@
203 import sys
204
205 from userinteractor import UserInteractor, UserOption
206-from errors import NoColor
207+from errors import NoColor, NoBzrtoolsColor
208 import copy
209
210 class HunkSelector:
211
212=== modified file 'patch.py'
213--- patch.py 2008-10-06 23:24:16 +0000
214+++ patch.py 2011-08-29 18:43:22 +0000
215@@ -17,11 +17,10 @@
216 import sys
217 import subprocess
218
219-from bzrlib.workingtree import WorkingTree
220 import bzrlib.add
221
222 from bzrlib.plugins.bzrtools.bzrtools import open_from_url
223-from errors import CommandError, PatchFailed, PatchInvokeError
224+from errors import PatchFailed, PatchInvokeError
225
226 def patch(tree, location, strip, quiet=False):
227 """Apply a patch to a branch, using patch(1). URLs may be used."""
228
229=== modified file 'progress.py'
230--- progress.py 2008-02-13 04:58:32 +0000
231+++ progress.py 2011-08-29 18:43:22 +0000
232@@ -16,8 +16,6 @@
233 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
234
235 import sys
236-import datetime
237-from bzrlib.progress import ProgressBar
238
239 class Progress(object):
240 def __init__(self, units, current, total=None):
241
242=== modified file 'rspush.py'
243--- rspush.py 2007-08-14 16:04:32 +0000
244+++ rspush.py 2011-08-29 18:43:22 +0000
245@@ -15,8 +15,6 @@
246 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
247 from bzrlib.option import Option
248 from bzrlib.workingtree import WorkingTree
249-import sys
250-import os
251 import bzrtools
252
253 from command import BzrToolsCommand
254
255=== modified file 'shelf.py'
256--- shelf.py 2008-02-13 04:15:48 +0000
257+++ shelf.py 2011-08-29 18:43:22 +0000
258@@ -1,11 +1,10 @@
259 import os
260 import sys
261-import subprocess
262 from datetime import datetime
263-from errors import CommandError, PatchFailed, PatchInvokeError
264+from errors import CommandError, PatchFailed
265 from hunk_selector import ShelveHunkSelector, UnshelveHunkSelector
266 from patch import run_patch
267-from patchsource import PatchSource, FilePatchSource
268+from patchsource import FilePatchSource
269 from bzrlib.osutils import rename
270
271 class Shelf(object):
272
273=== modified file 'tests/blackbox.py'
274--- tests/blackbox.py 2011-06-24 13:35:53 +0000
275+++ tests/blackbox.py 2011-08-29 18:43:22 +0000
276@@ -112,19 +112,6 @@
277 self.assertIs(False, os.path.exists('checkout2'))
278 self.assertIs(False, os.path.exists('source2'))
279
280- def test_branches(self):
281- self.run_bzr('init source')
282- self.run_bzr('init source/subsource')
283- self.run_bzr('checkout --lightweight source checkout')
284- self.run_bzr('init checkout/subcheckout')
285- self.run_bzr('init checkout/.bzr/subcheckout')
286- out = self.run_bzr('branches')[0]
287- lines = out.split('\n')
288- self.assertIs(True, 'source' in lines)
289- self.assertIs(True, 'source/subsource' in lines)
290- self.assertIs(True, 'checkout/subcheckout' in lines)
291- self.assertIs(True, 'checkout' not in lines)
292-
293 def test_import_upstream(self):
294 self.run_bzr('init source')
295 os.mkdir('source/src')
296
297=== modified file 'tests/test_link_tree.py'
298--- tests/test_link_tree.py 2010-02-25 04:15:18 +0000
299+++ tests/test_link_tree.py 2011-08-29 18:43:22 +0000
300@@ -17,7 +17,12 @@
301 import os
302
303 from bzrlib.transform import TreeTransform
304-from bzrlib.tests import TestCaseWithTransport, HardlinkFeature
305+from bzrlib.tests import TestCaseWithTransport
306+
307+try:
308+ from bzrlib.tests.features import HardlinkFeature
309+except ImportError: # bzr < 2.5
310+ from bzrlib.tests import HardlinkFeature
311
312 from bzrlib.plugins.bzrtools import command
313 from bzrlib.plugins.bzrtools.link_tree import link_tree

Subscribers

People subscribed via source and target branches