Merge lp:~thumper/launchpad/new-bzr into lp:launchpad
- new-bzr
- Merge into devel
Proposed by
Tim Penhey
Status: | Merged |
---|---|
Approved by: | Michael Hudson-Doyle |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11369 |
Proposed branch: | lp:~thumper/launchpad/new-bzr |
Merge into: | lp:launchpad |
Diff against target: |
1246 lines (+380/-183) 28 files modified
configs/development/apidoc-configure-normal.zcml (+0/-1) lib/lp/code/mail/codehandler.py (+6/-2) lib/lp/code/mail/tests/test_codehandler.py (+34/-20) lib/lp/code/model/diff.py (+1/-1) lib/lp/code/model/directbranchcommit.py (+10/-2) lib/lp/code/model/tests/test_branch.py (+5/-1) lib/lp/code/model/tests/test_branchjob.py (+100/-57) lib/lp/code/model/tests/test_branchmergeproposaljobs.py (+11/-2) lib/lp/code/model/tests/test_diff.py (+16/-4) lib/lp/code/scripts/tests/test_scan_branches.py (+9/-3) lib/lp/code/scripts/tests/test_sendbranchmail.py (+11/-2) lib/lp/codehosting/codeimport/tests/test_worker.py (+1/-1) lib/lp/codehosting/codeimport/uifactory.py (+18/-0) lib/lp/codehosting/puller/worker.py (+1/-1) lib/lp/codehosting/scanner/tests/test_buglinks.py (+34/-24) lib/lp/codehosting/scanner/tests/test_bzrsync.py (+28/-19) lib/lp/codehosting/scanner/tests/test_mergedetection.py (+11/-2) lib/lp/codehosting/tests/test_acceptance.py (+1/-4) lib/lp/codehosting/tests/test_branchdistro.py (+16/-4) lib/lp/codehosting/tests/test_bzrutils.py (+2/-2) lib/lp/codehosting/tests/test_jobs.py (+6/-1) lib/lp/codehosting/vfs/tests/test_transport.py (+3/-0) lib/lp/services/osutils.py (+32/-0) lib/lp/testing/__init__.py (+4/-10) lib/lp/translations/scripts/translations_to_branch.py (+10/-16) lib/lp/translations/tests/test_rosetta_branches_script.py (+7/-1) utilities/sourcedeps.conf (+2/-2) versions.cfg (+1/-1) |
To merge this branch: | bzr merge lp:~thumper/launchpad/new-bzr |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Hudson-Doyle | Approve | ||
Tim Penhey (community) | Approve | ||
Review via email: mp+32845@code.launchpad.net |
Commit message
Upgrade bzr to 2.2 final.
Description of the change
Upgrade bzr to 2.2.
Due to changes in bzrlib, specific user logins are needed, but there is a bug (which has been fixed on trunk) where the committer passed in as an argument was ignored.
To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote : | # |
I approve the other bits.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'configs/development/apidoc-configure-normal.zcml' |
2 | --- configs/development/apidoc-configure-normal.zcml 2010-07-24 02:27:19 +0000 |
3 | +++ configs/development/apidoc-configure-normal.zcml 2010-08-17 04:46:45 +0000 |
4 | @@ -90,7 +90,6 @@ |
5 | <apidoc:rootModule module="martian" /> |
6 | <apidoc:rootModule module="manuel" /> |
7 | <apidoc:rootModule module="chameleon" /> |
8 | - <apidoc:rootModule module="bzrlib" /> |
9 | <apidoc:rootModule module="storm" /> |
10 | |
11 | <apidoc:bookchapter |
12 | |
13 | === modified file 'lib/lp/code/mail/codehandler.py' |
14 | --- lib/lp/code/mail/codehandler.py 2010-08-02 02:51:42 +0000 |
15 | +++ lib/lp/code/mail/codehandler.py 2010-08-17 04:46:45 +0000 |
16 | @@ -545,8 +545,12 @@ |
17 | # access to any needed but not supplied revisions. |
18 | md.target_branch = target_url |
19 | md.install_revisions(bzr_branch.repository) |
20 | - bzr_branch.pull(bzr_branch, stop_revision=md.revision_id, |
21 | - overwrite=True) |
22 | + bzr_branch.lock_write() |
23 | + try: |
24 | + bzr_branch.pull(bzr_branch, stop_revision=md.revision_id, |
25 | + overwrite=True) |
26 | + finally: |
27 | + bzr_branch.unlock() |
28 | |
29 | def findMergeDirectiveAndComment(self, message): |
30 | """Extract the comment and Merge Directive from a SignedMessage.""" |
31 | |
32 | === modified file 'lib/lp/code/mail/tests/test_codehandler.py' |
33 | --- lib/lp/code/mail/tests/test_codehandler.py 2010-07-27 05:30:04 +0000 |
34 | +++ lib/lp/code/mail/tests/test_codehandler.py 2010-08-17 04:46:45 +0000 |
35 | @@ -3,6 +3,8 @@ |
36 | |
37 | """Testing the CodeHandler.""" |
38 | |
39 | +from __future__ import with_statement |
40 | + |
41 | __metaclass__ = type |
42 | |
43 | from difflib import unified_diff |
44 | @@ -48,6 +50,7 @@ |
45 | from lp.codehosting.vfs import get_lp_server |
46 | from lp.registry.interfaces.person import IPersonSet |
47 | from lp.services.job.runner import JobRunner |
48 | +from lp.services.osutils import override_environ |
49 | from lp.testing import login, login_person, TestCase, TestCaseWithFactory |
50 | from lp.testing.mail_helpers import pop_notifications |
51 | |
52 | @@ -888,12 +891,16 @@ |
53 | db_target_branch, target_tree = self.create_branch_and_tree( |
54 | tree_location='.', format=format) |
55 | target_tree.branch.set_public_branch(db_target_branch.bzr_identity) |
56 | - target_tree.commit('rev1') |
57 | - # Make sure that the created branch has been mirrored. |
58 | - removeSecurityProxy(db_target_branch).branchChanged( |
59 | - '', 'rev1', None, None, None) |
60 | - source_tree = target_tree.bzrdir.sprout('source').open_workingtree() |
61 | - source_tree.commit('rev2') |
62 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
63 | + # required to generate the revision-id. |
64 | + with override_environ(BZR_EMAIL='me@example.com'): |
65 | + target_tree.commit('rev1') |
66 | + # Make sure that the created branch has been mirrored. |
67 | + removeSecurityProxy(db_target_branch).branchChanged( |
68 | + '', 'rev1', None, None, None) |
69 | + sprout_bzrdir = target_tree.bzrdir.sprout('source') |
70 | + source_tree = sprout_bzrdir.open_workingtree() |
71 | + source_tree.commit('rev2') |
72 | message = self.factory.makeBundleMergeDirectiveEmail( |
73 | source_tree.branch, db_target_branch) |
74 | return db_target_branch, source_tree.branch, message |
75 | @@ -994,7 +1001,10 @@ |
76 | branch, source, message = self._createTargetSourceAndBundle( |
77 | format="1.9") |
78 | target_tree = WorkingTree.open('.') |
79 | - target_tree.commit('rev2b') |
80 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
81 | + # required to generate the revision-id. |
82 | + with override_environ(BZR_EMAIL='me@example.com'): |
83 | + target_tree.commit('rev2b') |
84 | bmp = self._processMergeDirective(message) |
85 | lp_branch = self._openBazaarBranchAsClient(bmp.source_branch) |
86 | self.assertEqual(source.last_revision(), lp_branch.last_revision()) |
87 | @@ -1005,20 +1015,24 @@ |
88 | db_target_branch, target_tree = self.create_branch_and_tree( |
89 | 'target', format=target_format) |
90 | target_tree.branch.set_public_branch(db_target_branch.bzr_identity) |
91 | - revid = target_tree.commit('rev1') |
92 | - removeSecurityProxy(db_target_branch).branchChanged( |
93 | - '', revid, None, None, None) |
94 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
95 | + # required to generate the revision-id. |
96 | + with override_environ(BZR_EMAIL='me@example.com'): |
97 | + revid = target_tree.commit('rev1') |
98 | + removeSecurityProxy(db_target_branch).branchChanged( |
99 | + '', revid, None, None, None) |
100 | |
101 | - db_source_branch, source_tree = self.create_branch_and_tree( |
102 | - 'lpsource', db_target_branch.product, format=source_format) |
103 | - # The branch is not scheduled to be mirrorred. |
104 | - self.assertIs(db_source_branch.next_mirror_time, None) |
105 | - source_tree.pull(target_tree.branch) |
106 | - source_tree.commit('rev2', rev_id='rev2') |
107 | - # bundle_tree is effectively behaving like a local copy of |
108 | - # db_source_branch, and is used to create the merge directive. |
109 | - bundle_tree = source_tree.bzrdir.sprout('source').open_workingtree() |
110 | - bundle_tree.commit('rev3', rev_id='rev3') |
111 | + db_source_branch, source_tree = self.create_branch_and_tree( |
112 | + 'lpsource', db_target_branch.product, format=source_format) |
113 | + # The branch is not scheduled to be mirrorred. |
114 | + self.assertIs(db_source_branch.next_mirror_time, None) |
115 | + source_tree.pull(target_tree.branch) |
116 | + source_tree.commit('rev2', rev_id='rev2') |
117 | + # bundle_tree is effectively behaving like a local copy of |
118 | + # db_source_branch, and is used to create the merge directive. |
119 | + sprout_bzrdir = source_tree.bzrdir.sprout('source') |
120 | + bundle_tree = sprout_bzrdir.open_workingtree() |
121 | + bundle_tree.commit('rev3', rev_id='rev3') |
122 | bundle_tree.branch.set_public_branch(db_source_branch.bzr_identity) |
123 | message = self.factory.makeBundleMergeDirectiveEmail( |
124 | bundle_tree.branch, db_target_branch, |
125 | |
126 | === modified file 'lib/lp/code/model/diff.py' |
127 | --- lib/lp/code/model/diff.py 2010-08-02 02:13:52 +0000 |
128 | +++ lib/lp/code/model/diff.py 2010-08-17 04:46:45 +0000 |
129 | @@ -140,7 +140,7 @@ |
130 | source_revision) |
131 | merger = Merge3Merger( |
132 | merge_target, merge_target, merge_base, merge_source, |
133 | - do_merge=False) |
134 | + this_branch=target_branch, do_merge=False) |
135 | def dummy_warning(self, *args, **kwargs): |
136 | pass |
137 | real_warning = trace.warning |
138 | |
139 | === modified file 'lib/lp/code/model/directbranchcommit.py' |
140 | --- lib/lp/code/model/directbranchcommit.py 2010-05-15 17:43:59 +0000 |
141 | +++ lib/lp/code/model/directbranchcommit.py 2010-08-17 04:46:45 +0000 |
142 | @@ -3,6 +3,8 @@ |
143 | |
144 | """Commit files straight to bzr branch.""" |
145 | |
146 | +from __future__ import with_statement |
147 | + |
148 | __metaclass__ = type |
149 | __all__ = [ |
150 | 'ConcurrentUpdateError', |
151 | @@ -19,6 +21,8 @@ |
152 | from canonical.launchpad.interfaces import IMasterObject |
153 | |
154 | from lp.codehosting.bzrutils import get_stacked_on_url |
155 | +from lp.services.osutils import override_environ |
156 | +from lp.services.mail.sendmail import format_address_for_person |
157 | |
158 | class ConcurrentUpdateError(Exception): |
159 | """Bailout exception for concurrent updates. |
160 | @@ -188,8 +192,12 @@ |
161 | if rev_id == NULL_REVISION: |
162 | if list(self.transform_preview.iter_changes()) == []: |
163 | return |
164 | - new_rev_id = self.transform_preview.commit( |
165 | - self.bzrbranch, commit_message) |
166 | + committer_id = format_address_for_person(self.committer) |
167 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
168 | + # required to generate the revision-id. |
169 | + with override_environ(BZR_EMAIL=committer_id): |
170 | + new_rev_id = self.transform_preview.commit( |
171 | + self.bzrbranch, commit_message, committer=committer_id) |
172 | IMasterObject(self.db_branch).branchChanged( |
173 | get_stacked_on_url(self.bzrbranch), new_rev_id, |
174 | self.db_branch.control_format, self.db_branch.branch_format, |
175 | |
176 | === modified file 'lib/lp/code/model/tests/test_branch.py' |
177 | --- lib/lp/code/model/tests/test_branch.py 2010-08-12 01:53:07 +0000 |
178 | +++ lib/lp/code/model/tests/test_branch.py 2010-08-17 04:46:45 +0000 |
179 | @@ -84,6 +84,7 @@ |
180 | from lp.testing.factory import LaunchpadObjectFactory |
181 | from lp.translations.model.translationtemplatesbuildjob import ( |
182 | ITranslationTemplatesBuildJobSource) |
183 | +from lp.services.osutils import override_environ |
184 | |
185 | |
186 | class TestCodeImport(TestCase): |
187 | @@ -2573,7 +2574,10 @@ |
188 | # safe_open returns the underlying bzr branch of a database branch in |
189 | # the simple, unstacked, case. |
190 | db_branch, tree = self.create_branch_and_tree() |
191 | - revid = tree.commit('') |
192 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
193 | + # required to generate the revision-id. |
194 | + with override_environ(BZR_EMAIL='me@example.com'): |
195 | + revid = tree.commit('') |
196 | bzr_branch = db_branch.getBzrBranch() |
197 | self.assertEqual(revid, bzr_branch.last_revision()) |
198 | |
199 | |
200 | === modified file 'lib/lp/code/model/tests/test_branchjob.py' |
201 | --- lib/lp/code/model/tests/test_branchjob.py 2010-07-29 08:06:07 +0000 |
202 | +++ lib/lp/code/model/tests/test_branchjob.py 2010-08-17 04:46:45 +0000 |
203 | @@ -3,6 +3,8 @@ |
204 | |
205 | """Tests for BranchJobs.""" |
206 | |
207 | +from __future__ import with_statement |
208 | + |
209 | __metaclass__ = type |
210 | |
211 | import datetime |
212 | @@ -41,6 +43,7 @@ |
213 | from lp.testing.mail_helpers import pop_notifications |
214 | from lp.services.job.interfaces.job import JobStatus |
215 | from lp.services.job.model.job import Job |
216 | +from lp.services.osutils import override_environ |
217 | from lp.code.bzr import BranchFormat, RepositoryFormat |
218 | from lp.code.enums import ( |
219 | BranchMergeProposalStatus, BranchSubscriptionDiffSize, |
220 | @@ -104,7 +107,10 @@ |
221 | """Ensure that run calculates revision ids.""" |
222 | self.useBzrBranches(direct_database=True) |
223 | branch, tree = self.create_branch_and_tree() |
224 | - tree.commit('First commit', rev_id='rev1') |
225 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
226 | + # required to generate the revision-id. |
227 | + with override_environ(BZR_EMAIL='me@example.com'): |
228 | + tree.commit('First commit', rev_id='rev1') |
229 | job = BranchDiffJob.create(branch, '0', '1') |
230 | static_diff = job.run() |
231 | self.assertEqual('null:', static_diff.from_revision_id) |
232 | @@ -122,9 +128,12 @@ |
233 | tree_file = os.path.join(tree_location, 'file') |
234 | open(tree_file, 'wb').write('foo\n') |
235 | tree.add('file') |
236 | - tree.commit('First commit') |
237 | - open(tree_file, 'wb').write('bar\n') |
238 | - tree.commit('Next commit') |
239 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
240 | + # required to generate the revision-id. |
241 | + with override_environ(BZR_EMAIL='me@example.com'): |
242 | + tree.commit('First commit') |
243 | + open(tree_file, 'wb').write('bar\n') |
244 | + tree.commit('Next commit') |
245 | job = BranchDiffJob.create(branch, '1', '2') |
246 | static_diff = job.run() |
247 | transaction.commit() |
248 | @@ -138,7 +147,10 @@ |
249 | """Ensure running an equivalent job emits the same diff.""" |
250 | self.useBzrBranches(direct_database=True) |
251 | branch, tree = self.create_branch_and_tree() |
252 | - tree.commit('First commit') |
253 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
254 | + # required to generate the revision-id. |
255 | + with override_environ(BZR_EMAIL='me@example.com'): |
256 | + tree.commit('First commit') |
257 | job1 = BranchDiffJob.create(branch, '0', '1') |
258 | static_diff1 = job1.run() |
259 | job2 = BranchDiffJob.create(branch, '0', '1') |
260 | @@ -157,7 +169,10 @@ |
261 | tree_transport = tree.bzrdir.root_transport |
262 | tree_transport.put_bytes("hello.txt", "Hello World\n") |
263 | tree.add('hello.txt') |
264 | - tree.commit('rev1', timestamp=1e9, timezone=0) |
265 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
266 | + # required to generate the revision-id. |
267 | + with override_environ(BZR_EMAIL='me@example.com'): |
268 | + tree.commit('rev1', timestamp=1e9, timezone=0) |
269 | job = BranchDiffJob.create(branch, '0', '1') |
270 | diff = job.run() |
271 | transaction.commit() |
272 | @@ -202,20 +217,23 @@ |
273 | self.useBzrBranches(direct_database=True) |
274 | |
275 | db_branch, bzr_tree = self.create_branch_and_tree() |
276 | - bzr_tree.commit('First commit', rev_id='rev1') |
277 | - bzr_tree.commit('Second commit', rev_id='rev2') |
278 | - bzr_tree.commit('Third commit', rev_id='rev3') |
279 | - LaunchpadZopelessLayer.commit() |
280 | - |
281 | - job = BranchScanJob.create(db_branch) |
282 | - LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser) |
283 | - job.run() |
284 | - LaunchpadZopelessLayer.switchDbUser(config.launchpad.dbuser) |
285 | - |
286 | - self.assertEqual(db_branch.revision_count, 3) |
287 | - |
288 | - bzr_tree.commit('Fourth commit', rev_id='rev4') |
289 | - bzr_tree.commit('Fifth commit', rev_id='rev5') |
290 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
291 | + # required to generate the revision-id. |
292 | + with override_environ(BZR_EMAIL='me@example.com'): |
293 | + bzr_tree.commit('First commit', rev_id='rev1') |
294 | + bzr_tree.commit('Second commit', rev_id='rev2') |
295 | + bzr_tree.commit('Third commit', rev_id='rev3') |
296 | + LaunchpadZopelessLayer.commit() |
297 | + |
298 | + job = BranchScanJob.create(db_branch) |
299 | + LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser) |
300 | + job.run() |
301 | + LaunchpadZopelessLayer.switchDbUser(config.launchpad.dbuser) |
302 | + |
303 | + self.assertEqual(db_branch.revision_count, 3) |
304 | + |
305 | + bzr_tree.commit('Fourth commit', rev_id='rev4') |
306 | + bzr_tree.commit('Fifth commit', rev_id='rev5') |
307 | |
308 | job = BranchScanJob.create(db_branch) |
309 | LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser) |
310 | @@ -381,7 +399,10 @@ |
311 | branch, tree = self.create_branch_and_tree() |
312 | tree.bzrdir.root_transport.put_bytes('foo', 'bar\n') |
313 | tree.add('foo') |
314 | - tree.commit('First commit') |
315 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
316 | + # required to generate the revision-id. |
317 | + with override_environ(BZR_EMAIL='me@example.com'): |
318 | + tree.commit('First commit') |
319 | job = RevisionMailJob.create( |
320 | branch, 1, 'from@example.com', 'hello', True, 'subject') |
321 | mailer = job.getMailer() |
322 | @@ -477,9 +498,12 @@ |
323 | branch, tree = self.create_branch_and_tree() |
324 | tree.lock_write() |
325 | try: |
326 | - tree.commit('rev1', rev_id='rev1') |
327 | - tree.commit('rev2', rev_id='rev2') |
328 | - tree.commit('rev3', rev_id='rev3') |
329 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
330 | + # required to generate the revision-id. |
331 | + with override_environ(BZR_EMAIL='me@example.com'): |
332 | + tree.commit('rev1', rev_id='rev1') |
333 | + tree.commit('rev2', rev_id='rev2') |
334 | + tree.commit('rev3', rev_id='rev3') |
335 | transaction.commit() |
336 | self.layer.switchDbUser('branchscanner') |
337 | self.updateDBRevisions( |
338 | @@ -504,7 +528,10 @@ |
339 | branch, tree = self.create3CommitsBranch() |
340 | tree.pull(tree.branch, overwrite=True, stop_revision='rev2') |
341 | tree.add_parent_tree_id('rev3') |
342 | - tree.commit('rev3a', rev_id='rev3a') |
343 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
344 | + # required to generate the revision-id. |
345 | + with override_environ(BZR_EMAIL='me@example.com'): |
346 | + tree.commit('rev3a', rev_id='rev3a') |
347 | self.updateDBRevisions(branch, tree.branch, ['rev3', 'rev3a']) |
348 | job = RevisionsAddedJob.create(branch, 'rev1', 'rev3', '') |
349 | job.bzr_branch.lock_read() |
350 | @@ -542,9 +569,12 @@ |
351 | tree.branch.nick = 'nicholas' |
352 | tree.lock_write() |
353 | self.addCleanup(tree.unlock) |
354 | - tree.commit( |
355 | - 'rev1', rev_id='rev1', timestamp=1000, timezone=0, |
356 | - committer='J. Random Hacker <jrandom@example.org>') |
357 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
358 | + # required to generate the revision-id. |
359 | + with override_environ(BZR_EMAIL='me@example.com'): |
360 | + tree.commit( |
361 | + 'rev1', rev_id='rev1', timestamp=1000, timezone=0, |
362 | + committer='J. Random Hacker <jrandom@example.org>') |
363 | return branch, tree |
364 | |
365 | def makeRevisionsAddedWithMergeCommit(self, authors=None, |
366 | @@ -558,20 +588,23 @@ |
367 | self.useBzrBranches(direct_database=True) |
368 | branch, tree = self.create_branch_and_tree() |
369 | tree.branch.nick = 'nicholas' |
370 | - tree.commit('rev1') |
371 | - tree2 = tree.bzrdir.sprout('tree2').open_workingtree() |
372 | - tree2.commit('rev2a', rev_id='rev2a-id', committer='foo@') |
373 | - tree2.commit('rev3', rev_id='rev3-id', |
374 | - authors=['bar@', 'baz@blaine.com']) |
375 | - tree.merge_from_branch(tree2.branch) |
376 | - tree3 = tree.bzrdir.sprout('tree3').open_workingtree() |
377 | - tree3.commit('rev2b', rev_id='rev2b-id', committer='qux@') |
378 | - tree.merge_from_branch(tree3.branch, force=True) |
379 | - if include_ghost: |
380 | - tree.add_parent_tree_id('rev2c-id') |
381 | - tree.commit('rev2d', rev_id='rev2d-id', timestamp=1000, timezone=0, |
382 | - committer='J. Random Hacker <jrandom@example.org>', |
383 | - authors=authors) |
384 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
385 | + # required to generate the revision-id. |
386 | + with override_environ(BZR_EMAIL='me@example.com'): |
387 | + tree.commit('rev1') |
388 | + tree2 = tree.bzrdir.sprout('tree2').open_workingtree() |
389 | + tree2.commit('rev2a', rev_id='rev2a-id', committer='foo@') |
390 | + tree2.commit('rev3', rev_id='rev3-id', |
391 | + authors=['bar@', 'baz@blaine.com']) |
392 | + tree.merge_from_branch(tree2.branch) |
393 | + tree3 = tree.bzrdir.sprout('tree3').open_workingtree() |
394 | + tree3.commit('rev2b', rev_id='rev2b-id', committer='qux@') |
395 | + tree.merge_from_branch(tree3.branch, force=True) |
396 | + if include_ghost: |
397 | + tree.add_parent_tree_id('rev2c-id') |
398 | + tree.commit('rev2d', rev_id='rev2d-id', timestamp=1000, timezone=0, |
399 | + committer='J. Random Hacker <jrandom@example.org>', |
400 | + authors=authors) |
401 | return RevisionsAddedJob.create(branch, 'rev2d-id', 'rev2d-id', '') |
402 | |
403 | def test_getMergedRevisionIDs(self): |
404 | @@ -817,17 +850,20 @@ |
405 | first_revision = 'rev-1' |
406 | tree.bzrdir.root_transport.put_bytes('hello.txt', 'Hello World\n') |
407 | tree.add('hello.txt') |
408 | - tree.commit( |
409 | - rev_id=first_revision, message="Log message", |
410 | - committer="Joe Bloggs <joe@example.com>", timestamp=1000000000.0, |
411 | - timezone=0) |
412 | - tree.bzrdir.root_transport.put_bytes( |
413 | - 'hello.txt', 'Hello World\n\nFoo Bar\n') |
414 | - second_revision = 'rev-2' |
415 | - tree.commit( |
416 | - rev_id=second_revision, message="Extended contents", |
417 | - committer="Joe Bloggs <joe@example.com>", timestamp=1000100000.0, |
418 | - timezone=0) |
419 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
420 | + # required to generate the revision-id. |
421 | + with override_environ(BZR_EMAIL='me@example.com'): |
422 | + tree.commit( |
423 | + rev_id=first_revision, message="Log message", |
424 | + committer="Joe Bloggs <joe@example.com>", |
425 | + timestamp=1000000000.0, timezone=0) |
426 | + tree.bzrdir.root_transport.put_bytes( |
427 | + 'hello.txt', 'Hello World\n\nFoo Bar\n') |
428 | + second_revision = 'rev-2' |
429 | + tree.commit( |
430 | + rev_id=second_revision, message="Extended contents", |
431 | + committer="Joe Bloggs <joe@example.com>", |
432 | + timestamp=1000100000.0, timezone=0) |
433 | transaction.commit() |
434 | self.layer.switchDbUser('branchscanner') |
435 | self.updateDBRevisions(db_branch, tree.branch) |
436 | @@ -874,9 +910,13 @@ |
437 | self.useBzrBranches(direct_database=True) |
438 | db_branch, tree = self.create_branch_and_tree() |
439 | rev_id = 'rev-1' |
440 | - tree.commit( |
441 | - rev_id=rev_id, message=u"Non ASCII: \xe9", |
442 | - committer=u"Non ASCII: \xed", timestamp=1000000000.0, timezone=0) |
443 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
444 | + # required to generate the revision-id. |
445 | + with override_environ(BZR_EMAIL='me@example.com'): |
446 | + tree.commit( |
447 | + rev_id=rev_id, message=u"Non ASCII: \xe9", |
448 | + committer=u"Non ASCII: \xed", timestamp=1000000000.0, |
449 | + timezone=0) |
450 | transaction.commit() |
451 | self.layer.switchDbUser('branchscanner') |
452 | self.updateDBRevisions(db_branch, tree.branch) |
453 | @@ -986,7 +1026,10 @@ |
454 | [self.tree.abspath(file_pair[0]) for file_pair in files]) |
455 | if commit_message is None: |
456 | commit_message = self.factory.getUniqueString('commit') |
457 | - revision_id = self.tree.commit(commit_message) |
458 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
459 | + # required to generate the revision-id. |
460 | + with override_environ(BZR_EMAIL='me@example.com'): |
461 | + revision_id = self.tree.commit(commit_message) |
462 | self.branch.last_scanned_id = revision_id |
463 | self.branch.last_mirrored_id = revision_id |
464 | return revision_id |
465 | |
466 | === modified file 'lib/lp/code/model/tests/test_branchmergeproposaljobs.py' |
467 | --- lib/lp/code/model/tests/test_branchmergeproposaljobs.py 2010-06-11 01:51:15 +0000 |
468 | +++ lib/lp/code/model/tests/test_branchmergeproposaljobs.py 2010-08-17 04:46:45 +0000 |
469 | @@ -3,6 +3,8 @@ |
470 | |
471 | """Tests for branch merge proposal jobs.""" |
472 | |
473 | +from __future__ import with_statement |
474 | + |
475 | __metaclass__ = type |
476 | |
477 | from datetime import datetime, timedelta |
478 | @@ -39,6 +41,7 @@ |
479 | from lp.code.subscribers.branchmergeproposal import merge_proposal_modified |
480 | from lp.services.job.runner import JobRunner |
481 | from lp.services.job.model.job import Job |
482 | +from lp.services.osutils import override_environ |
483 | from lp.testing import TestCaseWithFactory |
484 | from lp.testing.mail_helpers import pop_notifications |
485 | |
486 | @@ -104,7 +107,10 @@ |
487 | |
488 | def createProposalWithEmptyBranches(self): |
489 | target_branch, tree = self.create_branch_and_tree() |
490 | - tree.commit('test') |
491 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
492 | + # required to generate the revision-id. |
493 | + with override_environ(BZR_EMAIL='me@example.com'): |
494 | + tree.commit('test') |
495 | source_branch = self.factory.makeProductBranch( |
496 | product=target_branch.product) |
497 | self.createBzrBranch(source_branch, tree.branch) |
498 | @@ -137,7 +143,10 @@ |
499 | bmp = self.factory.makeBranchMergeProposal( |
500 | target_branch=self.factory.makePackageBranch()) |
501 | tree = self.create_branch_and_tree(db_branch=bmp.target_branch)[1] |
502 | - tree.commit('Initial commit') |
503 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
504 | + # required to generate the revision-id. |
505 | + with override_environ(BZR_EMAIL='me@example.com'): |
506 | + tree.commit('Initial commit') |
507 | self.createBzrBranch(bmp.source_branch, tree.branch) |
508 | self.factory.makeRevisionsForBranch(bmp.source_branch, count=1) |
509 | job = MergeProposalCreatedJob.create(bmp) |
510 | |
511 | === modified file 'lib/lp/code/model/tests/test_diff.py' |
512 | --- lib/lp/code/model/tests/test_diff.py 2010-08-02 02:13:52 +0000 |
513 | +++ lib/lp/code/model/tests/test_diff.py 2010-08-17 04:46:45 +0000 |
514 | @@ -3,6 +3,8 @@ |
515 | |
516 | """Tests for Diff, etc.""" |
517 | |
518 | +from __future__ import with_statement |
519 | + |
520 | __metaclass__ = type |
521 | |
522 | |
523 | @@ -26,6 +28,7 @@ |
524 | from lp.code.interfaces.diff import ( |
525 | IDiff, IPreviewDiff, IStaticDiff, IStaticDiffSource) |
526 | from lp.testing import login, login_person, TestCaseWithFactory |
527 | +from lp.services.osutils import override_environ |
528 | |
529 | |
530 | class RecordLister(logging.Handler): |
531 | @@ -285,7 +288,10 @@ |
532 | """Ensure that acquire returns the existing StaticDiff.""" |
533 | self.useBzrBranches(direct_database=True) |
534 | branch, tree = self.create_branch_and_tree() |
535 | - tree.commit('First commit', rev_id='rev1') |
536 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
537 | + # required to generate the revision-id. |
538 | + with override_environ(BZR_EMAIL='me@example.com'): |
539 | + tree.commit('First commit', rev_id='rev1') |
540 | diff1 = StaticDiff.acquire('null:', 'rev1', tree.branch.repository) |
541 | diff2 = StaticDiff.acquire('null:', 'rev1', tree.branch.repository) |
542 | self.assertIs(diff1, diff2) |
543 | @@ -294,7 +300,10 @@ |
544 | """The existing object is used even if the repository is different.""" |
545 | self.useBzrBranches(direct_database=True) |
546 | branch1, tree1 = self.create_branch_and_tree('tree1') |
547 | - tree1.commit('First commit', rev_id='rev1') |
548 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
549 | + # required to generate the revision-id. |
550 | + with override_environ(BZR_EMAIL='me@example.com'): |
551 | + tree1.commit('First commit', rev_id='rev1') |
552 | branch2, tree2 = self.create_branch_and_tree('tree2') |
553 | tree2.pull(tree1.branch) |
554 | diff1 = StaticDiff.acquire('null:', 'rev1', tree1.branch.repository) |
555 | @@ -305,8 +314,11 @@ |
556 | """A new object is created if there is no existant matching object.""" |
557 | self.useBzrBranches(direct_database=True) |
558 | branch, tree = self.create_branch_and_tree() |
559 | - tree.commit('First commit', rev_id='rev1') |
560 | - tree.commit('Next commit', rev_id='rev2') |
561 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
562 | + # required to generate the revision-id. |
563 | + with override_environ(BZR_EMAIL='me@example.com'): |
564 | + tree.commit('First commit', rev_id='rev1') |
565 | + tree.commit('Next commit', rev_id='rev2') |
566 | diff1 = StaticDiff.acquire('null:', 'rev1', tree.branch.repository) |
567 | diff2 = StaticDiff.acquire('rev1', 'rev2', tree.branch.repository) |
568 | self.assertIsNot(diff1, diff2) |
569 | |
570 | === modified file 'lib/lp/code/scripts/tests/test_scan_branches.py' |
571 | --- lib/lp/code/scripts/tests/test_scan_branches.py 2010-06-07 09:11:06 +0000 |
572 | +++ lib/lp/code/scripts/tests/test_scan_branches.py 2010-08-17 04:46:45 +0000 |
573 | @@ -6,6 +6,8 @@ |
574 | """Test the scan_branches script.""" |
575 | |
576 | |
577 | +from __future__ import with_statement |
578 | + |
579 | from storm.locals import Store |
580 | import transaction |
581 | |
582 | @@ -17,6 +19,7 @@ |
583 | CodeReviewNotificationLevel) |
584 | from lp.code.model.branchjob import BranchJob, BranchJobType, BranchScanJob |
585 | from lp.services.job.model.job import Job, JobStatus |
586 | +from lp.services.osutils import override_environ |
587 | |
588 | |
589 | class TestScanBranches(TestCaseWithFactory): |
590 | @@ -27,9 +30,12 @@ |
591 | def make_branch_with_commits_and_scan_job(self, db_branch): |
592 | """Create a branch from a db_branch, make commits and a scan job.""" |
593 | target, target_tree = self.create_branch_and_tree(db_branch=db_branch) |
594 | - target_tree.commit('First commit', rev_id='rev1') |
595 | - target_tree.commit('Second commit', rev_id='rev2') |
596 | - target_tree.commit('Third commit', rev_id='rev3') |
597 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
598 | + # required to generate the revision-id. |
599 | + with override_environ(BZR_EMAIL='me@example.com'): |
600 | + target_tree.commit('First commit', rev_id='rev1') |
601 | + target_tree.commit('Second commit', rev_id='rev2') |
602 | + target_tree.commit('Third commit', rev_id='rev3') |
603 | BranchScanJob.create(db_branch) |
604 | transaction.commit() |
605 | |
606 | |
607 | === modified file 'lib/lp/code/scripts/tests/test_sendbranchmail.py' |
608 | --- lib/lp/code/scripts/tests/test_sendbranchmail.py 2010-06-07 09:11:06 +0000 |
609 | +++ lib/lp/code/scripts/tests/test_sendbranchmail.py 2010-08-17 04:46:45 +0000 |
610 | @@ -5,6 +5,8 @@ |
611 | |
612 | """Test the sendbranchmail script""" |
613 | |
614 | +from __future__ import with_statement |
615 | + |
616 | import unittest |
617 | import transaction |
618 | |
619 | @@ -16,6 +18,7 @@ |
620 | from lp.code.model.branchjob import ( |
621 | RevisionMailJob, RevisionsAddedJob) |
622 | from lp.testing import TestCaseWithFactory |
623 | +from lp.services.osutils import override_environ |
624 | |
625 | |
626 | class TestSendbranchmail(TestCaseWithFactory): |
627 | @@ -33,7 +36,10 @@ |
628 | transport = tree.bzrdir.root_transport |
629 | transport.put_bytes('foo', 'bar') |
630 | tree.add('foo') |
631 | - tree.commit('Added foo.', rev_id='rev1') |
632 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
633 | + # required to generate the revision-id. |
634 | + with override_environ(BZR_EMAIL='me@example.com'): |
635 | + tree.commit('Added foo.', rev_id='rev1') |
636 | return branch, tree |
637 | |
638 | def test_sendbranchmail(self): |
639 | @@ -73,7 +79,10 @@ |
640 | self.useBzrBranches() |
641 | branch, tree = self.createBranch() |
642 | tree.bzrdir.root_transport.put_bytes('foo', 'baz') |
643 | - tree.commit('Added foo.', rev_id='rev2') |
644 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
645 | + # required to generate the revision-id. |
646 | + with override_environ(BZR_EMAIL='me@example.com'): |
647 | + tree.commit('Added foo.', rev_id='rev2') |
648 | RevisionsAddedJob.create( |
649 | branch, 'rev1', 'rev2', 'from@example.org') |
650 | transaction.commit() |
651 | |
652 | === modified file 'lib/lp/codehosting/codeimport/tests/test_worker.py' |
653 | --- lib/lp/codehosting/codeimport/tests/test_worker.py 2010-08-02 23:01:15 +0000 |
654 | +++ lib/lp/codehosting/codeimport/tests/test_worker.py 2010-08-17 04:46:45 +0000 |
655 | @@ -952,7 +952,7 @@ |
656 | t = get_transport(self.get_url('.')) |
657 | t.mkdir('reference') |
658 | a_bzrdir = BzrDir.create(self.get_url('reference')) |
659 | - BranchReferenceFormat().initialize(a_bzrdir, branch) |
660 | + BranchReferenceFormat().initialize(a_bzrdir, target_branch=branch) |
661 | return a_bzrdir.root_transport.base |
662 | |
663 | def test_reject_branch_reference(self): |
664 | |
665 | === modified file 'lib/lp/codehosting/codeimport/uifactory.py' |
666 | --- lib/lp/codehosting/codeimport/uifactory.py 2009-08-24 16:27:33 +0000 |
667 | +++ lib/lp/codehosting/codeimport/uifactory.py 2010-08-17 04:46:45 +0000 |
668 | @@ -75,6 +75,24 @@ |
669 | # There's no point showing a progress bar in a flat log. |
670 | return '' |
671 | |
672 | + def _render_line(self): |
673 | + bar_string = self._render_bar() |
674 | + if self._last_task: |
675 | + task_part, counter_part = self._format_task(self._last_task) |
676 | + else: |
677 | + task_part = counter_part = '' |
678 | + if self._last_task and not self._last_task.show_transport_activity: |
679 | + trans = '' |
680 | + else: |
681 | + trans = self._last_transport_msg |
682 | + # the bar separates the transport activity from the message, so even |
683 | + # if there's no bar or spinner, we must show something if both those |
684 | + # fields are present |
685 | + if (task_part and trans) and not bar_string: |
686 | + bar_string = ' | ' |
687 | + s = trans + bar_string + task_part + counter_part |
688 | + return s |
689 | + |
690 | def _format_transport_msg(self, scheme, dir_char, rate): |
691 | # We just report the amount of data transferred. |
692 | return '%s bytes transferred' % self._bytes_since_update |
693 | |
694 | === modified file 'lib/lp/codehosting/puller/worker.py' |
695 | --- lib/lp/codehosting/puller/worker.py 2010-04-21 01:56:51 +0000 |
696 | +++ lib/lp/codehosting/puller/worker.py 2010-08-17 04:46:45 +0000 |
697 | @@ -503,7 +503,7 @@ |
698 | def get_boolean(self, prompt): |
699 | """If we're asked to break a lock like a stale lock of ours, say yes. |
700 | """ |
701 | - assert prompt.startswith('Break lock'), ( |
702 | + assert prompt.startswith('Break '), ( |
703 | "Didn't expect prompt %r" % (prompt,)) |
704 | branch_id = self.puller_worker_protocol.branch_id |
705 | if get_lock_id_for_branch_id(branch_id) in prompt: |
706 | |
707 | === modified file 'lib/lp/codehosting/scanner/tests/test_buglinks.py' |
708 | --- lib/lp/codehosting/scanner/tests/test_buglinks.py 2010-08-02 02:13:52 +0000 |
709 | +++ lib/lp/codehosting/scanner/tests/test_buglinks.py 2010-08-17 04:46:45 +0000 |
710 | @@ -3,6 +3,8 @@ |
711 | |
712 | """Tests for creating BugBranch items based on Bazaar revisions.""" |
713 | |
714 | +from __future__ import with_statement |
715 | + |
716 | __metaclass__ = type |
717 | |
718 | import unittest |
719 | @@ -22,6 +24,7 @@ |
720 | from lp.codehosting.scanner.tests.test_bzrsync import BzrSyncTestCase |
721 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
722 | from lp.testing import TestCase, TestCaseWithFactory |
723 | +from lp.services.osutils import override_environ |
724 | |
725 | |
726 | class RevisionPropertyParsing(TestCase): |
727 | @@ -189,28 +192,31 @@ |
728 | """Don't add BugBranches based on non-mainline revisions.""" |
729 | # Make the base revision. |
730 | author = self.factory.getUniqueString() |
731 | - self.bzr_tree.commit( |
732 | - u'common parent', committer=author, rev_id='r1', |
733 | - allow_pointless=True) |
734 | - |
735 | - # Branch from the base revision. |
736 | - new_tree = self.make_branch_and_tree('bzr_branch_merged') |
737 | - new_tree.pull(self.bzr_branch) |
738 | - |
739 | - # Commit to both branches |
740 | - self.bzr_tree.commit( |
741 | - u'commit one', committer=author, rev_id='r2', |
742 | - allow_pointless=True) |
743 | - new_tree.commit( |
744 | - u'commit two', committer=author, rev_id='r1.1.1', |
745 | - allow_pointless=True, |
746 | - revprops={'bugs': '%s fixed' % self.getBugURL(self.bug1)}) |
747 | - |
748 | - # Merge and commit. |
749 | - self.bzr_tree.merge_from_branch(new_tree.branch) |
750 | - self.bzr_tree.commit( |
751 | - u'merge', committer=author, rev_id='r3', |
752 | - allow_pointless=True) |
753 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
754 | + # required to generate the revision-id. |
755 | + with override_environ(BZR_EMAIL='me@example.com'): |
756 | + self.bzr_tree.commit( |
757 | + u'common parent', committer=author, rev_id='r1', |
758 | + allow_pointless=True) |
759 | + |
760 | + # Branch from the base revision. |
761 | + new_tree = self.make_branch_and_tree('bzr_branch_merged') |
762 | + new_tree.pull(self.bzr_branch) |
763 | + |
764 | + # Commit to both branches |
765 | + self.bzr_tree.commit( |
766 | + u'commit one', committer=author, rev_id='r2', |
767 | + allow_pointless=True) |
768 | + new_tree.commit( |
769 | + u'commit two', committer=author, rev_id='r1.1.1', |
770 | + allow_pointless=True, |
771 | + revprops={'bugs': '%s fixed' % self.getBugURL(self.bug1)}) |
772 | + |
773 | + # Merge and commit. |
774 | + self.bzr_tree.merge_from_branch(new_tree.branch) |
775 | + self.bzr_tree.commit( |
776 | + u'merge', committer=author, rev_id='r3', |
777 | + allow_pointless=True) |
778 | |
779 | self.syncBazaarBranchToDatabase(self.bzr_branch, self.db_branch) |
780 | self.assertEqual( |
781 | @@ -251,8 +257,12 @@ |
782 | bug = self.factory.makeBug() |
783 | self.layer.txn.commit() |
784 | LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser) |
785 | - revision_id = tree.commit('fix revision', |
786 | - revprops={'bugs': 'https://launchpad.net/bugs/%d fixed' % bug.id}) |
787 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
788 | + # required to generate the revision-id. |
789 | + with override_environ(BZR_EMAIL='me@example.com'): |
790 | + revision_id = tree.commit('fix revision', |
791 | + revprops={ |
792 | + 'bugs': 'https://launchpad.net/bugs/%d fixed' % bug.id}) |
793 | bzr_revision = tree.branch.repository.get_revision(revision_id) |
794 | revno = 1 |
795 | revision_set = getUtility(IRevisionSet) |
796 | |
797 | === modified file 'lib/lp/codehosting/scanner/tests/test_bzrsync.py' |
798 | --- lib/lp/codehosting/scanner/tests/test_bzrsync.py 2010-07-14 14:48:46 +0000 |
799 | +++ lib/lp/codehosting/scanner/tests/test_bzrsync.py 2010-08-17 04:46:45 +0000 |
800 | @@ -5,6 +5,8 @@ |
801 | |
802 | # pylint: disable-msg=W0141 |
803 | |
804 | +from __future__ import with_statement |
805 | + |
806 | import datetime |
807 | import os |
808 | import random |
809 | @@ -32,6 +34,7 @@ |
810 | from lp.codehosting.scanner.bzrsync import BzrSync |
811 | from lp.testing import TestCaseWithFactory |
812 | from canonical.testing import LaunchpadZopelessLayer |
813 | +from lp.services.osutils import override_environ |
814 | |
815 | |
816 | def run_as_db_user(username): |
817 | @@ -160,10 +163,13 @@ |
818 | committer = self.factory.getUniqueString() |
819 | if extra_parents is not None: |
820 | self.bzr_tree.add_pending_merge(*extra_parents) |
821 | - return self.bzr_tree.commit( |
822 | - message, committer=committer, rev_id=rev_id, |
823 | - timestamp=timestamp, timezone=timezone, allow_pointless=True, |
824 | - revprops=revprops) |
825 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
826 | + # required to generate the revision-id. |
827 | + with override_environ(BZR_EMAIL='me@example.com'): |
828 | + return self.bzr_tree.commit( |
829 | + message, committer=committer, rev_id=rev_id, |
830 | + timestamp=timestamp, timezone=timezone, allow_pointless=True, |
831 | + revprops=revprops) |
832 | |
833 | def uncommitRevision(self): |
834 | branch = self.bzr_tree.branch |
835 | @@ -207,21 +213,24 @@ |
836 | db_branch = self.makeDatabaseBranch() |
837 | db_branch, trunk_tree = self.create_branch_and_tree( |
838 | db_branch=db_branch) |
839 | - trunk_tree.commit(u'base revision', rev_id=base_rev_id) |
840 | - |
841 | - # Branch from the base revision. |
842 | - new_db_branch = self.makeDatabaseBranch(product=db_branch.product) |
843 | - new_db_branch, branch_tree = self.create_branch_and_tree( |
844 | - db_branch=new_db_branch) |
845 | - branch_tree.pull(trunk_tree.branch) |
846 | - |
847 | - # Commit to both branches. |
848 | - trunk_tree.commit(u'trunk revision', rev_id=trunk_rev_id) |
849 | - branch_tree.commit(u'branch revision', rev_id=branch_rev_id) |
850 | - |
851 | - # Merge branch into trunk. |
852 | - trunk_tree.merge_from_branch(branch_tree.branch) |
853 | - trunk_tree.commit(u'merge revision', rev_id=merge_rev_id) |
854 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
855 | + # required to generate the revision-id. |
856 | + with override_environ(BZR_EMAIL='me@example.com'): |
857 | + trunk_tree.commit(u'base revision', rev_id=base_rev_id) |
858 | + |
859 | + # Branch from the base revision. |
860 | + new_db_branch = self.makeDatabaseBranch(product=db_branch.product) |
861 | + new_db_branch, branch_tree = self.create_branch_and_tree( |
862 | + db_branch=new_db_branch) |
863 | + branch_tree.pull(trunk_tree.branch) |
864 | + |
865 | + # Commit to both branches. |
866 | + trunk_tree.commit(u'trunk revision', rev_id=trunk_rev_id) |
867 | + branch_tree.commit(u'branch revision', rev_id=branch_rev_id) |
868 | + |
869 | + # Merge branch into trunk. |
870 | + trunk_tree.merge_from_branch(branch_tree.branch) |
871 | + trunk_tree.commit(u'merge revision', rev_id=merge_rev_id) |
872 | |
873 | LaunchpadZopelessLayer.txn.commit() |
874 | LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser) |
875 | |
876 | === modified file 'lib/lp/codehosting/scanner/tests/test_mergedetection.py' |
877 | --- lib/lp/codehosting/scanner/tests/test_mergedetection.py 2010-04-12 17:02:16 +0000 |
878 | +++ lib/lp/codehosting/scanner/tests/test_mergedetection.py 2010-08-17 04:46:45 +0000 |
879 | @@ -3,6 +3,8 @@ |
880 | |
881 | """Tests for the scanner's merge detection.""" |
882 | |
883 | +from __future__ import with_statement |
884 | + |
885 | __metaclass__ = type |
886 | |
887 | import logging |
888 | @@ -27,6 +29,7 @@ |
889 | BranchMergeProposalJob, BranchMergeProposalJobFactory, |
890 | BranchMergeProposalJobType) |
891 | from lp.code.interfaces.branchlookup import IBranchLookup |
892 | +from lp.services.osutils import override_environ |
893 | from lp.testing import TestCase, TestCaseWithFactory |
894 | from lp.testing.mail_helpers import pop_notifications |
895 | |
896 | @@ -129,7 +132,10 @@ |
897 | proposal, db_trunk, db_branch, branch_tree = ( |
898 | self._createBranchesAndProposal()) |
899 | |
900 | - branch_tree.commit(u'another revision', rev_id='another-rev') |
901 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
902 | + # required to generate the revision-id. |
903 | + with override_environ(BZR_EMAIL='me@example.com'): |
904 | + branch_tree.commit(u'another revision', rev_id='another-rev') |
905 | current_proposal_status = proposal.queue_status |
906 | self.assertNotEqual( |
907 | current_proposal_status, |
908 | @@ -147,7 +153,10 @@ |
909 | proposal, db_trunk, db_branch, branch_tree = ( |
910 | self._createBranchesAndProposal()) |
911 | |
912 | - branch_tree.commit(u'another revision', rev_id='another-rev') |
913 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
914 | + # required to generate the revision-id. |
915 | + with override_environ(BZR_EMAIL='me@example.com'): |
916 | + branch_tree.commit(u'another revision', rev_id='another-rev') |
917 | current_proposal_status = proposal.queue_status |
918 | self.assertNotEqual( |
919 | current_proposal_status, |
920 | |
921 | === modified file 'lib/lp/codehosting/tests/test_acceptance.py' |
922 | --- lib/lp/codehosting/tests/test_acceptance.py 2010-08-05 11:56:34 +0000 |
923 | +++ lib/lp/codehosting/tests/test_acceptance.py 2010-08-17 04:46:45 +0000 |
924 | @@ -242,10 +242,7 @@ |
925 | creator_id, '/~%s/%s/%s' % (user, product, branch)) |
926 | branch_url = 'file://' + os.path.abspath( |
927 | os.path.join(branch_root, branch_id_to_path(branch_id))) |
928 | - self.runInChdir( |
929 | - self.local_branch_path, |
930 | - self.run_bzr, ['push', '--create-prefix', branch_url], |
931 | - retcode=None) |
932 | + self.push(self.local_branch_path, branch_url, ['--create-prefix']) |
933 | return branch_url |
934 | |
935 | |
936 | |
937 | === modified file 'lib/lp/codehosting/tests/test_branchdistro.py' |
938 | --- lib/lp/codehosting/tests/test_branchdistro.py 2010-04-23 05:49:08 +0000 |
939 | +++ lib/lp/codehosting/tests/test_branchdistro.py 2010-08-17 04:46:45 +0000 |
940 | @@ -4,6 +4,8 @@ |
941 | """Tests for making new source package branches just after a distro release. |
942 | """ |
943 | |
944 | +from __future__ import with_statement |
945 | + |
946 | __metaclass__ = type |
947 | |
948 | import os |
949 | @@ -32,6 +34,7 @@ |
950 | from lp.codehosting.vfs import branch_id_to_path |
951 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
952 | from lp.testing import TestCaseWithFactory |
953 | +from lp.services.osutils import override_environ |
954 | |
955 | |
956 | # We say "RELEASE" often enough to not want to say "PackagePublishingPocket." |
957 | @@ -66,7 +69,10 @@ |
958 | old_branch = FakeBranch(1) |
959 | self.get_transport(old_branch.unique_name).create_prefix() |
960 | tree = self.make_branch_and_tree(old_branch.unique_name) |
961 | - tree.commit(message='.') |
962 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
963 | + # required to generate the revision-id. |
964 | + with override_environ(BZR_EMAIL='me@example.com'): |
965 | + tree.commit(message='.') |
966 | |
967 | new_branch = FakeBranch(2) |
968 | |
969 | @@ -119,7 +125,10 @@ |
970 | |
971 | _, tree = self.create_branch_and_tree( |
972 | tree_location=self.factory.getUniqueString(), db_branch=db_branch) |
973 | - tree.commit('') |
974 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
975 | + # required to generate the revision-id. |
976 | + with override_environ(BZR_EMAIL='me@example.com'): |
977 | + tree.commit('') |
978 | |
979 | return db_branch |
980 | |
981 | @@ -484,8 +493,11 @@ |
982 | brancher.makeOneNewBranch(db_branch) |
983 | url = 'lp-internal:///' + db_branch.unique_name |
984 | old_bzr_branch = Branch.open(url) |
985 | - old_bzr_branch.create_checkout( |
986 | - self.factory.getUniqueString()).commit('') |
987 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
988 | + # required to generate the revision-id. |
989 | + with override_environ(BZR_EMAIL='me@example.com'): |
990 | + old_bzr_branch.create_checkout( |
991 | + self.factory.getUniqueString()).commit('') |
992 | ok = brancher.checkOneBranch(db_branch) |
993 | self.assertLogMessages([ |
994 | '^WARNING Repository at lp-internal:///.*/.*/.*/.* has 1 ' |
995 | |
996 | === modified file 'lib/lp/codehosting/tests/test_bzrutils.py' |
997 | --- lib/lp/codehosting/tests/test_bzrutils.py 2010-04-23 01:47:30 +0000 |
998 | +++ lib/lp/codehosting/tests/test_bzrutils.py 2010-08-17 04:46:45 +0000 |
999 | @@ -14,7 +14,7 @@ |
1000 | from bzrlib.branch import Branch, BranchReferenceFormat |
1001 | from bzrlib.bzrdir import BzrDir, format_registry |
1002 | from bzrlib.remote import RemoteBranch |
1003 | -from bzrlib.smart import server |
1004 | +from bzrlib.tests import test_server |
1005 | from bzrlib.tests import ( |
1006 | multiply_tests, TestCase, TestCaseWithTransport, TestLoader, |
1007 | TestNotApplicable) |
1008 | @@ -191,7 +191,7 @@ |
1009 | # of the branch, repo and bzrdir, even if the branch is a |
1010 | # RemoteBranch. |
1011 | vfs_branch = self.make_branch('.') |
1012 | - smart_server = server.SmartTCPServer_for_testing() |
1013 | + smart_server = test_server.SmartTCPServer_for_testing() |
1014 | smart_server.start_server(self.get_vfs_only_server()) |
1015 | self.addCleanup(smart_server.stop_server) |
1016 | remote_branch = Branch.open(smart_server.get_url()) |
1017 | |
1018 | === modified file 'lib/lp/codehosting/tests/test_jobs.py' |
1019 | --- lib/lp/codehosting/tests/test_jobs.py 2010-05-27 02:04:21 +0000 |
1020 | +++ lib/lp/codehosting/tests/test_jobs.py 2010-08-17 04:46:45 +0000 |
1021 | @@ -3,6 +3,7 @@ |
1022 | |
1023 | """Tests for Job-running facilities.""" |
1024 | |
1025 | +from __future__ import with_statement |
1026 | |
1027 | from unittest import TestLoader |
1028 | |
1029 | @@ -15,6 +16,7 @@ |
1030 | from lp.code.model.branchjob import RevisionMailJob |
1031 | from lp.code.model.diff import StaticDiff |
1032 | from lp.services.job.runner import JobRunner |
1033 | +from lp.services.osutils import override_environ |
1034 | from lp.testing import TestCaseWithFactory |
1035 | |
1036 | |
1037 | @@ -34,7 +36,10 @@ |
1038 | tree_transport = tree.bzrdir.root_transport |
1039 | tree_transport.put_bytes("hello.txt", "Hello World\n") |
1040 | tree.add('hello.txt') |
1041 | - to_revision_id = tree.commit('rev1', timestamp=1e9, timezone=0) |
1042 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
1043 | + # required to generate the revision-id. |
1044 | + with override_environ(BZR_EMAIL='me@example.com'): |
1045 | + to_revision_id = tree.commit('rev1', timestamp=1e9, timezone=0) |
1046 | job = RevisionMailJob.create( |
1047 | branch, 1, 'from@example.org', 'body', True, 'subject') |
1048 | LaunchpadZopelessLayer.txn.commit() |
1049 | |
1050 | === modified file 'lib/lp/codehosting/vfs/tests/test_transport.py' |
1051 | --- lib/lp/codehosting/vfs/tests/test_transport.py 2010-04-19 07:05:57 +0000 |
1052 | +++ lib/lp/codehosting/vfs/tests/test_transport.py 2010-08-17 04:46:45 +0000 |
1053 | @@ -43,6 +43,9 @@ |
1054 | BlockingProxy(branchfs), LocalTransport(local_path_to_url('.'))) |
1055 | self._chroot_servers = [] |
1056 | |
1057 | + def get_bogus_url(self): |
1058 | + return self._scheme + 'bogus' |
1059 | + |
1060 | def _transportFactory(self, url): |
1061 | """See `LaunchpadInternalServer._transportFactory`. |
1062 | |
1063 | |
1064 | === modified file 'lib/lp/services/osutils.py' |
1065 | --- lib/lp/services/osutils.py 2010-03-18 19:18:34 +0000 |
1066 | +++ lib/lp/services/osutils.py 2010-08-17 04:46:45 +0000 |
1067 | @@ -5,12 +5,14 @@ |
1068 | |
1069 | __metaclass__ = type |
1070 | __all__ = [ |
1071 | + 'override_environ', |
1072 | 'remove_tree', |
1073 | 'kill_by_pidfile', |
1074 | 'remove_if_exists', |
1075 | 'two_stage_kill', |
1076 | ] |
1077 | |
1078 | +from contextlib import contextmanager |
1079 | import os.path |
1080 | import shutil |
1081 | |
1082 | @@ -26,3 +28,33 @@ |
1083 | """Remove the tree at 'path' from disk.""" |
1084 | if os.path.exists(path): |
1085 | shutil.rmtree(path) |
1086 | + |
1087 | + |
1088 | +def set_environ(new_values): |
1089 | + """Set the environment variables as specified by new_values. |
1090 | + |
1091 | + :return: a dict of the old values |
1092 | + """ |
1093 | + old_values = {} |
1094 | + for name, value in new_values.iteritems(): |
1095 | + old_values[name] = os.environ.get(name) |
1096 | + if value is None: |
1097 | + if old_values[name] is not None: |
1098 | + del os.environ[name] |
1099 | + else: |
1100 | + os.environ[name] = value |
1101 | + return old_values |
1102 | + |
1103 | + |
1104 | +@contextmanager |
1105 | +def override_environ(**kwargs): |
1106 | + """Override environment variables with the kwarg values. |
1107 | + |
1108 | + If a value is None, the environment variable is deleted. Variables are |
1109 | + restored to their previous state when exiting the context. |
1110 | + """ |
1111 | + old_values = set_environ(kwargs) |
1112 | + try: |
1113 | + yield |
1114 | + finally: |
1115 | + set_environ(old_values) |
1116 | |
1117 | === modified file 'lib/lp/testing/__init__.py' |
1118 | --- lib/lp/testing/__init__.py 2010-08-02 19:52:59 +0000 |
1119 | +++ lib/lp/testing/__init__.py 2010-08-17 04:46:45 +0000 |
1120 | @@ -117,6 +117,7 @@ |
1121 | launchpadlib_credentials_for, launchpadlib_for, oauth_access_token_for) |
1122 | from lp.testing.matchers import Provides |
1123 | from lp.testing.fixture import ZopeEventHandlerFixture |
1124 | +from lp.services.osutils import override_environ |
1125 | |
1126 | # zope.exception demands more of frame objects than twisted.python.failure |
1127 | # provides in its fake frames. This is enough to make it work with them |
1128 | @@ -577,18 +578,11 @@ |
1129 | return os.path.join(base, branch_id_to_path(branch.id)) |
1130 | |
1131 | def useTempBzrHome(self): |
1132 | - # XXX: Extract the temporary environment blatting into a generic |
1133 | - # helper function. |
1134 | self.useTempDir() |
1135 | # Avoid leaking local user configuration into tests. |
1136 | - old_bzr_home = os.environ.get('BZR_HOME') |
1137 | - def restore_bzr_home(): |
1138 | - if old_bzr_home is None: |
1139 | - del os.environ['BZR_HOME'] |
1140 | - else: |
1141 | - os.environ['BZR_HOME'] = old_bzr_home |
1142 | - os.environ['BZR_HOME'] = os.getcwd() |
1143 | - self.addCleanup(restore_bzr_home) |
1144 | + self.useContext(override_environ( |
1145 | + BZR_HOME=os.getcwd(), BZR_EMAIL=None, EMAIL=None, |
1146 | + )) |
1147 | |
1148 | def useBzrBranches(self, direct_database=False): |
1149 | """Prepare for using bzr branches. |
1150 | |
1151 | === modified file 'lib/lp/translations/scripts/translations_to_branch.py' |
1152 | --- lib/lp/translations/scripts/translations_to_branch.py 2010-06-16 07:22:57 +0000 |
1153 | +++ lib/lp/translations/scripts/translations_to_branch.py 2010-08-17 04:46:45 +0000 |
1154 | @@ -103,22 +103,16 @@ |
1155 | # possible again to commit to these branches at some point. |
1156 | # When that happens, remove this workaround and just call |
1157 | # _makeDirectBranchCommit directly. |
1158 | - committer = self._makeDirectBranchCommit(db_branch) |
1159 | - if not db_branch.stacked_on: |
1160 | - # The normal case. |
1161 | - return committer |
1162 | - |
1163 | - self.logger.info("Unstacking branch to work around bug 375013.") |
1164 | - try: |
1165 | - committer.bzrbranch.set_stacked_on_url(None) |
1166 | - finally: |
1167 | - committer.unlock() |
1168 | - self.logger.info("Done unstacking branch.") |
1169 | - |
1170 | - # This may have taken a while, so commit for good |
1171 | - # manners. |
1172 | - if self.txn: |
1173 | - self.txn.commit() |
1174 | + if db_branch.stacked_on: |
1175 | + bzrbranch = db_branch.getBzrBranch() |
1176 | + self.logger.info("Unstacking branch to work around bug 375013.") |
1177 | + bzrbranch.set_stacked_on_url(None) |
1178 | + self.logger.info("Done unstacking branch.") |
1179 | + |
1180 | + # This may have taken a while, so commit for good |
1181 | + # manners. |
1182 | + if self.txn: |
1183 | + self.txn.commit() |
1184 | |
1185 | return self._makeDirectBranchCommit(db_branch) |
1186 | |
1187 | |
1188 | === modified file 'lib/lp/translations/tests/test_rosetta_branches_script.py' |
1189 | --- lib/lp/translations/tests/test_rosetta_branches_script.py 2010-04-23 09:36:47 +0000 |
1190 | +++ lib/lp/translations/tests/test_rosetta_branches_script.py 2010-08-17 04:46:45 +0000 |
1191 | @@ -7,6 +7,8 @@ |
1192 | provisions to handle Bazaar branches. |
1193 | """ |
1194 | |
1195 | +from __future__ import with_statement |
1196 | + |
1197 | __metaclass__ = type |
1198 | |
1199 | from unittest import TestLoader |
1200 | @@ -23,6 +25,7 @@ |
1201 | ITranslationImportQueue, RosettaImportStatus) |
1202 | from canonical.launchpad.scripts.tests import run_script |
1203 | from lp.testing import TestCaseWithFactory |
1204 | +from lp.services.osutils import override_environ |
1205 | from canonical.launchpad.webapp.errorlog import globalErrorUtility |
1206 | |
1207 | class TestRosettaBranchesScript(TestCaseWithFactory): |
1208 | @@ -43,7 +46,10 @@ |
1209 | branch, tree = self.create_branch_and_tree() |
1210 | tree.bzrdir.root_transport.put_bytes(pot_path, pot_content) |
1211 | tree.add(pot_path) |
1212 | - revision_id = tree.commit("first commit") |
1213 | + # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is |
1214 | + # required to generate the revision-id. |
1215 | + with override_environ(BZR_EMAIL='me@example.com'): |
1216 | + revision_id = tree.commit("first commit") |
1217 | branch.last_scanned_id = revision_id |
1218 | branch.last_mirrored_id = revision_id |
1219 | series = self.factory.makeProductSeries() |
1220 | |
1221 | === modified file 'utilities/sourcedeps.conf' |
1222 | --- utilities/sourcedeps.conf 2010-08-16 15:00:28 +0000 |
1223 | +++ utilities/sourcedeps.conf 2010-08-17 04:46:45 +0000 |
1224 | @@ -1,7 +1,7 @@ |
1225 | bzr-builder lp:~launchpad-pqm/bzr-builder/trunk;revno=65 |
1226 | bzr-git lp:~launchpad-pqm/bzr-git/devel;revno=257 |
1227 | -bzr-hg lp:~launchpad-pqm/bzr-hg/devel;revno=281 |
1228 | -bzr-loom lp:~launchpad-pqm/bzr-loom/trunk;revno=47 |
1229 | +bzr-hg lp:~launchpad-pqm/bzr-hg/devel;revno=282 |
1230 | +bzr-loom lp:~launchpad-pqm/bzr-loom/trunk;revno=48 |
1231 | bzr-svn lp:~launchpad-pqm/bzr-svn/devel;revno=2709 |
1232 | cscvs lp:~launchpad-pqm/launchpad-cscvs/devel;revno=432 |
1233 | dulwich lp:~launchpad-pqm/dulwich/devel;revno=423 |
1234 | |
1235 | === modified file 'versions.cfg' |
1236 | --- versions.cfg 2010-08-06 16:52:08 +0000 |
1237 | +++ versions.cfg 2010-08-17 04:46:45 +0000 |
1238 | @@ -5,7 +5,7 @@ |
1239 | # Alphabetical, case-insensitive, please! :-) |
1240 | |
1241 | ampoule = 0.2.0 |
1242 | -bzr = 2.1.0 |
1243 | +bzr = 2.2.0 |
1244 | chameleon.core = 1.0b35 |
1245 | chameleon.zpt = 1.0b17 |
1246 | ClientForm = 0.2.10 |
I've reviewed the bits by abentley already.