Revision history for this message
Aaron Bentley (abentley) wrote : | # |
1 | === modified file 'lib/canonical/launchpad/icing/style.css' |
2 | --- lib/canonical/launchpad/icing/style.css 2009-12-14 20:08:29 +0000 |
3 | +++ lib/canonical/launchpad/icing/style.css 2009-12-18 19:52:27 +0000 |
4 | @@ -1104,7 +1104,7 @@ |
5 | height: 2.5em; |
6 | } |
7 | |
8 | -#branch-pending-writes, #diff-pending-update { |
9 | +.pending-update { |
10 | background: #FFF59C; |
11 | width: 40em; |
12 | margin: 1em auto; |
13 | @@ -1117,7 +1117,7 @@ |
14 | -webkit-border-radius: 5px; |
15 | } |
16 | |
17 | -#branch-pending-writes h3, #diff-pending-update h3 { |
18 | +.pending-update h3{ |
19 | color: black; |
20 | font-weight: bold; |
21 | text-align: center; |
22 | |
23 | === modified file 'lib/lp/code/interfaces/branchmergeproposal.py' |
24 | --- lib/lp/code/interfaces/branchmergeproposal.py 2009-12-18 14:51:37 +0000 |
25 | +++ lib/lp/code/interfaces/branchmergeproposal.py 2009-12-18 19:44:07 +0000 |
26 | @@ -118,7 +118,8 @@ |
27 | IStaticDiff, title=_('The diff to be used for reviews.'), |
28 | readonly=True) |
29 | |
30 | - next_preview_diff_job = Attribute('foo') |
31 | + next_preview_diff_job = Attribute( |
32 | + 'The next BranchMergeProposalJob that will update a preview diff.') |
33 | |
34 | preview_diff = exported( |
35 | Reference( |
36 | @@ -476,10 +477,6 @@ |
37 | class IBranchMergeProposalJob(Interface): |
38 | """A Job related to a Branch Merge Proposal.""" |
39 | |
40 | - id = Int( |
41 | - title=_('DB ID'), required=True, readonly=True, |
42 | - description=_("Database id for this BranchJob.")) |
43 | - |
44 | branch_merge_proposal = Object( |
45 | title=_('The BranchMergeProposal this job is about'), |
46 | schema=IBranchMergeProposal, required=True) |
47 | |
48 | === modified file 'lib/lp/code/model/branchmergeproposal.py' |
49 | --- lib/lp/code/model/branchmergeproposal.py 2009-12-18 14:51:37 +0000 |
50 | +++ lib/lp/code/model/branchmergeproposal.py 2009-12-18 19:44:53 +0000 |
51 | @@ -137,6 +137,7 @@ |
52 | |
53 | @property |
54 | def next_preview_diff_job(self): |
55 | + # circular dependencies |
56 | from lp.code.model.branchmergeproposaljob import ( |
57 | BranchMergeProposalJob, MergeProposalCreatedJob, |
58 | UpdatePreviewDiffJob) |
59 | @@ -147,7 +148,7 @@ |
60 | job = Store.of(self).find( |
61 | BranchMergeProposalJob, |
62 | BranchMergeProposalJob.branch_merge_proposal == self, |
63 | - BranchMergeProposalJob.job_type.is_in(type_classes), |
64 | + BranchMergeProposalJob.job_type.is_in(type_classes.keys()), |
65 | BranchMergeProposalJob.job == Job.id, |
66 | Job._status.is_in([JobStatus.WAITING, JobStatus.RUNNING]) |
67 | ).order_by(Job.scheduled_start, Job.date_created).first() |
68 | |
69 | === modified file 'lib/lp/code/model/tests/test_branchmergeproposals.py' |
70 | --- lib/lp/code/model/tests/test_branchmergeproposals.py 2009-12-18 14:51:37 +0000 |
71 | +++ lib/lp/code/model/tests/test_branchmergeproposals.py 2009-12-18 19:41:47 +0000 |
72 | @@ -1879,9 +1879,9 @@ |
73 | """Jobs are shown while pending.""" |
74 | bmp = self.factory.makeBranchMergeProposal() |
75 | job = bmp.next_preview_diff_job |
76 | - self.assertEqual(job.id, bmp.next_preview_diff_job.id) |
77 | + self.assertEqual(job, bmp.next_preview_diff_job) |
78 | job.start() |
79 | - self.assertEqual(job.id, bmp.next_preview_diff_job.id) |
80 | + self.assertEqual(job, bmp.next_preview_diff_job) |
81 | job.fail() |
82 | self.assertIs(None, bmp.next_preview_diff_job) |
83 | |
84 | |
85 | === modified file 'lib/lp/code/templates/branch-index.pt' |
86 | --- lib/lp/code/templates/branch-index.pt 2009-12-03 18:33:22 +0000 |
87 | +++ lib/lp/code/templates/branch-index.pt 2009-12-18 19:49:08 +0000 |
88 | @@ -162,7 +162,7 @@ |
89 | |
90 | <div class="yui-g" tal:condition="view/pending_writes"> |
91 | <div class="portlet"> |
92 | - <div id="branch-pending-writes"> |
93 | + <div id="branch-pending-writes" class="pending-update"> |
94 | <h3>Updating branch...</h3> |
95 | <p> |
96 | Launchpad is processing new changes to this branch and will be |
97 | |
98 | === modified file 'lib/lp/code/templates/branchmergeproposal-index.pt' |
99 | --- lib/lp/code/templates/branchmergeproposal-index.pt 2009-12-14 20:08:29 +0000 |
100 | +++ lib/lp/code/templates/branchmergeproposal-index.pt 2009-12-18 19:53:27 +0000 |
101 | @@ -181,7 +181,7 @@ |
102 | </div> |
103 | |
104 | <div class="yui-g" tal:condition="view/pending_diff"> |
105 | - <div class="portlet" id="diff-pending-update"> |
106 | + <div class="portlet pending-update" id="diff-pending-update"> |
107 | <h3>Updating diff...</h3> |
108 | <p> |
109 | An updated diff will be available in a few minutes. Reload to see the |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Guilherme Salgado wrote:
>> === modified file 'lib/canonical/ launchpad/ icing/style. css' launchpad/ icing/style. css 2009-12-08 10:57:44 +0000 launchpad/ icing/style. css 2009-12-17 21:46:16 +0000 pending- writes { pending- writes, #diff-pending- update { in-progress' instead of creating an alias to it?
>> --- lib/canonical/
>> +++ lib/canonical/
>> @@ -1104,7 +1104,7 @@
>> height: 2.5em;
>> }
>>
>> -#branch-
>> +#branch-
>
> Is this not a good opportunity to rename this class to 'pending-update'
> or 'update-
Okay, I can do that.
>> background: #FFF59C; border- radius: 5px; pending- writes h3 { pending- writes h3, #diff-pending- update h3 { code/interfaces /branchmergepro posal.py' code/interfaces /branchmergepro posal.py 2009-10-23 00:48:47 +0000 code/interfaces /branchmergepro posal.py 2009-12-17 21:46:16 +0000 diff_job = Attribute('foo')
>> width: 40em;
>> margin: 1em auto;
>> @@ -1117,7 +1117,7 @@
>> -webkit-
>> }
>>
>> -#branch-
>> +#branch-
>> color: black;
>> font-weight: bold;
>> text-align: center;
>>
>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -155,6 +155,8 @@
>> IStaticDiff, title=_('The diff to be used for reviews.'),
>> readonly=True)
>>
>> + next_preview_
>> +
>
> !?
Circular dependencies. I'll make the attribute somewhat better.
>> preview_diff = exported( posalJob( Interface) : _("Database id for this BranchJob."))
>> Reference(
>> IPreviewDiff,
>> @@ -511,6 +513,10 @@
>> class IBranchMergePro
>> """A Job related to a Branch Merge Proposal."""
>>
>> + id = Int(
>> + title=_('DB ID'), required=True, readonly=True,
>> + description=
>
> Do you really need to expose this in the public interface or is it just
> for your test?
I think it makes a lot of sense to expose in the public interface, and I
have another branch in which it is necessary to expose it in the public
interface:
https:/ /code.edge. launchpad. net/~abentley/ launchpad/ ampoulejob/ +merge/ 15982
In this case, once I change the test to use an equality, I don't need it.
> merge_proposal = Object( IBranchMergePro posal, required=True) code/model/ branchmergeprop osal.py' code/model/ branchmergeprop osal.py 2009-12-01 01:09:38 +0000 code/model/ branchmergeprop osal.py 2009-12-17 21:46:16 +0000 transition( proposal, from_state, next_state, user=None): 'StaticDiff' , notNull=False, default=None) diff_job( self): model.branchmer geproposaljob import ( osalJob, MergeProposalCr eatedJob, ffJob)
>> +
>> branch_
>> title=_('The BranchMergeProposal this job is about'),
>> schema=
>>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
> [...]
>>
>>
>> def is_valid_
>> @@ -132,6 +134,26 @@
>> review_diff = ForeignKey(
>> foreignKey=
>>
>> + @property
>> + def next_preview_
>> + from lp.code.
>> + BranchMergeProp
>> + UpdatePreviewDi
>
> Circular dependencies?
Yes.
> If so, care to leave a comment here?
Alright.
> reatedJob, UpdatePreviewDi ffJob] class_job_ type, job_class) self).find( osalJob, osalJob. job_type. is_in(type_ classes) ,
>> + job_classes = [MergeProposalC
>> + type_classes = dict(
>> + (job_class.
>> + for job_class in job_classes)
>> + job = Store.of(
>> + BranchMergeProp
>> + BranchMergeProp
>
> I think it'd be better to explicitly pass type_classes.keys() above, to
> not leave your reader wondering why a dict is being passed to is_in().
Okay.
>> === modified file 'lib/lp/ code/model/ branchmergeprop osaljob. py' code/model/ branchmergeprop osaljob. py 2009-11-03 21:05:14 +0000 code/model/ branchmergeprop osaljob. py 2009-12-17 21:46:16 +0000 database. enumcol import EnumCol launchpad. database. message import MessageJob, MessageJobAction roxy(job. __class_ _)
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -27,6 +27,7 @@
>> from storm.store import Store
>> from zope.component import getUtility
>> from zope.interface import classProvides, implements
>> +from zope.security.proxy import removeSecurityProxy
>>
>> from canonical.
>> from canonical.
>> @@ -151,7 +152,9 @@
>> self.context = job
>>
>> def __eq__(self, job):
>> - return (self.__class__ is job.__class__ and self.job == job.job)
>> + return (
>> + self.__class__ is removeSecurityP
>> + and self.job == job.job)
>
> Why did you change this?
So that it would work when comparing a securityproxied object with an
unproxied object.
> code/model/ tests/test_ branchmergeprop osals.py' code/model/ tests/test_ branchmergeprop osals.py 2009-12-01 01:09:38 +0000 code/model/ tests/test_ branchmergeprop osals.py 2009-12-17 21:46:16 +0000 leMerge( bmp.preview_ diff.text) DiffJob( TestCaseWithFac tory): nalLayer bmp_job( self): makeBranchMerge Proposal( ) preview_ diff_job l(bmp, job.branch_ merge_proposal) eatedJob, removeSecurityP roxy(job) .__class_ _) l(job.id, bmp.next_ preview_ diff_job. id)
>>
>> def __ne__(self, job):
>> return not (self == job)
>>
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -13,6 +13,7 @@
>>
>> from pytz import UTC
>> from sqlobject import SQLObjectNotFound
>> +from storm.locals import Store
>> from zope.component import getUtility
>> import transaction
>> from zope.security.proxy import removeSecurityProxy
>> @@ -1828,5 +1829,26 @@
>> self.checkExamp
>>
>>
>> +class TestNextPreview
>> +
>> + layer = DatabaseFunctio
>> +
>> + def test_returns_
>> + bmp = self.factory.
>> + job = bmp.next_
>> + self.assertEqua
>> + self.assertIs(
>> + MergeProposalCr
>> + job.start()
>> + self.assertEqua
>
> Why do you compare them by ID here?
Hysterical raisins.
Updates made, diff attached.
Aaron enigmail. mozdev. org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAks r448ACgkQ0F+ nu1YWqI3B9ACffO i6cTu5+ nE6XT0Bq6IosAGI QagLDL/ sOzu9+yAWE
4FcAn03I7oSjPlK
=Cf/V
-----END PGP SIGNATURE-----