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

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: 15493
Proposed branch: lp:~jelmer/launchpad/no-revhistory-1
Merge into: lp:launchpad
Diff against target: 75 lines (+7/-12)
2 files modified
lib/lp/codehosting/codeimport/tests/test_worker.py (+6/-10)
lib/lp/codehosting/codeimport/tests/test_workermonitor.py (+1/-2)
To merge this branch: bzr merge lp:~jelmer/launchpad/no-revhistory-1
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+112018@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
186 store = self.makeBranchStore()186 store = self.makeBranchStore()
187 bzr_branch = store.pull(187 bzr_branch = store.pull(
188 self.arbitrary_branch_id, self.temp_dir, default_format)188 self.arbitrary_branch_id, self.temp_dir, default_format)
189 self.assertEqual([], bzr_branch.revision_history())189 self.assertEqual(0, bzr_branch.revno())
190190
191 def test_getNewBranch_without_tree(self):191 def test_getNewBranch_without_tree(self):
192 # If pull() with needs_tree=False creates a new branch, it doesn't192 # If pull() with needs_tree=False creates a new branch, it doesn't
@@ -658,7 +658,7 @@
658 # import.658 # import.
659 worker = self.makeImportWorker()659 worker = self.makeImportWorker()
660 bzr_branch = worker.getBazaarBranch()660 bzr_branch = worker.getBazaarBranch()
661 self.assertEqual([], bzr_branch.revision_history())661 self.assertEqual(0, bzr_branch.revno())
662662
663 def test_bazaarBranchLocation(self):663 def test_bazaarBranchLocation(self):
664 # getBazaarBranch makes the working tree under the current working664 # getBazaarBranch makes the working tree under the current working
@@ -844,8 +844,7 @@
844 opener_policy=AcceptAnythingPolicy())844 opener_policy=AcceptAnythingPolicy())
845 worker.run()845 worker.run()
846 branch = self.getStoredBazaarBranch(worker)846 branch = self.getStoredBazaarBranch(worker)
847 self.assertEqual(847 self.assertEqual(self.foreign_commit_count, branch.revno())
848 self.foreign_commit_count, len(branch.revision_history()))
849848
850 def test_sync(self):849 def test_sync(self):
851 # Do an import.850 # Do an import.
@@ -854,8 +853,7 @@
854 opener_policy=AcceptAnythingPolicy())853 opener_policy=AcceptAnythingPolicy())
855 worker.run()854 worker.run()
856 branch = self.getStoredBazaarBranch(worker)855 branch = self.getStoredBazaarBranch(worker)
857 self.assertEqual(856 self.assertEqual(self.foreign_commit_count, branch.revno())
858 self.foreign_commit_count, len(branch.revision_history()))
859857
860 # Change the remote branch.858 # Change the remote branch.
861 self.makeForeignCommit(worker.source_details)859 self.makeForeignCommit(worker.source_details)
@@ -865,8 +863,7 @@
865863
866 # Check that the new revisions are in the Bazaar branch.864 # Check that the new revisions are in the Bazaar branch.
867 branch = self.getStoredBazaarBranch(worker)865 branch = self.getStoredBazaarBranch(worker)
868 self.assertEqual(866 self.assertEqual(self.foreign_commit_count, branch.revno())
869 self.foreign_commit_count, len(branch.revision_history()))
870867
871 def test_import_script(self):868 def test_import_script(self):
872 # Like test_import, but using the code-import-worker.py script869 # Like test_import, but using the code-import-worker.py script
@@ -1382,8 +1379,7 @@
1382 self.assertEqual(1379 self.assertEqual(
1383 CodeImportWorkerExitCode.SUCCESS, worker.run())1380 CodeImportWorkerExitCode.SUCCESS, worker.run())
1384 branch = self.getStoredBazaarBranch(worker)1381 branch = self.getStoredBazaarBranch(worker)
1385 self.assertEqual(1382 self.assertEqual(1, branch.revno())
1386 1, len(branch.revision_history()))
1387 self.assertEqual(1383 self.assertEqual(
1388 "Some Random Hacker <jane@example.com>",1384 "Some Random Hacker <jane@example.com>",
1389 branch.repository.get_revision(branch.last_revision()).committer)1385 branch.repository.get_revision(branch.last_revision()).committer)
13901386
=== 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 @@
803 url = get_default_bazaar_branch_store()._getMirrorURL(803 url = get_default_bazaar_branch_store()._getMirrorURL(
804 code_import.branch.id)804 code_import.branch.id)
805 branch = Branch.open(url)805 branch = Branch.open(url)
806 self.assertEqual(806 self.assertEqual(self.foreign_commit_count, branch.revno())
807 self.foreign_commit_count, len(branch.revision_history()))
808807
809 def assertImported(self, ignored, code_import_id):808 def assertImported(self, ignored, code_import_id):
810 """Assert that the `CodeImport` of the given id was imported."""809 """Assert that the `CodeImport` of the given id was imported."""