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
diff --git a/lib/lp/code/model/branchjob.py b/lib/lp/code/model/branchjob.py
index 24f2793..083f3d7 100644
--- a/lib/lp/code/model/branchjob.py
+++ b/lib/lp/code/model/branchjob.py
@@ -858,7 +858,6 @@ class RosettaUploadJob(BranchJobDerived):
858858
859 if from_revision_id is None:859 if from_revision_id is None:
860 from_revision_id = NULL_REVISION.decode()860 from_revision_id = NULL_REVISION.decode()
861 from_revision_id = from_revision_id
862861
863 if force_translations_upload or cls.providesTranslationFiles(branch):862 if force_translations_upload or cls.providesTranslationFiles(branch):
864 metadata = cls.getMetadata(863 metadata = cls.getMetadata(
diff --git a/lib/lp/code/model/tests/test_branchjob.py b/lib/lp/code/model/tests/test_branchjob.py
index 2b17a43..08b9d16 100644
--- a/lib/lp/code/model/tests/test_branchjob.py
+++ b/lib/lp/code/model/tests/test_branchjob.py
@@ -6,6 +6,7 @@
6import datetime6import datetime
7import os7import os
8import shutil8import shutil
9from typing import Optional
910
10import pytz11import pytz
11import transaction12import transaction
@@ -629,7 +630,7 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
629 job = RevisionsAddedJob.create(630 job = RevisionsAddedJob.create(
630 target_branch, "rev2b-id", "rev2b-id", ""631 target_branch, "rev2b-id", "rev2b-id", ""
631 )632 )
632 self.assertEqual([desired_proposal], job.findRelatedBMP(["rev2a-id"]))633 self.assertEqual([desired_proposal], job.findRelatedBMP([b"rev2a-id"]))
633634
634 def test_findRelatedBMP_one_per_source(self):635 def test_findRelatedBMP_one_per_source(self):
635 """findRelatedBMP only returns the most recent proposal for any636 """findRelatedBMP only returns the most recent proposal for any
@@ -1027,7 +1028,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
1027 dummy.destroySelf()1028 dummy.destroySelf()
10281029
1029 # Now create the RosettaUploadJob.1030 # Now create the RosettaUploadJob.
1030 return RosettaUploadJob.create(self.branch, NULL_REVISION)1031 return RosettaUploadJob.create(self.branch, None)
10311032
1032 def _commitFilesToTree(self, files, commit_message=None):1033 def _commitFilesToTree(self, files, commit_message=None):
1033 """Add files to the tree.1034 """Add files to the tree.
@@ -1077,9 +1078,14 @@ class TestRosettaUploadJob(TestCaseWithFactory):
1077 self, import_mode, files, do_upload_translations=False1078 self, import_mode, files, do_upload_translations=False
1078 ):1079 ):
1079 self._makeBranchWithTreeAndFiles(files)1080 self._makeBranchWithTreeAndFiles(files)
1080 return self._runJob(import_mode, NULL_REVISION, do_upload_translations)1081 return self._runJob(import_mode, None, do_upload_translations)
10811082
1082 def _runJob(self, import_mode, revision_id, do_upload_translations=False):1083 def _runJob(
1084 self,
1085 import_mode,
1086 revision_id: Optional[str],
1087 do_upload_translations=False,
1088 ):
1083 self._makeProductSeries(import_mode)1089 self._makeProductSeries(import_mode)
1084 job = RosettaUploadJob.create(1090 job = RosettaUploadJob.create(
1085 self.branch, revision_id, do_upload_translations1091 self.branch, revision_id, do_upload_translations
@@ -1132,7 +1138,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
1132 ((pot_path, pot_content), (po_path, po_content))1138 ((pot_path, pot_content), (po_path, po_content))
1133 )1139 )
1134 self._makeProductSeries(TranslationsBranchImportMode.NO_IMPORT)1140 self._makeProductSeries(TranslationsBranchImportMode.NO_IMPORT)
1135 job = RosettaUploadJob.create(self.branch, NULL_REVISION, True)1141 job = RosettaUploadJob.create(self.branch, None, True)
1136 job._init_translation_file_lists()1142 job._init_translation_file_lists()
11371143
1138 self.assertEqual([(pot_path, pot_content)], job.template_files_changed)1144 self.assertEqual([(pot_path, pot_content)], job.template_files_changed)
@@ -1263,7 +1269,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
1263 self._makeBranchWithTreeAndFile("foo.pot")1269 self._makeBranchWithTreeAndFile("foo.pot")
1264 self._makeProductSeries(TranslationsBranchImportMode.IMPORT_TEMPLATES)1270 self._makeProductSeries(TranslationsBranchImportMode.IMPORT_TEMPLATES)
1265 potemplate = self.factory.makePOTemplate(self.series)1271 potemplate = self.factory.makePOTemplate(self.series)
1266 entries = self._runJob(None, NULL_REVISION)1272 entries = self._runJob(None, None)
1267 self.assertEqual(len(entries), 1)1273 self.assertEqual(len(entries), 1)
1268 entry = entries[0]1274 entry = entries[0]
1269 self.assertEqual(potemplate, entry.potemplate)1275 self.assertEqual(potemplate, entry.potemplate)
@@ -1279,7 +1285,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
1279 self._makeProductSeries(TranslationsBranchImportMode.IMPORT_TEMPLATES)1285 self._makeProductSeries(TranslationsBranchImportMode.IMPORT_TEMPLATES)
1280 self.factory.makePOTemplate(self.series, path="foo.pot")1286 self.factory.makePOTemplate(self.series, path="foo.pot")
1281 self.factory.makePOTemplate(self.series, path="bar.pot")1287 self.factory.makePOTemplate(self.series, path="bar.pot")
1282 entries = self._runJob(None, NULL_REVISION)1288 entries = self._runJob(None, None)
1283 self.assertEqual(len(entries), 2)1289 self.assertEqual(len(entries), 2)
1284 self.assertEqual(RosettaImportStatus.APPROVED, entries[0].status)1290 self.assertEqual(RosettaImportStatus.APPROVED, entries[0].status)
1285 self.assertEqual(RosettaImportStatus.APPROVED, entries[1].status)1291 self.assertEqual(RosettaImportStatus.APPROVED, entries[1].status)
@@ -1392,7 +1398,9 @@ class TestViaCelery(TestCaseWithFactory):
1392 series = self.factory.makeProductSeries(branch=db_branch)1398 series = self.factory.makeProductSeries(branch=db_branch)
1393 with block_on_job(self):1399 with block_on_job(self):
1394 RosettaUploadJob.create(1400 RosettaUploadJob.create(
1395 commit.db_branch, NULL_REVISION, force_translations_upload=True1401 commit.db_branch,
1402 None,
1403 force_translations_upload=True,
1396 )1404 )
1397 transaction.commit()1405 transaction.commit()
1398 queue = getUtility(ITranslationImportQueue)1406 queue = getUtility(ITranslationImportQueue)
diff --git a/lib/lp/registry/browser/product.py b/lib/lp/registry/browser/product.py
index 93e20f4..21f6b80 100644
--- a/lib/lp/registry/browser/product.py
+++ b/lib/lp/registry/browser/product.py
@@ -44,7 +44,6 @@ from typing import Type
44from urllib.parse import urlunsplit44from urllib.parse import urlunsplit
4545
46from breezy import urlutils46from breezy import urlutils
47from breezy.revision import NULL_REVISION
48from lazr.delegates import delegate_to47from lazr.delegates import delegate_to
49from lazr.restful.interface import copy_field, use_template48from lazr.restful.interface import copy_field, use_template
50from lazr.restful.interfaces import IJSONRequestCache49from lazr.restful.interfaces import IJSONRequestCache
@@ -2306,7 +2305,7 @@ class ProductSetBranchView(
2306 self.series.branch = branch_location2305 self.series.branch = branch_location
2307 # Request an initial upload of translation files.2306 # Request an initial upload of translation files.
2308 getUtility(IRosettaUploadJobSource).create(2307 getUtility(IRosettaUploadJobSource).create(
2309 self.series.branch, NULL_REVISION2308 self.series.branch, None
2310 )2309 )
2311 self.add_update_notification()2310 self.add_update_notification()
2312 elif branch_type == IMPORT_EXTERNAL:2311 elif branch_type == IMPORT_EXTERNAL:
diff --git a/lib/lp/translations/browser/productseries.py b/lib/lp/translations/browser/productseries.py
index 9990657..34bed51 100644
--- a/lib/lp/translations/browser/productseries.py
+++ b/lib/lp/translations/browser/productseries.py
@@ -16,7 +16,6 @@ __all__ = [
1616
17import os.path17import os.path
1818
19from breezy.revision import NULL_REVISION
20from zope.component import getUtility19from zope.component import getUtility
21from zope.publisher.browser import FileUpload20from zope.publisher.browser import FileUpload
2221
@@ -553,7 +552,7 @@ class ProductSeriesTranslationsSettingsView(
553 self.updateContextFromData(data)552 self.updateContextFromData(data)
554 # Request an initial upload of translation files.553 # Request an initial upload of translation files.
555 getUtility(IRosettaUploadJobSource).create(554 getUtility(IRosettaUploadJobSource).create(
556 self.context.branch, NULL_REVISION555 self.context.branch, None
557 )556 )
558 else:557 else:
559 self.updateContextFromData(data)558 self.updateContextFromData(data)
@@ -588,7 +587,7 @@ class ProductSeriesTranslationsBzrImportView(
588 def request_import_action(self, action, data):587 def request_import_action(self, action, data):
589 """Request an upload of translation files."""588 """Request an upload of translation files."""
590 job = getUtility(IRosettaUploadJobSource).create(589 job = getUtility(IRosettaUploadJobSource).create(
591 self.context.branch, NULL_REVISION, True590 self.context.branch, None, True
592 )591 )
593 if job is None:592 if job is None:
594 self.addError(_("Your request could not be filed."))593 self.addError(_("Your request could not be filed."))
diff --git a/lib/lp/translations/tests/test_rosetta_branches_script.py b/lib/lp/translations/tests/test_rosetta_branches_script.py
index 3044270..d4c3ede 100644
--- a/lib/lp/translations/tests/test_rosetta_branches_script.py
+++ b/lib/lp/translations/tests/test_rosetta_branches_script.py
@@ -8,7 +8,6 @@ provisions to handle Bazaar branches.
8"""8"""
99
10import transaction10import transaction
11from breezy.revision import NULL_REVISION
12from zope.component import getUtility11from zope.component import getUtility
1312
14from lp.code.model.branchjob import RosettaUploadJob13from lp.code.model.branchjob import RosettaUploadJob
@@ -62,7 +61,7 @@ class TestRosettaBranchesScript(TestCaseWithFactory):
62 self._clear_import_queue()61 self._clear_import_queue()
63 pot_path = self.factory.getUniqueString() + ".pot"62 pot_path = self.factory.getUniqueString() + ".pot"
64 branch = self._setup_series_branch(pot_path)63 branch = self._setup_series_branch(pot_path)
65 RosettaUploadJob.create(branch, NULL_REVISION)64 RosettaUploadJob.create(branch, None)
66 transaction.commit()65 transaction.commit()
6766
68 return_code, stdout, stderr = run_script(67 return_code, stdout, stderr = run_script(

Subscribers

People subscribed via source and target branches

to status/vote changes: