Rev 4084: (robertc) Reduce noise from 'add'; in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Mar 6 03:02:23 GMT 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4084
revision-id: pqm at pqm.ubuntu.com-20090306030219-enauehb3achqqq7c
parent: pqm at pqm.ubuntu.com-20090305232301-81w9o9ib70oe7dio
parent: andrew.bennetts at canonical.com-20090306022320-kshgmasexpdzbm6k
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2009-03-06 03:02:19 +0000
message:
(robertc) Reduce noise from 'add';
register factories not instances for network_names;
add Branch.get_parent RPC.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/branch.py branch.py-20061124031907-mzh3pla28r83r97f-1
bzrlib/smart/request.py request.py-20061108095550-gunadhxmzkdjfeek-1
bzrlib/tests/blackbox/test_add.py test_add.py-20060518072250-857e4f86f54a30b2
bzrlib/tests/blackbox/test_filtered_view_ops.py test_filtered_view_o-20081110012645-5t7ogtola0l33lkg-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
------------------------------------------------------------
revno: 4083.1.7
revision-id: andrew.bennetts at canonical.com-20090306022320-kshgmasexpdzbm6k
parent: andrew.bennetts at canonical.com-20090306022100-cb3sz5julsdhgrpa
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: robert-rollup
timestamp: Fri 2009-03-06 13:23:20 +1100
message:
Fix same trivial bug [(x) != (x,)] in test_remote and test_smart.
modified:
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
------------------------------------------------------------
revno: 4083.1.6
revision-id: andrew.bennetts at canonical.com-20090306022100-cb3sz5julsdhgrpa
parent: andrew.bennetts at canonical.com-20090306020213-exzvpnhbu5ndxcwc
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: robert-rollup
timestamp: Fri 2009-03-06 13:21:00 +1100
message:
Fix trivial bug in my trivial bug fix :)
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
------------------------------------------------------------
revno: 4083.1.5
revision-id: andrew.bennetts at canonical.com-20090306020213-exzvpnhbu5ndxcwc
parent: andrew.bennetts at canonical.com-20090306013843-w67vyhrv36ecy1p6
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: robert-rollup
timestamp: Fri 2009-03-06 13:02:13 +1100
message:
Fix trivial bug in get_parent RPC.
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
------------------------------------------------------------
revno: 4083.1.4
revision-id: andrew.bennetts at canonical.com-20090306013843-w67vyhrv36ecy1p6
parent: andrew.bennetts at canonical.com-20090306010259-kj6hsixvt56869ej
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: robert-rollup
timestamp: Fri 2009-03-06 12:38:43 +1100
message:
Fix trivial bug in get_parent RPC.
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/branch.py branch.py-20061124031907-mzh3pla28r83r97f-1
------------------------------------------------------------
revno: 4083.1.3
revision-id: andrew.bennetts at canonical.com-20090306010259-kj6hsixvt56869ej
parent: andrew.bennetts at canonical.com-20090306010227-ryarueftpc6u69yu
parent: robertc at robertcollins.net-20090305052624-ejso9br8bxv68twx
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: robert-rollup
timestamp: Fri 2009-03-06 12:02:59 +1100
message:
Merge Robert's branch.roundtrips.
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/branch.py branch.py-20061124031907-mzh3pla28r83r97f-1
bzrlib/smart/request.py request.py-20061108095550-gunadhxmzkdjfeek-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
------------------------------------------------------------
revno: 4078.2.1
revision-id: robertc at robertcollins.net-20090305052624-ejso9br8bxv68twx
parent: pqm at pqm.ubuntu.com-20090304163710-r7hhqdi9f3jsbe5g
committer: Robert Collins <robertc at robertcollins.net>
branch nick: branch.roundtrips
timestamp: Thu 2009-03-05 16:26:24 +1100
message:
Add a Branch.get_parent remote call for RemoteBranch.
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/branch.py branch.py-20061124031907-mzh3pla28r83r97f-1
bzrlib/smart/request.py request.py-20061108095550-gunadhxmzkdjfeek-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
------------------------------------------------------------
revno: 4083.1.2
revision-id: andrew.bennetts at canonical.com-20090306010227-ryarueftpc6u69yu
parent: andrew.bennetts at canonical.com-20090306010132-qupl8nopacf1l87h
parent: robertc at robertcollins.net-20090303211206-cuzsauuklqtg4389
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: robert-rollup
timestamp: Fri 2009-03-06 12:02:27 +1100
message:
Merge Robert's network-name.factories, resolving a conflict.
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
------------------------------------------------------------
revno: 4075.2.1
revision-id: robertc at robertcollins.net-20090303211206-cuzsauuklqtg4389
parent: pqm at pqm.ubuntu.com-20090303085413-35seprvnu885xorz
committer: Robert Collins <robertc at robertcollins.net>
branch nick: network-name.factories
timestamp: Wed 2009-03-04 08:12:06 +1100
message:
Audit and make sure we are registering network_name's as factories, not instances.
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
------------------------------------------------------------
revno: 4083.1.1
revision-id: andrew.bennetts at canonical.com-20090306010132-qupl8nopacf1l87h
parent: pqm at pqm.ubuntu.com-20090305232301-81w9o9ib70oe7dio
parent: robertc at robertcollins.net-20090303230552-isxgvyezephwq1vi
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: robert-rollup
timestamp: Fri 2009-03-06 12:01:32 +1100
message:
Merge Robert's add-noise.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_add.py test_add.py-20060518072250-857e4f86f54a30b2
bzrlib/tests/blackbox/test_filtered_view_ops.py test_filtered_view_o-20081110012645-5t7ogtola0l33lkg-1
------------------------------------------------------------
revno: 4075.1.1
revision-id: robertc at robertcollins.net-20090303230552-isxgvyezephwq1vi
parent: pqm at pqm.ubuntu.com-20090303085413-35seprvnu885xorz
committer: Robert Collins <robertc at robertcollins.net>
branch nick: add-noise
timestamp: Wed 2009-03-04 10:05:52 +1100
message:
add should not print 'add completed' unnecessarily.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_add.py test_add.py-20060518072250-857e4f86f54a30b2
bzrlib/tests/blackbox/test_filtered_view_ops.py test_filtered_view_o-20081110012645-5t7ogtola0l33lkg-1
=== modified file 'NEWS'
--- a/NEWS 2009-03-05 20:44:29 +0000
+++ b/NEWS 2009-03-06 01:01:32 +0000
@@ -41,6 +41,9 @@
IMPROVEMENTS:
+ * ``bzr add`` no longer prints ``add completed`` on success. Failure
+ still prints an error message. (Robert Collins)
+
* ``bzr branch`` now has a ``--no-tree`` option which turns off the
generation of a working tree in the new branch.
(Daniel Watkins, John Klinger, #273993)
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2009-03-04 14:01:30 +0000
+++ b/bzrlib/branch.py 2009-03-06 01:02:59 +0000
@@ -768,7 +768,20 @@
pattern is that the user can override it by specifying a
location.
"""
- raise NotImplementedError(self.get_parent)
+ parent = self._get_parent_location()
+ if parent is None:
+ return parent
+ # This is an old-format absolute path to a local branch
+ # turn it into a url
+ if parent.startswith('/'):
+ parent = urlutils.local_path_to_url(parent.decode('utf8'))
+ try:
+ return urlutils.join(self.base[:-1], parent)
+ except errors.InvalidURLJoin, e:
+ raise errors.InaccessibleParent(parent, self.base)
+
+ def _get_parent_location(self):
+ raise NotImplementedError(self._get_parent_location)
def _set_config_location(self, name, url, config=None,
make_relative=False):
@@ -1289,8 +1302,9 @@
def register_format(klass, format):
"""Register a metadir format."""
klass._formats[format.get_format_string()] = format
- # Metadir formats have a network name of their format string.
- network_format_registry.register(format.get_format_string(), format)
+ # Metadir formats have a network name of their format string, and get
+ # registered as class factories.
+ network_format_registry.register(format.get_format_string(), format.__class__)
@classmethod
def set_default_format(klass, format):
@@ -1744,7 +1758,7 @@
_legacy_formats = [BzrBranchFormat4(),
]
network_format_registry.register(
- _legacy_formats[0].network_name(), _legacy_formats[0])
+ _legacy_formats[0].network_name(), _legacy_formats[0].__class__)
class BzrBranch(Branch):
@@ -2081,20 +2095,6 @@
result.new_revno, result.new_revid = target.last_revision_info()
return result
- def get_parent(self):
- """See Branch.get_parent."""
- parent = self._get_parent_location()
- if parent is None:
- return parent
- # This is an old-format absolute path to a local branch
- # turn it into a url
- if parent.startswith('/'):
- parent = urlutils.local_path_to_url(parent.decode('utf8'))
- try:
- return urlutils.join(self.base[:-1], parent)
- except errors.InvalidURLJoin, e:
- raise errors.InaccessibleParent(parent, self.base)
-
def get_stacked_on_url(self):
raise errors.UnstackableBranchFormat(self._format, self.base)
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2009-02-26 19:21:53 +0000
+++ b/bzrlib/builtins.py 2009-03-06 01:01:32 +0000
@@ -585,8 +585,6 @@
finally:
if base_tree is not None:
base_tree.unlock()
- if not is_quiet() and len(added) > 0:
- self.outf.write('add completed\n')
if len(ignored) > 0:
if verbose:
for glob in sorted(ignored.keys()):
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py 2009-03-03 05:50:55 +0000
+++ b/bzrlib/bzrdir.py 2009-03-03 21:12:06 +0000
@@ -1832,7 +1832,7 @@
def register_format(klass, format):
klass._formats[format.get_format_string()] = format
# bzr native formats have a network name of their format string.
- network_format_registry.register(format.get_format_string(), format)
+ network_format_registry.register(format.get_format_string(), format.__class__)
@classmethod
def register_control_format(klass, format):
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2009-03-05 05:45:04 +0000
+++ b/bzrlib/remote.py 2009-03-06 02:21:00 +0000
@@ -158,8 +158,7 @@
if len(branch_info) != 2:
raise errors.UnexpectedSmartServerResponse(response)
branch_ref, branch_name = branch_info
- # ICK: perhaps change these registries to be factories only?
- format = bzrdir.network_format_registry.get(control_name).__class__()
+ format = bzrdir.network_format_registry.get(control_name)
if repo_name:
format.repository_format = repository.network_format_registry.get(
repo_name)
@@ -2042,12 +2041,22 @@
hook(self, rev_history)
self._cache_revision_history(rev_history)
- def get_parent(self):
- self._ensure_real()
- return self._real_branch.get_parent()
-
def _get_parent_location(self):
- # Used by tests, when checking normalisation of given vs stored paths.
+ medium = self._client._medium
+ if medium._is_remote_before((1, 13)):
+ return self._vfs_get_parent_location()
+ try:
+ response = self._call('Branch.get_parent', self._remote_path())
+ except errors.UnknownSmartMethod:
+ return self._vfs_get_parent_location()
+ if len(response) != 1:
+ raise errors.UnexpectedSmartServerResponse(response)
+ parent_location = response[0]
+ if parent_location == '':
+ return None
+ return parent_location
+
+ def _vfs_get_parent_location(self):
self._ensure_real()
return self._real_branch._get_parent_location()
=== modified file 'bzrlib/smart/branch.py'
--- a/bzrlib/smart/branch.py 2009-02-23 15:29:35 +0000
+++ b/bzrlib/smart/branch.py 2009-03-06 01:38:43 +0000
@@ -92,6 +92,14 @@
return SuccessfulSmartServerResponse( ('ok', ), content)
+class SmartServerBranchGetParent(SmartServerBranchRequest):
+
+ def do_with_branch(self, branch):
+ """Return the parent of branch."""
+ parent = branch._get_parent_location() or ''
+ return SuccessfulSmartServerResponse((parent,))
+
+
class SmartServerBranchRequestGetStackedOnURL(SmartServerBranchRequest):
def do_with_branch(self, branch):
=== modified file 'bzrlib/smart/request.py'
--- a/bzrlib/smart/request.py 2009-03-03 03:27:51 +0000
+++ b/bzrlib/smart/request.py 2009-03-05 05:26:24 +0000
@@ -390,6 +390,8 @@
request_handlers.register_lazy(
'Branch.get_config_file', 'bzrlib.smart.branch', 'SmartServerBranchGetConfigFile')
request_handlers.register_lazy(
+ 'Branch.get_parent', 'bzrlib.smart.branch', 'SmartServerBranchGetParent')
+request_handlers.register_lazy(
'Branch.get_stacked_on_url', 'bzrlib.smart.branch', 'SmartServerBranchRequestGetStackedOnURL')
request_handlers.register_lazy(
'Branch.last_revision_info', 'bzrlib.smart.branch', 'SmartServerBranchRequestLastRevisionInfo')
=== modified file 'bzrlib/tests/blackbox/test_add.py'
--- a/bzrlib/tests/blackbox/test_add.py 2009-02-23 15:29:35 +0000
+++ b/bzrlib/tests/blackbox/test_add.py 2009-03-03 23:05:52 +0000
@@ -35,7 +35,6 @@
results = sorted(out.rstrip('\n').split('\n'))
self.assertEquals(['If you wish to add some of these files, please'\
' add them by name.',
- 'add completed',
'adding .bzrignore',
'adding dir',
'adding dir/sub.txt',
@@ -149,8 +148,7 @@
self.assertEqual('', err)
self.assertEqualDiff('adding a w/ file id from a\n'
'adding b w/ file id from b\n'
- 'adding b/c w/ file id from b/c\n'
- 'add completed\n',
+ 'adding b/c w/ file id from b/c\n',
out)
new_tree = new_tree.bzrdir.open_workingtree()
self.assertEqual(base_tree.path2id('a'), new_tree.path2id('a'))
@@ -170,8 +168,7 @@
out, err = self.run_bzr('add --file-ids-from ../base/b')
self.assertEqual('', err)
self.assertEqualDiff('adding c w/ file id from b/c\n'
- 'adding d w/ file id from b/d\n'
- 'add completed\n',
+ 'adding d w/ file id from b/d\n',
out)
new_tree = new_tree.bzrdir.open_workingtree()
=== modified file 'bzrlib/tests/blackbox/test_filtered_view_ops.py'
--- a/bzrlib/tests/blackbox/test_filtered_view_ops.py 2009-02-24 22:56:13 +0000
+++ b/bzrlib/tests/blackbox/test_filtered_view_ops.py 2009-03-03 23:05:52 +0000
@@ -55,13 +55,13 @@
wt = self.make_abc_tree_with_ab_view()
out, err = self.run_bzr('add')
self.assertEquals('ignoring files outside view: a, b\n', err)
- self.assertEquals('adding a\nadding b\nadd completed\n', out)
+ self.assertEquals('adding a\nadding b\n', out)
def test_view_on_add_selected(self):
wt = self.make_abc_tree_with_ab_view()
out, err = self.run_bzr('add a')
self.assertEquals('', err)
- self.assertEquals('adding a\nadd completed\n', out)
+ self.assertEquals('adding a\n', out)
out, err = self.run_bzr('add c', retcode=3)
self.assertEquals('bzr: ERROR: Specified file "c" is outside the '
'current view: a, b\n', err)
=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py 2009-03-05 04:37:03 +0000
+++ b/bzrlib/tests/test_remote.py 2009-03-06 02:23:20 +0000
@@ -704,6 +704,56 @@
return RemoteBranch(bzrdir, repo, _client=client)
+class TestBranchGetParent(RemoteBranchTestCase):
+
+ def test_no_parent(self):
+ # in an empty branch we decode the response properly
+ transport = MemoryTransport()
+ client = FakeClient(transport.base)
+ client.add_expected_call(
+ 'Branch.get_stacked_on_url', ('quack/',),
+ 'error', ('NotStacked',))
+ client.add_expected_call(
+ 'Branch.get_parent', ('quack/',),
+ 'success', ('',))
+ transport.mkdir('quack')
+ transport = transport.clone('quack')
+ branch = self.make_remote_branch(transport, client)
+ result = branch.get_parent()
+ client.finished_test()
+ self.assertEqual(None, result)
+
+ def test_parent_relative(self):
+ transport = MemoryTransport()
+ client = FakeClient(transport.base)
+ client.add_expected_call(
+ 'Branch.get_stacked_on_url', ('kwaak/',),
+ 'error', ('NotStacked',))
+ client.add_expected_call(
+ 'Branch.get_parent', ('kwaak/',),
+ 'success', ('../foo/',))
+ transport.mkdir('kwaak')
+ transport = transport.clone('kwaak')
+ branch = self.make_remote_branch(transport, client)
+ result = branch.get_parent()
+ self.assertEqual(transport.clone('../foo').base, result)
+
+ def test_parent_absolute(self):
+ transport = MemoryTransport()
+ client = FakeClient(transport.base)
+ client.add_expected_call(
+ 'Branch.get_stacked_on_url', ('kwaak/',),
+ 'error', ('NotStacked',))
+ client.add_expected_call(
+ 'Branch.get_parent', ('kwaak/',),
+ 'success', ('http://foo/',))
+ transport.mkdir('kwaak')
+ transport = transport.clone('kwaak')
+ branch = self.make_remote_branch(transport, client)
+ result = branch.get_parent()
+ self.assertEqual('http://foo/', result)
+
+
class TestBranchLastRevisionInfo(RemoteBranchTestCase):
def test_empty_branch(self):
=== modified file 'bzrlib/tests/test_smart.py'
--- a/bzrlib/tests/test_smart.py 2009-03-05 04:37:03 +0000
+++ b/bzrlib/tests/test_smart.py 2009-03-06 02:23:20 +0000
@@ -677,6 +677,25 @@
self.assertEqual('child-1', self.tree.branch.last_revision())
+class TestSmartServerBranchRequestGetParent(tests.TestCaseWithMemoryTransport):
+
+ def test_get_parent_none(self):
+ base_branch = self.make_branch('base')
+ request = smart.branch.SmartServerBranchGetParent(self.get_transport())
+ response = request.execute('base')
+ self.assertEquals(
+ SuccessfulSmartServerResponse(('',)), response)
+
+ def test_get_parent_something(self):
+ base_branch = self.make_branch('base')
+ base_branch.set_parent(self.get_url('foo'))
+ request = smart.branch.SmartServerBranchGetParent(self.get_transport())
+ response = request.execute('base')
+ self.assertEquals(
+ SuccessfulSmartServerResponse(("../foo",)),
+ response)
+
+
class TestSmartServerBranchRequestGetStackedOnURL(tests.TestCaseWithMemoryTransport):
def test_get_stacked_on_url(self):
@@ -1187,6 +1206,9 @@
smart.request.request_handlers.get('Branch.get_config_file'),
smart.branch.SmartServerBranchGetConfigFile)
self.assertEqual(
+ smart.request.request_handlers.get('Branch.get_parent'),
+ smart.branch.SmartServerBranchGetParent)
+ self.assertEqual(
smart.request.request_handlers.get('Branch.lock_write'),
smart.branch.SmartServerBranchRequestLockWrite)
self.assertEqual(
More information about the bazaar-commits
mailing list