Merge lp:~mwhudson/launchpad/directbranchcommit-calls-branchChanged-bug-578331 into lp:launchpad

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Aaron Bentley
Approved revision: no longer in the source branch.
Merged at revision: 10888
Proposed branch: lp:~mwhudson/launchpad/directbranchcommit-calls-branchChanged-bug-578331
Merge into: lp:launchpad
Diff against target: 131 lines (+26/-15)
6 files modified
database/schema/security.cfg (+2/-2)
lib/lp/code/model/branch.py (+1/-1)
lib/lp/code/model/directbranchcommit.py (+5/-1)
lib/lp/code/tests/test_directbranchcommit.py (+7/-0)
lib/lp/codehosting/bzrutils.py (+9/-0)
lib/lp/codehosting/vfs/branchfs.py (+2/-11)
To merge this branch: bzr merge lp:~mwhudson/launchpad/directbranchcommit-calls-branchChanged-bug-578331
Reviewer Review Type Date Requested Status
Данило Шеган (community) Approve
Aaron Bentley (community) Approve
Review via email: mp+25059@code.launchpad.net

Commit message

directbranchcommit should call branchChanged not requestMirror

Description of the change

Hi there,

This branch changes directbranchcommit to call branchChanged rather than requestMirror, as the latter doesn't make sense now since no-hosted-area landed.

Cheers,
mwh

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) wrote :

Looks good, subject to updating the test comment, as we discussed in IRC.

review: Approve
Revision history for this message
Данило Шеган (danilo) wrote :

Per discussion on IRC, and after confirming that the new test fails as-is on the existing code, I think this is good to land.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2010-05-03 06:59:06 +0000
+++ database/schema/security.cfg 2010-05-12 08:45:50 +0000
@@ -1362,9 +1362,9 @@
1362type=user1362type=user
1363groups=script1363groups=script
1364public.branch = SELECT, UPDATE1364public.branch = SELECT, UPDATE
1365public.branchjob = SELECT1365public.branchjob = SELECT, UPDATE, INSERT
1366public.emailaddress = SELECT1366public.emailaddress = SELECT
1367public.job = SELECT1367public.job = SELECT, UPDATE, INSERT
1368public.language = SELECT1368public.language = SELECT
1369public.person = SELECT1369public.person = SELECT
1370public.pofile = SELECT1370public.pofile = SELECT
13711371
=== modified file 'lib/lp/code/model/branch.py'
--- lib/lp/code/model/branch.py 2010-04-23 04:11:12 +0000
+++ lib/lp/code/model/branch.py 2010-05-12 08:45:50 +0000
@@ -897,7 +897,7 @@
897 control_format, branch_format, repository_format):897 control_format, branch_format, repository_format):
898 """See `IBranch`."""898 """See `IBranch`."""
899 self.mirror_status_message = None899 self.mirror_status_message = None
900 if stacked_on_location == '':900 if stacked_on_location == '' or stacked_on_location is None:
901 stacked_on_branch = None901 stacked_on_branch = None
902 else:902 else:
903 stacked_on_branch = getUtility(IBranchLookup).getByUniqueName(903 stacked_on_branch = getUtility(IBranchLookup).getByUniqueName(
904904
=== modified file 'lib/lp/code/model/directbranchcommit.py'
--- lib/lp/code/model/directbranchcommit.py 2010-04-26 00:24:26 +0000
+++ lib/lp/code/model/directbranchcommit.py 2010-05-12 08:45:50 +0000
@@ -18,6 +18,7 @@
1818
19from canonical.launchpad.interfaces import IMasterObject19from canonical.launchpad.interfaces import IMasterObject
2020
21from lp.codehosting.bzrutils import get_stacked_on_url
2122
22class ConcurrentUpdateError(Exception):23class ConcurrentUpdateError(Exception):
23 """Bailout exception for concurrent updates.24 """Bailout exception for concurrent updates.
@@ -189,7 +190,10 @@
189 return190 return
190 new_rev_id = self.transform_preview.commit(191 new_rev_id = self.transform_preview.commit(
191 self.bzrbranch, commit_message)192 self.bzrbranch, commit_message)
192 IMasterObject(self.db_branch).requestMirror()193 IMasterObject(self.db_branch).branchChanged(
194 get_stacked_on_url(self.bzrbranch), new_rev_id,
195 self.db_branch.control_format, self.db_branch.branch_format,
196 self.db_branch.repository_format)
193197
194 if txn:198 if txn:
195 txn.commit()199 txn.commit()
196200
=== modified file 'lib/lp/code/tests/test_directbranchcommit.py'
--- lib/lp/code/tests/test_directbranchcommit.py 2010-04-23 03:02:01 +0000
+++ lib/lp/code/tests/test_directbranchcommit.py 2010-05-12 08:45:50 +0000
@@ -174,6 +174,13 @@
174 self.committer.writeFile('hi.py', 'print "hi world"')174 self.committer.writeFile('hi.py', 'print "hi world"')
175 self.assertRaises(ConcurrentUpdateError, self.committer.commit, '')175 self.assertRaises(ConcurrentUpdateError, self.committer.commit, '')
176176
177 def test_DirectBranchCommit_records_committed_revision_id(self):
178 # commit() records the committed revision in the database record for
179 # the branch.
180 self.committer.writeFile('hi.c', 'main(){puts("hi world");}')
181 revid = self.committer.commit('')
182 self.assertEqual(revid, self.db_branch.last_mirrored_id)
183
177184
178class TestDirectBranchCommit_getDir(DirectBranchCommitTestCase):185class TestDirectBranchCommit_getDir(DirectBranchCommitTestCase):
179 """Test `DirectBranchCommit._getDir`."""186 """Test `DirectBranchCommit._getDir`."""
180187
=== modified file 'lib/lp/codehosting/bzrutils.py'
--- lib/lp/codehosting/bzrutils.py 2010-04-27 01:39:55 +0000
+++ lib/lp/codehosting/bzrutils.py 2010-05-12 08:45:50 +0000
@@ -12,6 +12,7 @@
12 'add_exception_logging_hook',12 'add_exception_logging_hook',
13 'DenyingServer',13 'DenyingServer',
14 'get_branch_stacked_on_url',14 'get_branch_stacked_on_url',
15 'get_stacked_on_url',
15 'get_vfs_format_classes',16 'get_vfs_format_classes',
16 'HttpAsLocalTransport',17 'HttpAsLocalTransport',
17 'identical_formats',18 'identical_formats',
@@ -340,3 +341,11 @@
340 """341 """
341 return checked_open(342 return checked_open(
342 makeURLChecker(allowed_scheme), url, possible_transports)343 makeURLChecker(allowed_scheme), url, possible_transports)
344
345
346def get_stacked_on_url(branch):
347 """Get the stacked-on URL for 'branch', or `None` if not stacked."""
348 try:
349 return branch.get_stacked_on_url()
350 except (NotStacked, UnstackableBranchFormat):
351 return None
343352
=== modified file 'lib/lp/codehosting/vfs/branchfs.py'
--- lib/lp/codehosting/vfs/branchfs.py 2010-05-04 23:42:28 +0000
+++ lib/lp/codehosting/vfs/branchfs.py 2010-05-12 08:45:50 +0000
@@ -66,9 +66,7 @@
66from bzrlib.branch import Branch66from bzrlib.branch import Branch
67from bzrlib.bzrdir import BzrDir, BzrDirFormat67from bzrlib.bzrdir import BzrDir, BzrDirFormat
68from bzrlib.config import TransportConfig68from bzrlib.config import TransportConfig
69from bzrlib.errors import (69from bzrlib.errors import NoSuchFile, PermissionDenied, TransportNotPossible
70 NoSuchFile, NotStacked, PermissionDenied, TransportNotPossible,
71 UnstackableBranchFormat)
72from bzrlib.plugins.loom.branch import LoomSupport70from bzrlib.plugins.loom.branch import LoomSupport
73from bzrlib.smart.request import jail_info71from bzrlib.smart.request import jail_info
74from bzrlib.transport import get_transport72from bzrlib.transport import get_transport
@@ -83,6 +81,7 @@
83from zope.component import getUtility81from zope.component import getUtility
84from zope.interface import implements, Interface82from zope.interface import implements, Interface
8583
84from lp.codehosting.bzrutils import get_stacked_on_url
86from lp.codehosting.vfs.branchfsclient import (85from lp.codehosting.vfs.branchfsclient import (
87 BlockingProxy, BranchFileSystemClient)86 BlockingProxy, BranchFileSystemClient)
88from lp.codehosting.vfs.transport import (87from lp.codehosting.vfs.transport import (
@@ -706,14 +705,6 @@
706 return lp_server705 return lp_server
707706
708707
709def get_stacked_on_url(branch):
710 """Get the stacked-on URL for 'branch', or `None` if not stacked."""
711 try:
712 return branch.get_stacked_on_url()
713 except (NotStacked, UnstackableBranchFormat):
714 return None
715
716
717class BranchPolicy:708class BranchPolicy:
718 """Policy on how to mirror branches.709 """Policy on how to mirror branches.
719710