Merge ~cjwatson/launchpad:fix-unsixify-bzr-revisions into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 551e5d5732e87ce8aa77b886389019d9f4e6c306
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:fix-unsixify-bzr-revisions
Merge into: launchpad:master
Diff against target: 169 lines (+20/-16)
5 files modified
lib/lp/code/model/branchjob.py (+0/-1)
lib/lp/code/model/tests/test_branchjob.py (+16/-8)
lib/lp/registry/browser/product.py (+1/-2)
lib/lp/translations/browser/productseries.py (+2/-3)
lib/lp/translations/tests/test_rosetta_branches_script.py (+1/-2)
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
Review via email: mp+428054@code.launchpad.net

Commit message

Fix more errors in removing six from bzr revision handling

Description of the change

This has passed a full test run locally.

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/code/model/branchjob.py b/lib/lp/code/model/branchjob.py
2index 24f2793..083f3d7 100644
3--- a/lib/lp/code/model/branchjob.py
4+++ b/lib/lp/code/model/branchjob.py
5@@ -858,7 +858,6 @@ class RosettaUploadJob(BranchJobDerived):
6
7 if from_revision_id is None:
8 from_revision_id = NULL_REVISION.decode()
9- from_revision_id = from_revision_id
10
11 if force_translations_upload or cls.providesTranslationFiles(branch):
12 metadata = cls.getMetadata(
13diff --git a/lib/lp/code/model/tests/test_branchjob.py b/lib/lp/code/model/tests/test_branchjob.py
14index 2b17a43..08b9d16 100644
15--- a/lib/lp/code/model/tests/test_branchjob.py
16+++ b/lib/lp/code/model/tests/test_branchjob.py
17@@ -6,6 +6,7 @@
18 import datetime
19 import os
20 import shutil
21+from typing import Optional
22
23 import pytz
24 import transaction
25@@ -629,7 +630,7 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
26 job = RevisionsAddedJob.create(
27 target_branch, "rev2b-id", "rev2b-id", ""
28 )
29- self.assertEqual([desired_proposal], job.findRelatedBMP(["rev2a-id"]))
30+ self.assertEqual([desired_proposal], job.findRelatedBMP([b"rev2a-id"]))
31
32 def test_findRelatedBMP_one_per_source(self):
33 """findRelatedBMP only returns the most recent proposal for any
34@@ -1027,7 +1028,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
35 dummy.destroySelf()
36
37 # Now create the RosettaUploadJob.
38- return RosettaUploadJob.create(self.branch, NULL_REVISION)
39+ return RosettaUploadJob.create(self.branch, None)
40
41 def _commitFilesToTree(self, files, commit_message=None):
42 """Add files to the tree.
43@@ -1077,9 +1078,14 @@ class TestRosettaUploadJob(TestCaseWithFactory):
44 self, import_mode, files, do_upload_translations=False
45 ):
46 self._makeBranchWithTreeAndFiles(files)
47- return self._runJob(import_mode, NULL_REVISION, do_upload_translations)
48+ return self._runJob(import_mode, None, do_upload_translations)
49
50- def _runJob(self, import_mode, revision_id, do_upload_translations=False):
51+ def _runJob(
52+ self,
53+ import_mode,
54+ revision_id: Optional[str],
55+ do_upload_translations=False,
56+ ):
57 self._makeProductSeries(import_mode)
58 job = RosettaUploadJob.create(
59 self.branch, revision_id, do_upload_translations
60@@ -1132,7 +1138,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
61 ((pot_path, pot_content), (po_path, po_content))
62 )
63 self._makeProductSeries(TranslationsBranchImportMode.NO_IMPORT)
64- job = RosettaUploadJob.create(self.branch, NULL_REVISION, True)
65+ job = RosettaUploadJob.create(self.branch, None, True)
66 job._init_translation_file_lists()
67
68 self.assertEqual([(pot_path, pot_content)], job.template_files_changed)
69@@ -1263,7 +1269,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
70 self._makeBranchWithTreeAndFile("foo.pot")
71 self._makeProductSeries(TranslationsBranchImportMode.IMPORT_TEMPLATES)
72 potemplate = self.factory.makePOTemplate(self.series)
73- entries = self._runJob(None, NULL_REVISION)
74+ entries = self._runJob(None, None)
75 self.assertEqual(len(entries), 1)
76 entry = entries[0]
77 self.assertEqual(potemplate, entry.potemplate)
78@@ -1279,7 +1285,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
79 self._makeProductSeries(TranslationsBranchImportMode.IMPORT_TEMPLATES)
80 self.factory.makePOTemplate(self.series, path="foo.pot")
81 self.factory.makePOTemplate(self.series, path="bar.pot")
82- entries = self._runJob(None, NULL_REVISION)
83+ entries = self._runJob(None, None)
84 self.assertEqual(len(entries), 2)
85 self.assertEqual(RosettaImportStatus.APPROVED, entries[0].status)
86 self.assertEqual(RosettaImportStatus.APPROVED, entries[1].status)
87@@ -1392,7 +1398,9 @@ class TestViaCelery(TestCaseWithFactory):
88 series = self.factory.makeProductSeries(branch=db_branch)
89 with block_on_job(self):
90 RosettaUploadJob.create(
91- commit.db_branch, NULL_REVISION, force_translations_upload=True
92+ commit.db_branch,
93+ None,
94+ force_translations_upload=True,
95 )
96 transaction.commit()
97 queue = getUtility(ITranslationImportQueue)
98diff --git a/lib/lp/registry/browser/product.py b/lib/lp/registry/browser/product.py
99index 93e20f4..21f6b80 100644
100--- a/lib/lp/registry/browser/product.py
101+++ b/lib/lp/registry/browser/product.py
102@@ -44,7 +44,6 @@ from typing import Type
103 from urllib.parse import urlunsplit
104
105 from breezy import urlutils
106-from breezy.revision import NULL_REVISION
107 from lazr.delegates import delegate_to
108 from lazr.restful.interface import copy_field, use_template
109 from lazr.restful.interfaces import IJSONRequestCache
110@@ -2306,7 +2305,7 @@ class ProductSetBranchView(
111 self.series.branch = branch_location
112 # Request an initial upload of translation files.
113 getUtility(IRosettaUploadJobSource).create(
114- self.series.branch, NULL_REVISION
115+ self.series.branch, None
116 )
117 self.add_update_notification()
118 elif branch_type == IMPORT_EXTERNAL:
119diff --git a/lib/lp/translations/browser/productseries.py b/lib/lp/translations/browser/productseries.py
120index 9990657..34bed51 100644
121--- a/lib/lp/translations/browser/productseries.py
122+++ b/lib/lp/translations/browser/productseries.py
123@@ -16,7 +16,6 @@ __all__ = [
124
125 import os.path
126
127-from breezy.revision import NULL_REVISION
128 from zope.component import getUtility
129 from zope.publisher.browser import FileUpload
130
131@@ -553,7 +552,7 @@ class ProductSeriesTranslationsSettingsView(
132 self.updateContextFromData(data)
133 # Request an initial upload of translation files.
134 getUtility(IRosettaUploadJobSource).create(
135- self.context.branch, NULL_REVISION
136+ self.context.branch, None
137 )
138 else:
139 self.updateContextFromData(data)
140@@ -588,7 +587,7 @@ class ProductSeriesTranslationsBzrImportView(
141 def request_import_action(self, action, data):
142 """Request an upload of translation files."""
143 job = getUtility(IRosettaUploadJobSource).create(
144- self.context.branch, NULL_REVISION, True
145+ self.context.branch, None, True
146 )
147 if job is None:
148 self.addError(_("Your request could not be filed."))
149diff --git a/lib/lp/translations/tests/test_rosetta_branches_script.py b/lib/lp/translations/tests/test_rosetta_branches_script.py
150index 3044270..d4c3ede 100644
151--- a/lib/lp/translations/tests/test_rosetta_branches_script.py
152+++ b/lib/lp/translations/tests/test_rosetta_branches_script.py
153@@ -8,7 +8,6 @@ provisions to handle Bazaar branches.
154 """
155
156 import transaction
157-from breezy.revision import NULL_REVISION
158 from zope.component import getUtility
159
160 from lp.code.model.branchjob import RosettaUploadJob
161@@ -62,7 +61,7 @@ class TestRosettaBranchesScript(TestCaseWithFactory):
162 self._clear_import_queue()
163 pot_path = self.factory.getUniqueString() + ".pot"
164 branch = self._setup_series_branch(pot_path)
165- RosettaUploadJob.create(branch, NULL_REVISION)
166+ RosettaUploadJob.create(branch, None)
167 transaction.commit()
168
169 return_code, stdout, stderr = run_script(

Subscribers

People subscribed via source and target branches

to status/vote changes: