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
1=== modified file 'lib/lp/codehosting/codeimport/tests/test_worker.py'
2--- lib/lp/codehosting/codeimport/tests/test_worker.py 2012-05-31 03:54:13 +0000
3+++ lib/lp/codehosting/codeimport/tests/test_worker.py 2012-06-26 07:45:32 +0000
4@@ -186,7 +186,7 @@
5 store = self.makeBranchStore()
6 bzr_branch = store.pull(
7 self.arbitrary_branch_id, self.temp_dir, default_format)
8- self.assertEqual([], bzr_branch.revision_history())
9+ self.assertEqual(0, bzr_branch.revno())
10
11 def test_getNewBranch_without_tree(self):
12 # If pull() with needs_tree=False creates a new branch, it doesn't
13@@ -658,7 +658,7 @@
14 # import.
15 worker = self.makeImportWorker()
16 bzr_branch = worker.getBazaarBranch()
17- self.assertEqual([], bzr_branch.revision_history())
18+ self.assertEqual(0, bzr_branch.revno())
19
20 def test_bazaarBranchLocation(self):
21 # getBazaarBranch makes the working tree under the current working
22@@ -844,8 +844,7 @@
23 opener_policy=AcceptAnythingPolicy())
24 worker.run()
25 branch = self.getStoredBazaarBranch(worker)
26- self.assertEqual(
27- self.foreign_commit_count, len(branch.revision_history()))
28+ self.assertEqual(self.foreign_commit_count, branch.revno())
29
30 def test_sync(self):
31 # Do an import.
32@@ -854,8 +853,7 @@
33 opener_policy=AcceptAnythingPolicy())
34 worker.run()
35 branch = self.getStoredBazaarBranch(worker)
36- self.assertEqual(
37- self.foreign_commit_count, len(branch.revision_history()))
38+ self.assertEqual(self.foreign_commit_count, branch.revno())
39
40 # Change the remote branch.
41 self.makeForeignCommit(worker.source_details)
42@@ -865,8 +863,7 @@
43
44 # Check that the new revisions are in the Bazaar branch.
45 branch = self.getStoredBazaarBranch(worker)
46- self.assertEqual(
47- self.foreign_commit_count, len(branch.revision_history()))
48+ self.assertEqual(self.foreign_commit_count, branch.revno())
49
50 def test_import_script(self):
51 # Like test_import, but using the code-import-worker.py script
52@@ -1382,8 +1379,7 @@
53 self.assertEqual(
54 CodeImportWorkerExitCode.SUCCESS, worker.run())
55 branch = self.getStoredBazaarBranch(worker)
56- self.assertEqual(
57- 1, len(branch.revision_history()))
58+ self.assertEqual(1, branch.revno())
59 self.assertEqual(
60 "Some Random Hacker <jane@example.com>",
61 branch.repository.get_revision(branch.last_revision()).committer)
62
63=== modified file 'lib/lp/codehosting/codeimport/tests/test_workermonitor.py'
64--- lib/lp/codehosting/codeimport/tests/test_workermonitor.py 2012-02-15 17:29:54 +0000
65+++ lib/lp/codehosting/codeimport/tests/test_workermonitor.py 2012-06-26 07:45:32 +0000
66@@ -803,8 +803,7 @@
67 url = get_default_bazaar_branch_store()._getMirrorURL(
68 code_import.branch.id)
69 branch = Branch.open(url)
70- self.assertEqual(
71- self.foreign_commit_count, len(branch.revision_history()))
72+ self.assertEqual(self.foreign_commit_count, branch.revno())
73
74 def assertImported(self, ignored, code_import_id):
75 """Assert that the `CodeImport` of the given id was imported."""