← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jelmer/launchpad/no-revhistory-1 into lp:launchpad

 

Jelmer Vernooij has proposed merging lp:~jelmer/launchpad/no-revhistory-1 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #903703 in Launchpad itself: "uses deprecated Branch.revision_history call"
  https://bugs.launchpad.net/launchpad/+bug/903703

For more details, see:
https://code.launchpad.net/~jelmer/launchpad/no-revhistory-1/+merge/112018

Avoid the use of Branch.revision_history() in a couple of places where we just care about the size of the history. Branch.revision_history() is deprecated in newer versions of Bazaar.
-- 
https://code.launchpad.net/~jelmer/launchpad/no-revhistory-1/+merge/112018
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jelmer/launchpad/no-revhistory-1 into lp:launchpad.
=== modified file 'lib/lp/codehosting/codeimport/tests/test_worker.py'
--- lib/lp/codehosting/codeimport/tests/test_worker.py	2012-05-31 03:54:13 +0000
+++ lib/lp/codehosting/codeimport/tests/test_worker.py	2012-06-26 07:45:32 +0000
@@ -186,7 +186,7 @@
         store = self.makeBranchStore()
         bzr_branch = store.pull(
             self.arbitrary_branch_id, self.temp_dir, default_format)
-        self.assertEqual([], bzr_branch.revision_history())
+        self.assertEqual(0, bzr_branch.revno())
 
     def test_getNewBranch_without_tree(self):
         # If pull() with needs_tree=False creates a new branch, it doesn't
@@ -658,7 +658,7 @@
         # import.
         worker = self.makeImportWorker()
         bzr_branch = worker.getBazaarBranch()
-        self.assertEqual([], bzr_branch.revision_history())
+        self.assertEqual(0, bzr_branch.revno())
 
     def test_bazaarBranchLocation(self):
         # getBazaarBranch makes the working tree under the current working
@@ -844,8 +844,7 @@
             opener_policy=AcceptAnythingPolicy())
         worker.run()
         branch = self.getStoredBazaarBranch(worker)
-        self.assertEqual(
-            self.foreign_commit_count, len(branch.revision_history()))
+        self.assertEqual(self.foreign_commit_count, branch.revno())
 
     def test_sync(self):
         # Do an import.
@@ -854,8 +853,7 @@
             opener_policy=AcceptAnythingPolicy())
         worker.run()
         branch = self.getStoredBazaarBranch(worker)
-        self.assertEqual(
-            self.foreign_commit_count, len(branch.revision_history()))
+        self.assertEqual(self.foreign_commit_count, branch.revno())
 
         # Change the remote branch.
         self.makeForeignCommit(worker.source_details)
@@ -865,8 +863,7 @@
 
         # Check that the new revisions are in the Bazaar branch.
         branch = self.getStoredBazaarBranch(worker)
-        self.assertEqual(
-            self.foreign_commit_count, len(branch.revision_history()))
+        self.assertEqual(self.foreign_commit_count, branch.revno())
 
     def test_import_script(self):
         # Like test_import, but using the code-import-worker.py script
@@ -1382,8 +1379,7 @@
         self.assertEqual(
             CodeImportWorkerExitCode.SUCCESS, worker.run())
         branch = self.getStoredBazaarBranch(worker)
-        self.assertEqual(
-            1, len(branch.revision_history()))
+        self.assertEqual(1, branch.revno())
         self.assertEqual(
             "Some Random Hacker <jane@xxxxxxxxxxx>",
             branch.repository.get_revision(branch.last_revision()).committer)

=== modified file 'lib/lp/codehosting/codeimport/tests/test_workermonitor.py'
--- lib/lp/codehosting/codeimport/tests/test_workermonitor.py	2012-02-15 17:29:54 +0000
+++ lib/lp/codehosting/codeimport/tests/test_workermonitor.py	2012-06-26 07:45:32 +0000
@@ -803,8 +803,7 @@
         url = get_default_bazaar_branch_store()._getMirrorURL(
             code_import.branch.id)
         branch = Branch.open(url)
-        self.assertEqual(
-            self.foreign_commit_count, len(branch.revision_history()))
+        self.assertEqual(self.foreign_commit_count, branch.revno())
 
     def assertImported(self, ignored, code_import_id):
         """Assert that the `CodeImport` of the given id was imported."""


Follow ups