Rev 3790: Add Branch.hook 'transform_fallback_location' in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Oct 22 20:44:11 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3790
revision-id: pqm at pqm.ubuntu.com-20081022194407-i8gphy9hg1sj48ib
parent: pqm at pqm.ubuntu.com-20081021231845-k119hl1icewguq50
parent: john at arbash-meinel.com-20081022190916-0w9icef0aj23uysv
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-10-22 20:44:07 +0100
message:
Add Branch.hook 'transform_fallback_location'
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/help_topics/en/hooks.txt hooks.txt-20070830033044-xxu2rced13f72dka-1
bzrlib/tests/branch_implementations/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
------------------------------------------------------------
revno: 3770.2.6
revision-id: john at arbash-meinel.com-20081022190916-0w9icef0aj23uysv
parent: john at arbash-meinel.com-20081022190707-qf5480pbkqp33d51
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Wed 2008-10-22 14:09:16 -0500
message:
NEWS about transform_fallback_location
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 3770.2.5
revision-id: john at arbash-meinel.com-20081022190707-qf5480pbkqp33d51
parent: john at arbash-meinel.com-20081022190522-dg8twf54j6xhkxwx
parent: pqm at pqm.ubuntu.com-20081021231845-k119hl1icewguq50
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Wed 2008-10-22 14:07:07 -0500
message:
Merge bzr.dev 3789
added:
bzrlib/tests/blackbox/test_dump_btree.py test_dump_btree.py-20081008203335-zkpcq230b6vubszz-1
bzrlib/tests/fake_command.py fake_command.py-20081021195002-r9v65tgxx63c25v9-1
doc/developers/cycle.txt cycle.txt-20081017031739-rw24r0cywm2ok3xu-1
tools/packaging/lp-upload-release lpuploadrelease-20081020075647-56zdf9z6yav1bx81-1
modified:
Makefile Makefile-20050805140406-d96e3498bb61c5bb
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
bzrlib/config.py config.py-20051011043216-070c74f4e9e338e8
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/patches.py patches.py-20050727183609-378c1cc5972ce908
bzrlib/plugins/launchpad/account.py account.py-20071011033320-50y6vfftywf4yllw-1
bzrlib/plugins/launchpad/lp_directory.py lp_indirect.py-20070126012204-de5rugwlt22c7u7e-1
bzrlib/plugins/launchpad/test_account.py test_account.py-20071011033320-50y6vfftywf4yllw-2
bzrlib/plugins/launchpad/test_lp_directory.py test_lp_indirect.py-20070126002743-oyle362tzv9cd8mi-1
bzrlib/tests/blackbox/__init__.py __init__.py-20051128053524-eba30d8255e08dc3
bzrlib/tests/blackbox/test_command_encoding.py test_command_encoding.py-20060106032110-45431fd2ce9ff21f
bzrlib/tests/test_branch.py test_branch.py-20060116013032-97819aa07b8ab3b5
bzrlib/tests/test_commands.py test_command.py-20051019190109-3b17be0f52eaa7a8
bzrlib/tests/test_config.py testconfig.py-20051011041908-742d0c15d8d8c8eb
bzrlib/tests/test_knit.py test_knit.py-20051212171302-95d4c00dd5f11f2b
bzrlib/tests/test_patches.py test_patches.py-20051231203844-f4974d20f6aea09c
bzrlib/tests/test_plugins.py plugins.py-20050622075746-32002b55e5e943e9
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_sftp_transport.py testsftp.py-20051027032739-247570325fec7e7e
bzrlib/tests/test_store.py teststore.py-20050826022702-f6caadb647395769
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/transport/ftp/__init__.py ftp.py-20051116161804-58dc9506548c2a53
bzrlib/transport/remote.py ssh.py-20060608202016-c25gvf1ob7ypbus6-1
bzrlib/transport/sftp.py sftp.py-20051019050329-ab48ce71b7e32dfe
bzrlib/transport/ssh.py ssh.py-20060824042150-0s9787kng6zv1nwq-1
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
doc/developers/HACKING.txt HACKING-20050805200004-2a5dc975d870f78c
doc/developers/index.txt index.txt-20070508041241-qznziunkg0nffhiw-1
doc/developers/ppa.txt ppa.txt-20080722055539-606u7t2z32t3ae4w-1
doc/developers/releasing.txt releasing.txt-20080502015919-fnrcav8fwy8ccibu-1
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
------------------------------------------------------------
revno: 3770.2.4
revision-id: john at arbash-meinel.com-20081022190522-dg8twf54j6xhkxwx
parent: michael.hudson at canonical.com-20081009011603-ff38tob1w8yuf3nk
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Wed 2008-10-22 14:05:22 -0500
message:
Document that the hook call ordering is undefined.
modified:
bzrlib/help_topics/en/hooks.txt hooks.txt-20070830033044-xxu2rced13f72dka-1
------------------------------------------------------------
revno: 3770.2.3
revision-id: michael.hudson at canonical.com-20081009011603-ff38tob1w8yuf3nk
parent: michael.hudson at canonical.com-20081009011116-kf4k762psqnhasxp
committer: Michael Hudson <michael.hudson at canonical.com>
branch nick: stacking-altering-hook
timestamp: Thu 2008-10-09 14:16:03 +1300
message:
check for None being returned for a hook
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
------------------------------------------------------------
revno: 3770.2.2
revision-id: michael.hudson at canonical.com-20081009011116-kf4k762psqnhasxp
parent: michael.hudson at canonical.com-20081009005615-rrxrwvclyot567wd
committer: Michael Hudson <michael.hudson at canonical.com>
branch nick: stacking-altering-hook
timestamp: Thu 2008-10-09 14:11:16 +1300
message:
docs
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/help_topics/en/hooks.txt hooks.txt-20070830033044-xxu2rced13f72dka-1
------------------------------------------------------------
revno: 3770.2.1
revision-id: michael.hudson at canonical.com-20081009005615-rrxrwvclyot567wd
parent: pqm at pqm.ubuntu.com-20081008020104-e68hyxx45qo19nzx
committer: Michael Hudson <michael.hudson at canonical.com>
branch nick: stacking-altering-hook
timestamp: Thu 2008-10-09 13:56:15 +1300
message:
test and feature
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/help_topics/en/hooks.txt hooks.txt-20070830033044-xxu2rced13f72dka-1
bzrlib/tests/branch_implementations/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
=== modified file 'NEWS'
--- a/NEWS 2008-10-21 20:49:54 +0000
+++ b/NEWS 2008-10-22 19:09:16 +0000
@@ -11,6 +11,9 @@
NEW FEATURES:
+ * New Branch hook ``transform_fallback_location`` allows a function to
+ be called when looking up the stacked source. (Michael Hudson)
+
IMPROVEMENTS:
* ``bzr dump-btree`` is a hidden command introduced to allow dumping
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2008-10-07 11:54:11 +0000
+++ b/bzrlib/branch.py 2008-10-22 19:07:07 +0000
@@ -1126,6 +1126,14 @@
# (params) where params is a ChangeBranchTipParams with the members
# (branch, old_revno, new_revno, old_revid, new_revid)
self['post_change_branch_tip'] = []
+ # Introduced in 1.9
+ # Invoked when a stacked branch activates its fallback locations and
+ # allows the transformation of the url of said location.
+ # the api signature is
+ # (branch, url) where branch is the branch having its fallback
+ # location activated and url is the url for the fallback location.
+ # The hook should return a url.
+ self['transform_fallback_location'] = []
# install the default hooks into the Branch class.
@@ -2021,6 +2029,13 @@
errors.UnstackableBranchFormat):
pass
else:
+ for hook in Branch.hooks['transform_fallback_location']:
+ url = hook(self, url)
+ if url is None:
+ hook_name = Branch.hooks.get_hook_name(hook)
+ raise AssertionError(
+ "'transform_fallback_location' hook %s returned "
+ "None, not a URL." % hook_name)
self._activate_fallback_location(url)
def _check_stackable_repo(self):
=== modified file 'bzrlib/help_topics/en/hooks.txt'
--- a/bzrlib/help_topics/en/hooks.txt 2008-09-23 23:45:04 +0000
+++ b/bzrlib/help_topics/en/hooks.txt 2008-10-22 19:05:22 +0000
@@ -174,6 +174,28 @@
Please use the ``post_change_branch_tip`` hook instead.
+transform_fallback_location (Branch)
+------------------------------------
+
+Invoked as a stacked branch activates its fallback locations.
+
+The hook signature is (branch, url) where:
+
+ branch
+ The branch being opened. Note that as it does not yet have its
+ fallback locations activated, the branch should be treated as
+ half-built.
+
+ url
+ The URL that the branch specified for its fallback location.
+
+The hook must return a URL for the branch containing the fallback
+location. If multiple hooks are registered, the order in which they
+will be called is undefined and subject to change.
+
+(New in 1.9)
+
+
server_started (SmartTCPServer)
-------------------------------
=== modified file 'bzrlib/tests/branch_implementations/test_stacking.py'
--- a/bzrlib/tests/branch_implementations/test_stacking.py 2008-08-20 16:14:09 +0000
+++ b/bzrlib/tests/branch_implementations/test_stacking.py 2008-10-09 00:56:15 +0000
@@ -17,6 +17,7 @@
"""Tests for Branch.get_stacked_on_url and set_stacked_on_url."""
from bzrlib import (
+ branch,
bzrdir,
errors,
)
@@ -336,3 +337,23 @@
rtree.lock_read()
self.addCleanup(rtree.unlock)
self.assertEqual('new content', rtree.get_file_by_path('a').read())
+
+ def test_transform_fallback_location_hook(self):
+ # The 'transform_fallback_location' branch hook allows us to inspect
+ # and transform the URL of the fallback location for the branch.
+ stack_on = self.make_branch('stack-on')
+ stacked = self.make_branch('stacked')
+ try:
+ stacked.set_stacked_on_url('../stack-on')
+ except (errors.UnstackableRepositoryFormat,
+ errors.UnstackableBranchFormat):
+ raise TestNotApplicable('Format does not support stacking.')
+ self.get_transport().rename('stack-on', 'new-stack-on')
+ hook_calls = []
+ def hook(stacked_branch, url):
+ hook_calls.append(url)
+ return '../new-stack-on'
+ branch.Branch.hooks.install_named_hook(
+ 'transform_fallback_location', hook, None)
+ branch.Branch.open('stacked')
+ self.assertEqual(['../stack-on'], hook_calls)
More information about the bazaar-commits
mailing list