← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging ~cjwatson/launchpad:fix-unsixify-bzr-revisions into launchpad:master.

Commit message:
Fix more errors in removing six from bzr revision handling

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/428054

Given how the last couple of attempts at this have gone, I'm giving this a full test run locally before landing it.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-unsixify-bzr-revisions into launchpad:master.
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):
 
         if from_revision_id is None:
             from_revision_id = NULL_REVISION.decode()
-        from_revision_id = from_revision_id
 
         if force_translations_upload or cls.providesTranslationFiles(branch):
             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 @@
 import datetime
 import os
 import shutil
+from typing import Optional
 
 import pytz
 import transaction
@@ -629,7 +630,7 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
         job = RevisionsAddedJob.create(
             target_branch, "rev2b-id", "rev2b-id", ""
         )
-        self.assertEqual([desired_proposal], job.findRelatedBMP(["rev2a-id"]))
+        self.assertEqual([desired_proposal], job.findRelatedBMP([b"rev2a-id"]))
 
     def test_findRelatedBMP_one_per_source(self):
         """findRelatedBMP only returns the most recent proposal for any
@@ -1027,7 +1028,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
         dummy.destroySelf()
 
         # Now create the RosettaUploadJob.
-        return RosettaUploadJob.create(self.branch, NULL_REVISION)
+        return RosettaUploadJob.create(self.branch, None)
 
     def _commitFilesToTree(self, files, commit_message=None):
         """Add files to the tree.
@@ -1077,9 +1078,14 @@ class TestRosettaUploadJob(TestCaseWithFactory):
         self, import_mode, files, do_upload_translations=False
     ):
         self._makeBranchWithTreeAndFiles(files)
-        return self._runJob(import_mode, NULL_REVISION, do_upload_translations)
+        return self._runJob(import_mode, None, do_upload_translations)
 
-    def _runJob(self, import_mode, revision_id, do_upload_translations=False):
+    def _runJob(
+        self,
+        import_mode,
+        revision_id: Optional[str],
+        do_upload_translations=False,
+    ):
         self._makeProductSeries(import_mode)
         job = RosettaUploadJob.create(
             self.branch, revision_id, do_upload_translations
@@ -1132,7 +1138,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
             ((pot_path, pot_content), (po_path, po_content))
         )
         self._makeProductSeries(TranslationsBranchImportMode.NO_IMPORT)
-        job = RosettaUploadJob.create(self.branch, NULL_REVISION, True)
+        job = RosettaUploadJob.create(self.branch, None, True)
         job._init_translation_file_lists()
 
         self.assertEqual([(pot_path, pot_content)], job.template_files_changed)
@@ -1263,7 +1269,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
         self._makeBranchWithTreeAndFile("foo.pot")
         self._makeProductSeries(TranslationsBranchImportMode.IMPORT_TEMPLATES)
         potemplate = self.factory.makePOTemplate(self.series)
-        entries = self._runJob(None, NULL_REVISION)
+        entries = self._runJob(None, None)
         self.assertEqual(len(entries), 1)
         entry = entries[0]
         self.assertEqual(potemplate, entry.potemplate)
@@ -1279,7 +1285,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
         self._makeProductSeries(TranslationsBranchImportMode.IMPORT_TEMPLATES)
         self.factory.makePOTemplate(self.series, path="foo.pot")
         self.factory.makePOTemplate(self.series, path="bar.pot")
-        entries = self._runJob(None, NULL_REVISION)
+        entries = self._runJob(None, None)
         self.assertEqual(len(entries), 2)
         self.assertEqual(RosettaImportStatus.APPROVED, entries[0].status)
         self.assertEqual(RosettaImportStatus.APPROVED, entries[1].status)
@@ -1392,7 +1398,9 @@ class TestViaCelery(TestCaseWithFactory):
         series = self.factory.makeProductSeries(branch=db_branch)
         with block_on_job(self):
             RosettaUploadJob.create(
-                commit.db_branch, NULL_REVISION, force_translations_upload=True
+                commit.db_branch,
+                None,
+                force_translations_upload=True,
             )
             transaction.commit()
         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
 from urllib.parse import urlunsplit
 
 from breezy import urlutils
-from breezy.revision import NULL_REVISION
 from lazr.delegates import delegate_to
 from lazr.restful.interface import copy_field, use_template
 from lazr.restful.interfaces import IJSONRequestCache
@@ -2306,7 +2305,7 @@ class ProductSetBranchView(
                 self.series.branch = branch_location
                 # Request an initial upload of translation files.
                 getUtility(IRosettaUploadJobSource).create(
-                    self.series.branch, NULL_REVISION
+                    self.series.branch, None
                 )
                 self.add_update_notification()
         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__ = [
 
 import os.path
 
-from breezy.revision import NULL_REVISION
 from zope.component import getUtility
 from zope.publisher.browser import FileUpload
 
@@ -553,7 +552,7 @@ class ProductSeriesTranslationsSettingsView(
             self.updateContextFromData(data)
             # Request an initial upload of translation files.
             getUtility(IRosettaUploadJobSource).create(
-                self.context.branch, NULL_REVISION
+                self.context.branch, None
             )
         else:
             self.updateContextFromData(data)
@@ -588,7 +587,7 @@ class ProductSeriesTranslationsBzrImportView(
     def request_import_action(self, action, data):
         """Request an upload of translation files."""
         job = getUtility(IRosettaUploadJobSource).create(
-            self.context.branch, NULL_REVISION, True
+            self.context.branch, None, True
         )
         if job is None:
             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.
 """
 
 import transaction
-from breezy.revision import NULL_REVISION
 from zope.component import getUtility
 
 from lp.code.model.branchjob import RosettaUploadJob
@@ -62,7 +61,7 @@ class TestRosettaBranchesScript(TestCaseWithFactory):
         self._clear_import_queue()
         pot_path = self.factory.getUniqueString() + ".pot"
         branch = self._setup_series_branch(pot_path)
-        RosettaUploadJob.create(branch, NULL_REVISION)
+        RosettaUploadJob.create(branch, None)
         transaction.commit()
 
         return_code, stdout, stderr = run_script(

Follow ups