Merge lp:~mwhudson/launchpad/more-git-caches into lp:launchpad

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~mwhudson/launchpad/more-git-caches
Merge into: lp:launchpad
Diff against target: 182 lines (+61/-20)
4 files modified
lib/canonical/config/schema-lazr.conf (+5/-3)
lib/lp/codehosting/codeimport/tests/test_worker.py (+36/-10)
lib/lp/codehosting/codeimport/worker.py (+18/-5)
utilities/sourcedeps.conf (+2/-2)
To merge this branch: bzr merge lp:~mwhudson/launchpad/more-git-caches
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+23069@code.launchpad.net

Commit message

Update to the new, massively faster bzr-git and a few Launchpad changes to cope with the new cache structure.

Description of the change

I haven't landed the bzr-git and dulwich updates yet, so sourcedeps.conf needs to change but otherwise this branch adapts us to the new bzr-git hotness.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

You have git_revisions_import_limit mentioned twice in the schema-lazr.conf.

# GitImportWorker.pushBazaarWorkingTree saves the git file from the

perhaps should say "git files"

# legacy:
and
# new hotness

As much as I like these, they don't fit our coding standards of full
sentences.

But other than that, great!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/canonical/config/schema-lazr.conf'
--- lib/canonical/config/schema-lazr.conf 2010-04-07 12:45:11 +0000
+++ lib/canonical/config/schema-lazr.conf 2010-04-09 06:17:35 +0000
@@ -440,9 +440,11 @@
440# in a row.440# in a row.
441consecutive_failure_limit: 5441consecutive_failure_limit: 5
442442
443# Import only this many revisions at once.443# Import only this many revisions from git at once.
444# Only applies to git imports for now.444git_revisions_import_limit: 10000
445revisions_import_limit: 1000445
446# Import only this many revisions from svn (via bzr-svn) at once.
447svn_revisions_import_limit: 1000
446448
447449
448[codeimportdispatcher]450[codeimportdispatcher]
449451
=== modified file 'lib/lp/codehosting/codeimport/tests/test_worker.py'
--- lib/lp/codehosting/codeimport/tests/test_worker.py 2010-03-12 02:30:36 +0000
+++ lib/lp/codehosting/codeimport/tests/test_worker.py 2010-04-09 06:17:35 +0000
@@ -28,6 +28,7 @@
28from canonical.testing import BaseLayer28from canonical.testing import BaseLayer
2929
30from lp.codehosting import load_optional_plugin30from lp.codehosting import load_optional_plugin
31from lp.codehosting.codeimport.tarball import create_tarball, extract_tarball
31from lp.codehosting.codeimport.worker import (32from lp.codehosting.codeimport.worker import (
32 BazaarBranchStore, BzrSvnImportWorker, CodeImportWorkerExitCode,33 BazaarBranchStore, BzrSvnImportWorker, CodeImportWorkerExitCode,
33 ForeignTreeStore, GitImportWorker, HgImportWorker, ImportDataStore,34 ForeignTreeStore, GitImportWorker, HgImportWorker, ImportDataStore,
@@ -590,20 +591,23 @@
590 source_details, self.get_transport('import_data'),591 source_details, self.get_transport('import_data'),
591 self.makeBazaarBranchStore(), logging.getLogger("silent"))592 self.makeBazaarBranchStore(), logging.getLogger("silent"))
592593
593 def test_pushBazaarWorkingTree_saves_git_db(self):594 def test_pushBazaarWorkingTree_saves_git_cache(self):
594 # GitImportWorker.pushBazaarWorkingTree saves the git.db file from the595 # GitImportWorker.pushBazaarWorkingTree saves a tarball of the git
595 # tree's repository in the worker's ImportDataStore.596 # cache from the tree's repository in the worker's ImportDataStore.
596 content = self.factory.getUniqueString()597 content = self.factory.getUniqueString()
597 tree = self.make_branch_and_tree('.')598 tree = self.make_branch_and_tree('.')
598 tree.branch.repository._transport.put_bytes('git.db', content)599 tree.branch.repository._transport.mkdir('git')
600 tree.branch.repository._transport.put_bytes('git/cache', content)
599 import_worker = self.makeImportWorker()601 import_worker = self.makeImportWorker()
600 import_worker.pushBazaarWorkingTree(tree)602 import_worker.pushBazaarWorkingTree(tree)
601 import_worker.import_data_store.fetch('git.db')603 import_worker.import_data_store.fetch('git-cache.tar.gz')
602 self.assertEqual(content, open('git.db').read())604 extract_tarball('git-cache.tar.gz', '.')
605 self.assertEqual(content, open('cache').read())
603606
604 def test_getBazaarWorkingTree_fetches_git_db(self):607 def test_getBazaarWorkingTree_fetches_legacy_git_db(self):
605 # GitImportWorker.getBazaarWorkingTree fetches the git.db file from608 # GitImportWorker.getBazaarWorkingTree fetches the legacy git.db file,
606 # the worker's ImportDataStore into the tree's repository.609 # if present, from the worker's ImportDataStore into the tree's
610 # repository.
607 import_worker = self.makeImportWorker()611 import_worker = self.makeImportWorker()
608 # Store the git.db file in the store.612 # Store the git.db file in the store.
609 content = self.factory.getUniqueString()613 content = self.factory.getUniqueString()
@@ -617,6 +621,25 @@
617 self.assertEqual(621 self.assertEqual(
618 content, tree.branch.repository._transport.get('git.db').read())622 content, tree.branch.repository._transport.get('git.db').read())
619623
624 def test_getBazaarWorkingTree_fetches_git_cache(self):
625 # GitImportWorker.getBazaarWorkingTree fetches the tarball of the git
626 # cache from the worker's ImportDataStore and expands it into the
627 # tree's repository.
628 import_worker = self.makeImportWorker()
629 # Store a tarred-up cache in the store.x
630 content = self.factory.getUniqueString()
631 os.mkdir('cache')
632 open('cache/git-cache', 'w').write(content)
633 create_tarball('cache', 'git-cache.tar.gz')
634 import_worker.import_data_store.put('git-cache.tar.gz')
635 # Make sure there's a Bazaar branch in the branch store.
636 tree = self.make_branch_and_tree('tree')
637 ImportWorker.pushBazaarWorkingTree(import_worker, tree)
638 # Finally, fetching the tree gets the git.db file too.
639 tree = import_worker.getBazaarWorkingTree()
640 self.assertEqual(
641 content, tree.branch.repository._transport.get('git/git-cache').read())
642
620643
621def clean_up_default_stores_for_import(source_details):644def clean_up_default_stores_for_import(source_details):
622 """Clean up the default branch and foreign tree stores for an import.645 """Clean up the default branch and foreign tree stores for an import.
@@ -913,7 +936,10 @@
913 self.makeForeignCommit(worker.source_details)936 self.makeForeignCommit(worker.source_details)
914 self.assertTrue(self.foreign_commit_count > 1)937 self.assertTrue(self.foreign_commit_count > 1)
915 self.pushConfig(938 self.pushConfig(
916 'codeimport', revisions_import_limit=self.foreign_commit_count-1)939 'codeimport',
940 git_revisions_import_limit=self.foreign_commit_count-1,
941 svn_revisions_import_limit=self.foreign_commit_count-1,
942 )
917 self.assertEqual(943 self.assertEqual(
918 CodeImportWorkerExitCode.SUCCESS_PARTIAL, worker.run())944 CodeImportWorkerExitCode.SUCCESS_PARTIAL, worker.run())
919 self.assertEqual(945 self.assertEqual(
920946
=== modified file 'lib/lp/codehosting/codeimport/worker.py'
--- lib/lp/codehosting/codeimport/worker.py 2010-03-15 23:23:29 +0000
+++ lib/lp/codehosting/codeimport/worker.py 2010-04-09 06:17:35 +0000
@@ -26,7 +26,7 @@
26from bzrlib.transport import get_transport26from bzrlib.transport import get_transport
27from bzrlib.errors import NoSuchFile, NotBranchError27from bzrlib.errors import NoSuchFile, NotBranchError
28import bzrlib.ui28import bzrlib.ui
29from bzrlib.urlutils import join as urljoin29from bzrlib.urlutils import join as urljoin, local_path_from_url
30from bzrlib.upgrade import upgrade30from bzrlib.upgrade import upgrade
3131
32from canonical.cachedproperty import cachedproperty32from canonical.cachedproperty import cachedproperty
@@ -581,7 +581,7 @@
581581
582 def getExtraPullArgs(self):582 def getExtraPullArgs(self):
583 """See `PullingImportWorker.getExtraPullArgs`."""583 """See `PullingImportWorker.getExtraPullArgs`."""
584 return {'limit': config.codeimport.revisions_import_limit}584 return {'limit': config.codeimport.git_revisions_import_limit}
585585
586 def getBazaarWorkingTree(self):586 def getBazaarWorkingTree(self):
587 """See `ImportWorker.getBazaarWorkingTree`.587 """See `ImportWorker.getBazaarWorkingTree`.
@@ -591,8 +591,17 @@
591 it in the Bazaar tree, that is at '.bzr/repository/git.db'.591 it in the Bazaar tree, that is at '.bzr/repository/git.db'.
592 """592 """
593 tree = PullingImportWorker.getBazaarWorkingTree(self)593 tree = PullingImportWorker.getBazaarWorkingTree(self)
594 # Fetch the legacy cache from the store, if present.
594 self.import_data_store.fetch(595 self.import_data_store.fetch(
595 'git.db', tree.branch.repository._transport)596 'git.db', tree.branch.repository._transport)
597 # The cache dir from newer bzr-gits is stored as a tarball.
598 local_name = 'git-cache.tar.gz'
599 if self.import_data_store.fetch(local_name):
600 repo_transport = tree.branch.repository._transport
601 repo_transport.mkdir('git')
602 git_db_dir = os.path.join(
603 local_path_from_url(repo_transport.base), 'git')
604 extract_tarball(local_name, git_db_dir)
596 return tree605 return tree
597606
598 def pushBazaarWorkingTree(self, bazaar_tree):607 def pushBazaarWorkingTree(self, bazaar_tree):
@@ -604,8 +613,12 @@
604 """613 """
605 non_trivial = PullingImportWorker.pushBazaarWorkingTree(614 non_trivial = PullingImportWorker.pushBazaarWorkingTree(
606 self, bazaar_tree)615 self, bazaar_tree)
607 self.import_data_store.put(616 repo_transport = bazaar_tree.branch.repository._transport
608 'git.db', bazaar_tree.branch.repository._transport)617 git_db_dir = os.path.join(
618 local_path_from_url(repo_transport.base), 'git')
619 local_name = 'git-cache.tar.gz'
620 create_tarball(git_db_dir, local_name)
621 self.import_data_store.put(local_name)
609 return non_trivial622 return non_trivial
610623
611624
@@ -655,7 +668,7 @@
655668
656 def getExtraPullArgs(self):669 def getExtraPullArgs(self):
657 """See `PullingImportWorker.getExtraPullArgs`."""670 """See `PullingImportWorker.getExtraPullArgs`."""
658 return {'limit': config.codeimport.revisions_import_limit}671 return {'limit': config.codeimport.svn_revisions_import_limit}
659672
660 @property673 @property
661 def format_classes(self):674 def format_classes(self):
662675
=== modified file 'utilities/sourcedeps.conf'
--- utilities/sourcedeps.conf 2010-04-07 12:27:00 +0000
+++ utilities/sourcedeps.conf 2010-04-09 06:17:35 +0000
@@ -1,10 +1,10 @@
1bzr-builder lp:~launchpad-pqm/bzr-builder/trunk;revno=631bzr-builder lp:~launchpad-pqm/bzr-builder/trunk;revno=63
2bzr-git lp:~launchpad-pqm/bzr-git/devel;revno=2512bzr-git lp:~launchpad-pqm/bzr-git/devel;revno=253
3bzr-hg lp:~launchpad-pqm/bzr-hg/devel;revno=2813bzr-hg lp:~launchpad-pqm/bzr-hg/devel;revno=281
4bzr-loom lp:~launchpad-pqm/bzr-loom/trunk;revno=474bzr-loom lp:~launchpad-pqm/bzr-loom/trunk;revno=47
5bzr-svn lp:~launchpad-pqm/bzr-svn/devel;revno=27085bzr-svn lp:~launchpad-pqm/bzr-svn/devel;revno=2708
6cscvs lp:~launchpad-pqm/launchpad-cscvs/devel;revno=4306cscvs lp:~launchpad-pqm/launchpad-cscvs/devel;revno=430
7dulwich lp:~launchpad-pqm/dulwich/devel;revno=4177dulwich lp:~launchpad-pqm/dulwich/devel;revno=418
8launchpad-loggerhead lp:~launchpad-pqm/launchpad-loggerhead/devel;revno=548launchpad-loggerhead lp:~launchpad-pqm/launchpad-loggerhead/devel;revno=54
9loggerhead lp:~launchpad-pqm/loggerhead/devel;revno=1749loggerhead lp:~launchpad-pqm/loggerhead/devel;revno=174
10lpreview lp:~launchpad-pqm/bzr-lpreview/devel;revno=2310lpreview lp:~launchpad-pqm/bzr-lpreview/devel;revno=23