Merge lp:~jelmer/launchpad/update-bzr-hg into lp:launchpad

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 11489
Proposed branch: lp:~jelmer/launchpad/update-bzr-hg
Merge into: lp:launchpad
Diff against target: 96 lines (+24/-13)
4 files modified
lib/lp/codehosting/codeimport/tests/servers.py (+1/-1)
lib/lp/codehosting/codeimport/worker.py (+21/-10)
utilities/sourcedeps.conf (+1/-1)
versions.cfg (+1/-1)
To merge this branch: bzr merge lp:~jelmer/launchpad/update-bzr-hg
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Steve Kowalik (community) code* Approve
Review via email: mp+32974@code.launchpad.net

Commit message

Use a newer version of bzr-hg.

Description of the change

This updates bzr-hg to a newer upstream revision, one that makes it use directories for caches rather than individual files. I've made matching changes to lp.codehosting to cope with the fact that the bzr-hg cache is now stored differently.

These changes make it possible to run the lp codehosting tests with success when python-tdb is installed. It should also make it easier to install python-tdb on the production machines later (there are some advantages to using python-tdb; it's quicker and allows multiple concurrent writers).

To post a comment you must log in.
Revision history for this message
Steve Kowalik (stevenk) wrote :

Hi!

Your changes look good, but I have a few comments:

* Have we updated to the new bzr-hg that can take advantage of the tarball cache?
* You've removed the global db_file variable, but you have the magic string 'hg-cache.tar.gz' in the code twice.
* From my reading of the code, it looks like it is going to migrate new pushed branches to the tarball cache, is that the real intent?

review: Needs Information (code*)
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Hi Steve,

Thanks for the review. :-)

> Your changes look good, but I have a few comments:
>
> * Have we updated to the new bzr-hg that can take advantage of the tarball
> cache?
That's what this branch was doing (see 11347), but that change was reverted later when I remerged devel. I've now reintroduced it.

> * You've removed the global db_file variable, but you have the magic string
> 'hg-cache.tar.gz' in the code twice.
It's not really a magic filename like 'hg-v2.db', hg-cache.tar.gz is just the name of the temporary filename that's used to generate the tarball of the hg cache that's uploaded - similar to git-cache.tar.gz in the bzr-git worker class.

> * From my reading of the code, it looks like it is going to migrate new pushed
> branches to the tarball cache, is that the real intent?
Yes, that's correct.

Revision history for this message
Tim Penhey (thumper) wrote :

Jelmer, it still doesn't look like the bzr-hg is being updated. Should it be?

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Argh, Jelmer fail.

I fixed the branch but forgot to push it. Updated version should have bzr-hg updated to a newer version.

Revision history for this message
Steve Kowalik (stevenk) wrote :

This looks good to me.

review: Approve (code*)
Revision history for this message
Tim Penhey (thumper) :
review: Approve

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/servers.py'
2--- lib/lp/codehosting/codeimport/tests/servers.py 2010-08-20 20:31:18 +0000
3+++ lib/lp/codehosting/codeimport/tests/servers.py 2010-09-02 12:12:50 +0000
4@@ -233,5 +233,5 @@
5 f.write(contents)
6 finally:
7 f.close()
8- repo.add([filename])
9+ repo[None].add([filename])
10 repo.commit(text='<The commit message>', user='jane Foo <joe@foo.com>')
11
12=== modified file 'lib/lp/codehosting/codeimport/worker.py'
13--- lib/lp/codehosting/codeimport/worker.py 2010-08-20 20:31:18 +0000
14+++ lib/lp/codehosting/codeimport/worker.py 2010-09-02 12:12:50 +0000
15@@ -665,8 +665,6 @@
16 The only behaviour we add is preserving the id-sha map between runs.
17 """
18
19- db_file = 'hg-v2.db'
20-
21 @property
22 def format_classes(self):
23 """See `PullingImportWorker.opening_format`."""
24@@ -677,26 +675,39 @@
25 def getBazaarBranch(self):
26 """See `ImportWorker.getBazaarBranch`.
27
28- In addition to the superclass' behaviour, we retrieve the 'hg-v2.db'
29- map from the import data store and put it where bzr-hg will find
30- it in the Bazaar tree, that is at '.bzr/repository/hg-v2.db'.
31+ In addition to the superclass' behaviour, we retrieve the bzr-hg's
32+ caches, both legacy and current and put them where bzr-hg will find
33+ them in the Bazaar tree, that is at '.bzr/repository/hg-v2.db' and
34+ '.bzr/repository/hg'.
35 """
36 branch = PullingImportWorker.getBazaarBranch(self)
37+ # Fetch the legacy cache from the store, if present.
38 self.import_data_store.fetch(
39- self.db_file, branch.repository._transport)
40+ 'hg-v2.db', branch.repository._transport)
41+ # The cache dir from newer bzr-hgs is stored as a tarball.
42+ local_name = 'hg-cache.tar.gz'
43+ if self.import_data_store.fetch(local_name):
44+ repo_transport = branch.repository._transport
45+ repo_transport.mkdir('hg')
46+ hg_db_dir = os.path.join(
47+ local_path_from_url(repo_transport.base), 'hg')
48+ extract_tarball(local_name, hg_db_dir)
49 return branch
50
51 def pushBazaarBranch(self, bazaar_branch):
52 """See `ImportWorker.pushBazaarBranch`.
53
54- In addition to the superclass' behaviour, we store the 'hg-v2.db'
55- shamap that bzr-hg will have created at .bzr/repository/hg-v2.db into
56+ In addition to the superclass' behaviour, we store the hg cache
57+ that bzr-hg will have created at .bzr/repository/hg into
58 the import data store.
59 """
60 non_trivial = PullingImportWorker.pushBazaarBranch(
61 self, bazaar_branch)
62- self.import_data_store.put(
63- self.db_file, bazaar_branch.repository._transport)
64+ repo_base = bazaar_branch.repository._transport.base
65+ hg_db_dir = os.path.join(local_path_from_url(repo_base), 'hg')
66+ local_name = 'hg-cache.tar.gz'
67+ create_tarball(hg_db_dir, local_name)
68+ self.import_data_store.put(local_name)
69 return non_trivial
70
71
72
73=== modified file 'utilities/sourcedeps.conf'
74--- utilities/sourcedeps.conf 2010-08-30 00:51:55 +0000
75+++ utilities/sourcedeps.conf 2010-09-02 12:12:50 +0000
76@@ -1,6 +1,6 @@
77 bzr-builder lp:~launchpad-pqm/bzr-builder/trunk;revno=65
78 bzr-git lp:~launchpad-pqm/bzr-git/devel;revno=258
79-bzr-hg lp:~launchpad-pqm/bzr-hg/devel;revno=282
80+bzr-hg lp:~launchpad-pqm/bzr-hg/devel;revno=283
81 bzr-loom lp:~launchpad-pqm/bzr-loom/trunk;revno=48
82 bzr-svn lp:~launchpad-pqm/bzr-svn/devel;revno=2710
83 cscvs lp:~launchpad-pqm/launchpad-cscvs/devel;revno=432
84
85=== modified file 'versions.cfg'
86--- versions.cfg 2010-08-30 16:01:56 +0000
87+++ versions.cfg 2010-09-02 12:12:50 +0000
88@@ -41,7 +41,7 @@
89 martian = 0.11
90 mechanize = 0.1.11
91 meliae = 0.2.0.final.0
92-mercurial = 1.3.1
93+mercurial = 1.6.2
94 mocker = 0.10.1
95 mozrunner = 1.3.4
96 numpy = 1.3.0