Merge lp:~mwhudson/launchpad/incremental-code-imports-bug-512683 into lp:launchpad/db-devel

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~mwhudson/launchpad/incremental-code-imports-bug-512683
Merge into: lp:launchpad/db-devel
Diff against target: 504 lines (+174/-67)
13 files modified
lib/canonical/config/schema-lazr.conf (+4/-0)
lib/canonical/launchpad/testing/codeimporthelpers.py (+2/-6)
lib/lp/code/browser/branch.py (+2/-0)
lib/lp/code/enums.py (+7/-0)
lib/lp/code/model/codeimportjob.py (+4/-1)
lib/lp/code/model/tests/test_codeimportjob.py (+15/-0)
lib/lp/code/stories/codeimport/xx-codeimport-results.txt (+21/-16)
lib/lp/codehosting/codeimport/tests/test_worker.py (+42/-8)
lib/lp/codehosting/codeimport/tests/test_workermonitor.py (+15/-0)
lib/lp/codehosting/codeimport/worker.py (+32/-9)
lib/lp/codehosting/codeimport/workermonitor.py (+3/-0)
lib/lp/testing/factory.py (+25/-25)
utilities/sourcedeps.conf (+2/-2)
To merge this branch: bzr merge lp:~mwhudson/launchpad/incremental-code-imports-bug-512683
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+19674@code.launchpad.net

Commit message

Support incremental imports for git -- repositories will be imported 1000 revisions at a time.

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Hi there,

This branch adds support to incrementally pull 5000 revisions at a time for git imports.

Not much more to say really, I hope the implementation mostly makes sense (at least if you know this area of the code).

Cheers,
mwh

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Oh, the new icon looks like this: http://people.canonical.com/~mwh/partial-success.png

Do we need a UI review? I guess we probably should.

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

lib/lp/codehosting/codeimport/worker.py

> + if bazaar_tree.branch.last_revision() \
> + == foreign_branch.last_revision():

Our coding standard does suggest to use braces rather than line continuation
characters.

Or even:

    last_revision = bazaar_tree.branch.last_revision()
    if (last_revision == foreign_branch.last_revision()):

Everything else looks good!

  merge approved

review: Approve
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Hi Tim,

This branch failed tests because some other tests (the distrobrancher ones, I think) failed when run with the bzr-git plugin loaded. So I added a layer that prevents any tests from being run in the same process after the code import worker tests. Can you review this approach please? The interdiff is here: http://pastebin.ubuntu.com/381384/

With this change, the branch passed all tests in ec2.

Cheers,
mwh

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

Add a comment about why this works, and land it. We can discuss the unplugability of the foreign branch bits at a later date.

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-02-20 13:16:38 +0000
+++ lib/canonical/config/schema-lazr.conf 2010-02-22 05:40:42 +0000
@@ -439,6 +439,10 @@
439# in a row.439# in a row.
440consecutive_failure_limit: 5440consecutive_failure_limit: 5
441441
442# Import only this many revisions at once.
443# Only applies to git imports for now.
444revisions_import_limit: 1000
445
442446
443[codeimportdispatcher]447[codeimportdispatcher]
444# The directory where the code import worker should be directed to448# The directory where the code import worker should be directed to
445449
=== added file 'lib/canonical/launchpad/images/yes-gray.png'
446Binary files lib/canonical/launchpad/images/yes-gray.png 1970-01-01 00:00:00 +0000 and lib/canonical/launchpad/images/yes-gray.png 2010-02-22 05:40:42 +0000 differ450Binary files lib/canonical/launchpad/images/yes-gray.png 1970-01-01 00:00:00 +0000 and lib/canonical/launchpad/images/yes-gray.png 2010-02-22 05:40:42 +0000 differ
=== modified file 'lib/canonical/launchpad/testing/codeimporthelpers.py'
--- lib/canonical/launchpad/testing/codeimporthelpers.py 2009-06-25 05:30:52 +0000
+++ lib/canonical/launchpad/testing/codeimporthelpers.py 2010-02-22 05:40:42 +0000
@@ -119,17 +119,13 @@
119 return code_import119 return code_import
120120
121121
122def make_all_result_types(code_import=None, factory=None, machine=None):122def make_all_result_types(code_import, factory, machine, start, count):
123 """Make a code import result of each possible type for the code import."""123 """Make a code import result of each possible type for the code import."""
124 if factory is None:
125 factory = LaunchpadObjectFactory()
126 if code_import is None:
127 code_import = factory.makeCodeImport()
128 start_dates = time_counter(124 start_dates = time_counter(
129 datetime(2007,12,1,12, tzinfo=UTC), timedelta(days=1))125 datetime(2007,12,1,12, tzinfo=UTC), timedelta(days=1))
130 end_dates = time_counter(126 end_dates = time_counter(
131 datetime(2007,12,1,13, tzinfo=UTC), timedelta(days=1, hours=1))127 datetime(2007,12,1,13, tzinfo=UTC), timedelta(days=1, hours=1))
132 for result_status in CodeImportResultStatus.items:128 for result_status in sorted(CodeImportResultStatus.items)[start:start+count]:
133 factory.makeCodeImportResult(129 factory.makeCodeImportResult(
134 code_import, result_status, start_dates.next(), end_dates.next(),130 code_import, result_status, start_dates.next(), end_dates.next(),
135 machine=machine)131 machine=machine)
136132
=== modified file 'lib/lp/code/browser/branch.py'
--- lib/lp/code/browser/branch.py 2010-02-01 03:49:23 +0000
+++ lib/lp/code/browser/branch.py 2010-02-22 05:40:42 +0000
@@ -514,6 +514,8 @@
514 """The icon to represent the `CodeImportResultStatus` `status`."""514 """The icon to represent the `CodeImportResultStatus` `status`."""
515 if status in CodeImportResultStatus.successes:515 if status in CodeImportResultStatus.successes:
516 return "/@@/yes"516 return "/@@/yes"
517 elif status == CodeImportResultStatus.SUCCESS_PARTIAL:
518 return "/@@/yes-gray"
517 else:519 else:
518 return "/@@/no"520 return "/@@/no"
519521
520522
=== modified file 'lib/lp/code/enums.py'
--- lib/lp/code/enums.py 2010-02-01 03:49:23 +0000
+++ lib/lp/code/enums.py 2010-02-22 05:40:42 +0000
@@ -806,6 +806,13 @@
806 import.806 import.
807 """)807 """)
808808
809 SUCCESS_PARTIAL = DBItem(120, """
810 Partial Success
811
812 Import job successfully imported some but not all of the foreign
813 revisions.
814 """)
815
809 FAILURE = DBItem(200, """816 FAILURE = DBItem(200, """
810 Failure817 Failure
811818
812819
=== modified file 'lib/lp/code/model/codeimportjob.py'
--- lib/lp/code/model/codeimportjob.py 2010-01-27 02:48:13 +0000
+++ lib/lp/code/model/codeimportjob.py 2010-02-22 05:40:42 +0000
@@ -286,7 +286,10 @@
286 dict(review_status=CodeImportReviewStatus.FAILING), None)286 dict(review_status=CodeImportReviewStatus.FAILING), None)
287 # Only start a new one if the import is still in the REVIEWED state.287 # Only start a new one if the import is still in the REVIEWED state.
288 if code_import.review_status == CodeImportReviewStatus.REVIEWED:288 if code_import.review_status == CodeImportReviewStatus.REVIEWED:
289 self.newJob(code_import)289 extra = {}
290 if status == CodeImportResultStatus.SUCCESS_PARTIAL:
291 extra['date_due'] = UTC_NOW
292 self.newJob(code_import, **extra)
290 # If the status was successful, update date_last_successful.293 # If the status was successful, update date_last_successful.
291 if status in [CodeImportResultStatus.SUCCESS,294 if status in [CodeImportResultStatus.SUCCESS,
292 CodeImportResultStatus.SUCCESS_NOCHANGE]:295 CodeImportResultStatus.SUCCESS_NOCHANGE]:
293296
=== modified file 'lib/lp/code/model/tests/test_codeimportjob.py'
--- lib/lp/code/model/tests/test_codeimportjob.py 2010-02-01 03:55:59 +0000
+++ lib/lp/code/model/tests/test_codeimportjob.py 2010-02-22 05:40:42 +0000
@@ -776,6 +776,21 @@
776 new_job.date_due - running_job.date_due,776 new_job.date_due - running_job.date_due,
777 code_import.effective_update_interval)777 code_import.effective_update_interval)
778778
779 def test_partialSuccessCreatesNewJobDueNow(self):
780 # If called with a status of SUCCESS_PARTIAL, finishJob() creates a
781 # new CodeImportJob for the given CodeImport that is due to run right
782 # now.
783 running_job = self.makeRunningJob()
784 code_import = running_job.code_import
785 self.switchDbUser()
786 getUtility(ICodeImportJobWorkflow).finishJob(
787 running_job, CodeImportResultStatus.SUCCESS_PARTIAL, None)
788 new_job = code_import.import_job
789 self.assert_(new_job is not None)
790 self.assertEqual(new_job.state, CodeImportJobState.PENDING)
791 self.assertEqual(new_job.machine, None)
792 self.assertSqlAttributeEqualsDate(new_job, 'date_due', UTC_NOW)
793
779 def test_doesntCreateNewJobIfCodeImportNotReviewed(self):794 def test_doesntCreateNewJobIfCodeImportNotReviewed(self):
780 # finishJob() creates a new CodeImportJob for the given CodeImport,795 # finishJob() creates a new CodeImportJob for the given CodeImport,
781 # unless the CodeImport has been suspended or marked invalid.796 # unless the CodeImport has been suspended or marked invalid.
782797
=== modified file 'lib/lp/code/stories/codeimport/xx-codeimport-results.txt'
--- lib/lp/code/stories/codeimport/xx-codeimport-results.txt 2010-01-27 03:49:06 +0000
+++ lib/lp/code/stories/codeimport/xx-codeimport-results.txt 2010-02-22 05:40:42 +0000
@@ -6,29 +6,28 @@
6 >>> login('test@canonical.com')6 >>> login('test@canonical.com')
7 >>> from canonical.launchpad.testing.codeimporthelpers import (7 >>> from canonical.launchpad.testing.codeimporthelpers import (
8 ... make_all_result_types)8 ... make_all_result_types)
9 >>> code_import = factory.makeCodeImport()9 >>> code_import_1 = factory.makeCodeImport()
10 >>> code_import_2 = factory.makeCodeImport()
1011
11The make_all_result_types helper method adds a code import result of12The make_all_result_types helper method adds a code import result of
12each possible status value.13each possible status value. There are more status values than are
14shown on the branch page, so we create two imports in order to test
15how each result type is rendered.
1316
14 >>> odin = factory.makeCodeImportMachine(hostname='odin')17 >>> odin = factory.makeCodeImportMachine(hostname='odin')
15 >>> make_all_result_types(code_import, factory, machine=odin)18 >>> make_all_result_types(code_import_1, factory, machine=odin, start=0, count=7)
16 >>> branch_url = canonical_url(code_import.branch)19 >>> branch_url_1 = canonical_url(code_import_1.branch)
20 >>> make_all_result_types(code_import_2, factory, machine=odin, start=7, count=7)
21 >>> branch_url_2 = canonical_url(code_import_2.branch)
17 >>> logout()22 >>> logout()
1823
19For each import result, the start date and finish date is shown along24For each import result, the start date and finish date is shown along
20with the duration. A link to the log file is shown if there was a log25with the duration. A link to the log file is shown if there was a log
21file stored with the result.26file stored with the result.
2227
23 >>> browser.open(branch_url)28 >>> browser.open(branch_url_1)
24 >>> import_results = find_tag_by_id(browser.contents, 'import-results')29 >>> import_results = find_tag_by_id(browser.contents, 'import-results')
25 >>> print extract_text(import_results).replace('—', '--')30 >>> print extract_text(import_results).replace('—', '--')
26 Import started on 2007-12-10 on odin and finished on 2007-12-10
27 taking ten hours -- see the log
28 Import started on 2007-12-09 on odin and finished on 2007-12-09
29 taking nine hours -- see the log
30 Import started on 2007-12-08 on odin and finished on 2007-12-08
31 taking eight hours -- see the log
32 Import started on 2007-12-07 on odin and finished on 2007-12-0731 Import started on 2007-12-07 on odin and finished on 2007-12-07
33 taking seven hours -- see the log32 taking seven hours -- see the log
34 Import started on 2007-12-06 on odin and finished on 2007-12-0633 Import started on 2007-12-06 on odin and finished on 2007-12-06
@@ -46,19 +45,25 @@
4645
47Each of the lines is prefixed with a tick if the result status was46Each of the lines is prefixed with a tick if the result status was
48success, or a cross if the status was a failure. The title of the image47success, or a cross if the status was a failure. The title of the image
49is the text of the failure type.48is the text of the failure or success type.
5049
51 >>> # The ordering here is dependant on the order the status values50 >>> # The ordering here is dependant on the order the status values
52 >>> # are declared in the enumeration.51 >>> # are declared in the enumeration.
53 >>> for img in import_results.fetch('img'):52 >>> for img in import_results.fetch('img'):
54 ... print img53 ... print img
55 <img src="/@@/no" title="Job killed" />
56 <img src="/@@/no" title="Job reclaimed" />
57 <img src="/@@/no" title="Bazaar Update Failed" />
58 <img src="/@@/no" title="Source Update Failed" />
59 <img src="/@@/no" title="Bazaar Import Failed" />54 <img src="/@@/no" title="Bazaar Import Failed" />
60 <img src="/@@/no" title="Source Checkout Failed" />55 <img src="/@@/no" title="Source Checkout Failed" />
61 <img src="/@@/no" title="Internal Failure" />56 <img src="/@@/no" title="Internal Failure" />
62 <img src="/@@/no" title="Failure" />57 <img src="/@@/no" title="Failure" />
58 <img src="/@@/yes-gray" title="Partial Success" />
63 <img src="/@@/yes" title="Success with no changes" />59 <img src="/@@/yes" title="Success with no changes" />
64 <img src="/@@/yes" title="Success" />60 <img src="/@@/yes" title="Success" />
61
62 >>> browser.open(branch_url_2)
63 >>> import_results = find_tag_by_id(browser.contents, 'import-results')
64 >>> for img in import_results.fetch('img'):
65 ... print img
66 <img src="/@@/no" title="Job killed" />
67 <img src="/@@/no" title="Job reclaimed" />
68 <img src="/@@/no" title="Bazaar Update Failed" />
69 <img src="/@@/no" title="Source Update Failed" />
6570
=== modified file 'lib/lp/codehosting/codeimport/tests/test_worker.py'
--- lib/lp/codehosting/codeimport/tests/test_worker.py 2010-02-03 19:29:27 +0000
+++ lib/lp/codehosting/codeimport/tests/test_worker.py 2010-02-22 05:40:42 +0000
@@ -23,7 +23,6 @@
2323
24from CVS import Repository, tree as CVSTree24from CVS import Repository, tree as CVSTree
2525
26from canonical.cachedproperty import cachedproperty
27from canonical.config import config26from canonical.config import config
28from canonical.launchpad.scripts.logger import QuietFakeLogger27from canonical.launchpad.scripts.logger import QuietFakeLogger
29from canonical.testing import BaseLayer28from canonical.testing import BaseLayer
@@ -37,22 +36,46 @@
37 CVSServer, GitServer, MercurialServer, SubversionServer)36 CVSServer, GitServer, MercurialServer, SubversionServer)
38from lp.codehosting.tests.helpers import (37from lp.codehosting.tests.helpers import (
39 create_branch_with_one_revision)38 create_branch_with_one_revision)
40from lp.testing.factory import LaunchpadObjectFactory39from lp.testing import TestCase
4140
42import pysvn41import pysvn
4342
4443
44class ForeignBranchPluginLayer(BaseLayer):
45 """Ensure only specific tests are run with foreign branch plugins loaded.
46 """
47
48 @classmethod
49 def setUp(cls):
50 pass
51
52 @classmethod
53 def tearDown(cls):
54 # Raise NotImplementedError to signal that this layer cannot be torn
55 # down. This means that the test runner will run subsequent tests in
56 # a different process.
57 raise NotImplementedError
58
59 @classmethod
60 def testSetUp(cls):
61 pass
62
63 @classmethod
64 def testTearDown(cls):
65 pass
66
67
45default_format = BzrDirFormat.get_default_format()68default_format = BzrDirFormat.get_default_format()
4669
4770
48class WorkerTest(TestCaseWithTransport):71class WorkerTest(TestCaseWithTransport, TestCase):
49 """Base test case for things that test the code import worker.72 """Base test case for things that test the code import worker.
5073
51 Provides Bazaar testing features, access to Launchpad objects and74 Provides Bazaar testing features, access to Launchpad objects and
52 factories for some code import objects.75 factories for some code import objects.
53 """76 """
5477
55 layer = BaseLayer78 layer = ForeignBranchPluginLayer
5679
57 def setUp(self):80 def setUp(self):
58 TestCaseWithTransport.setUp(self)81 TestCaseWithTransport.setUp(self)
@@ -70,10 +93,6 @@
70 self.assertEqual(93 self.assertEqual(
71 sorted(list_files(directory1)), sorted(list_files(directory2)))94 sorted(list_files(directory1)), sorted(list_files(directory2)))
7295
73 @cachedproperty
74 def factory(self):
75 return LaunchpadObjectFactory()
76
77 def makeTemporaryDirectory(self):96 def makeTemporaryDirectory(self):
78 directory = tempfile.mkdtemp()97 directory = tempfile.mkdtemp()
79 self.addCleanup(shutil.rmtree, directory)98 self.addCleanup(shutil.rmtree, directory)
@@ -906,6 +925,21 @@
906 return self.factory.makeCodeImportSourceDetails(925 return self.factory.makeCodeImportSourceDetails(
907 rcstype='git', url=repository_path)926 rcstype='git', url=repository_path)
908927
928 def test_partial(self):
929 # Only config.codeimport.revisions_import_limit will be imported in a
930 # given run. When bzr-svn and bzr-hg support revision import limits,
931 # this test case can be moved up to PullingImportWorkerTests.
932 worker = self.makeImportWorker(self.makeSourceDetails(
933 'trunk', [('README', 'Original contents')]))
934 self.makeForeignCommit(worker.source_details)
935 self.assertTrue(self.foreign_commit_count > 1)
936 self.pushConfig(
937 'codeimport', revisions_import_limit=self.foreign_commit_count-1)
938 self.assertEqual(
939 CodeImportWorkerExitCode.SUCCESS_PARTIAL, worker.run())
940 self.assertEqual(
941 CodeImportWorkerExitCode.SUCCESS, worker.run())
942
909943
910class TestMercurialImport(WorkerTest, TestActualImportMixin,944class TestMercurialImport(WorkerTest, TestActualImportMixin,
911 PullingImportWorkerTests):945 PullingImportWorkerTests):
912946
=== modified file 'lib/lp/codehosting/codeimport/tests/test_workermonitor.py'
--- lib/lp/codehosting/codeimport/tests/test_workermonitor.py 2010-02-03 19:29:27 +0000
+++ lib/lp/codehosting/codeimport/tests/test_workermonitor.py 2010-02-22 05:40:42 +0000
@@ -334,6 +334,21 @@
334 # callFinishJob did not swallow the error, this will fail the test.334 # callFinishJob did not swallow the error, this will fail the test.
335 return ret335 return ret
336336
337 def test_callFinishJobCallsFinishJobPartial(self):
338 # If the argument to callFinishJob indicates that the subprocess
339 # exited with a code of CodeImportWorkerExitCode.SUCCESS_PARTIAL, it
340 # calls finishJob with a status of SUCCESS_PARTIAL.
341 calls = self.patchOutFinishJob()
342 ret = self.worker_monitor.callFinishJob(
343 makeFailure(
344 error.ProcessTerminated,
345 exitCode=CodeImportWorkerExitCode.SUCCESS_PARTIAL))
346 self.assertEqual(calls, [CodeImportResultStatus.SUCCESS_PARTIAL])
347 self.assertOopsesLogged([])
348 # We return the deferred that callFinishJob returns -- if
349 # callFinishJob did not swallow the error, this will fail the test.
350 return ret
351
337 def test_callFinishJobLogsTracebackOnFailure(self):352 def test_callFinishJobLogsTracebackOnFailure(self):
338 # When callFinishJob is called with a failure, it dumps the traceback353 # When callFinishJob is called with a failure, it dumps the traceback
339 # of the failure into the log file.354 # of the failure into the log file.
340355
=== modified file 'lib/lp/codehosting/codeimport/worker.py'
--- lib/lp/codehosting/codeimport/worker.py 2010-02-01 04:26:12 +0000
+++ lib/lp/codehosting/codeimport/worker.py 2010-02-22 05:40:42 +0000
@@ -21,7 +21,7 @@
21import os21import os
22import shutil22import shutil
2323
24from bzrlib.branch import Branch24from bzrlib.branch import Branch, InterBranch
25from bzrlib.bzrdir import BzrDir, BzrDirFormat25from bzrlib.bzrdir import BzrDir, BzrDirFormat
26from bzrlib.transport import get_transport26from bzrlib.transport import get_transport
27from bzrlib.errors import NoSuchFile, NotBranchError27from bzrlib.errors import NoSuchFile, NotBranchError
@@ -50,6 +50,7 @@
50 SUCCESS = 050 SUCCESS = 0
51 FAILURE = 151 FAILURE = 1
52 SUCCESS_NOCHANGE = 252 SUCCESS_NOCHANGE = 2
53 SUCCESS_PARTIAL = 3
5354
5455
55class BazaarBranchStore:56class BazaarBranchStore:
@@ -407,11 +408,7 @@
407 saved_pwd = os.getcwd()408 saved_pwd = os.getcwd()
408 os.chdir(working_directory)409 os.chdir(working_directory)
409 try:410 try:
410 non_trivial = self._doImport()411 return self._doImport()
411 if non_trivial:
412 return CodeImportWorkerExitCode.SUCCESS
413 else:
414 return CodeImportWorkerExitCode.SUCCESS_NOCHANGE
415 finally:412 finally:
416 shutil.rmtree(working_directory)413 shutil.rmtree(working_directory)
417 os.chdir(saved_pwd)414 os.chdir(saved_pwd)
@@ -497,7 +494,10 @@
497 self.importToBazaar(foreign_tree, bazaar_tree)494 self.importToBazaar(foreign_tree, bazaar_tree)
498 non_trivial = self.pushBazaarWorkingTree(bazaar_tree)495 non_trivial = self.pushBazaarWorkingTree(bazaar_tree)
499 self.foreign_tree_store.archive(foreign_tree)496 self.foreign_tree_store.archive(foreign_tree)
500 return non_trivial497 if non_trivial:
498 return CodeImportWorkerExitCode.SUCCESS
499 else:
500 return CodeImportWorkerExitCode.SUCCESS_NOCHANGE
501501
502502
503class PullingImportWorker(ImportWorker):503class PullingImportWorker(ImportWorker):
@@ -511,6 +511,15 @@
511 """The format classes that should be tried for this import."""511 """The format classes that should be tried for this import."""
512 raise NotImplementedError512 raise NotImplementedError
513513
514 def getExtraPullArgs(self):
515 """Return extra arguments to `InterBranch.pull`.
516
517 This method only really exists because only bzr-git supports the
518 'limit' argument to this method. When bzr-svn and bzr-hg plugin do
519 too, this method can go away.
520 """
521 return {}
522
514 def _doImport(self):523 def _doImport(self):
515 bazaar_tree = self.getBazaarWorkingTree()524 bazaar_tree = self.getBazaarWorkingTree()
516 self.bazaar_branch_store.push(525 self.bazaar_branch_store.push(
@@ -529,10 +538,20 @@
529 else:538 else:
530 raise NotBranchError(self.source_details.url)539 raise NotBranchError(self.source_details.url)
531 foreign_branch = format.open(transport).open_branch()540 foreign_branch = format.open(transport).open_branch()
532 bazaar_tree.branch.pull(foreign_branch, overwrite=True)541 inter_branch = InterBranch.get(foreign_branch, bazaar_tree.branch)
542 pull_result = inter_branch.pull(
543 overwrite=True, **self.getExtraPullArgs())
544 self.pushBazaarWorkingTree(bazaar_tree)
545 last_imported_revison = bazaar_tree.branch.last_revision()
546 if last_imported_revison == foreign_branch.last_revision():
547 if pull_result.old_revid != pull_result.new_revid:
548 return CodeImportWorkerExitCode.SUCCESS
549 else:
550 return CodeImportWorkerExitCode.SUCCESS_NOCHANGE
551 else:
552 return CodeImportWorkerExitCode.SUCCESS_PARTIAL
533 finally:553 finally:
534 bzrlib.ui.ui_factory = saved_factory554 bzrlib.ui.ui_factory = saved_factory
535 return self.pushBazaarWorkingTree(bazaar_tree)
536555
537556
538class GitImportWorker(PullingImportWorker):557class GitImportWorker(PullingImportWorker):
@@ -549,6 +568,10 @@
549 LocalGitBzrDirFormat, RemoteGitBzrDirFormat)568 LocalGitBzrDirFormat, RemoteGitBzrDirFormat)
550 return [LocalGitBzrDirFormat, RemoteGitBzrDirFormat]569 return [LocalGitBzrDirFormat, RemoteGitBzrDirFormat]
551570
571 def getExtraPullArgs(self):
572 """See `PullingImportWorker.getExtraPullArgs`."""
573 return {'limit': config.codeimport.revisions_import_limit}
574
552 def getBazaarWorkingTree(self):575 def getBazaarWorkingTree(self):
553 """See `ImportWorker.getBazaarWorkingTree`.576 """See `ImportWorker.getBazaarWorkingTree`.
554577
555578
=== modified file 'lib/lp/codehosting/codeimport/workermonitor.py'
--- lib/lp/codehosting/codeimport/workermonitor.py 2010-02-01 03:49:23 +0000
+++ lib/lp/codehosting/codeimport/workermonitor.py 2010-02-22 05:40:42 +0000
@@ -302,6 +302,9 @@
302 if reason.value.exitCode == \302 if reason.value.exitCode == \
303 CodeImportWorkerExitCode.SUCCESS_NOCHANGE:303 CodeImportWorkerExitCode.SUCCESS_NOCHANGE:
304 return CodeImportResultStatus.SUCCESS_NOCHANGE304 return CodeImportResultStatus.SUCCESS_NOCHANGE
305 elif reason.value.exitCode == \
306 CodeImportWorkerExitCode.SUCCESS_PARTIAL:
307 return CodeImportResultStatus.SUCCESS_PARTIAL
305 return CodeImportResultStatus.FAILURE308 return CodeImportResultStatus.FAILURE
306 else:309 else:
307 return CodeImportResultStatus.SUCCESS310 return CodeImportResultStatus.SUCCESS
308311
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2010-02-20 13:16:38 +0000
+++ lib/lp/testing/factory.py 2010-02-22 05:40:42 +0000
@@ -255,6 +255,31 @@
255 host = "%s.domain.com" % self.getUniqueString('domain')255 host = "%s.domain.com" % self.getUniqueString('domain')
256 return '%s://%s/%s' % (scheme, host, self.getUniqueString('path'))256 return '%s://%s/%s' % (scheme, host, self.getUniqueString('path'))
257257
258 def makeCodeImportSourceDetails(self, branch_id=None, rcstype=None,
259 url=None, cvs_root=None, cvs_module=None):
260 if branch_id is None:
261 branch_id = self.getUniqueInteger()
262 if rcstype is None:
263 rcstype = 'svn'
264 if rcstype in ['svn', 'bzr-svn', 'hg']:
265 assert cvs_root is cvs_module is None
266 if url is None:
267 url = self.getUniqueURL()
268 elif rcstype == 'cvs':
269 assert url is None
270 if cvs_root is None:
271 cvs_root = self.getUniqueString()
272 if cvs_module is None:
273 cvs_module = self.getUniqueString()
274 elif rcstype == 'git':
275 assert cvs_root is cvs_module is None
276 if url is None:
277 url = self.getUniqueURL(scheme='git')
278 else:
279 raise AssertionError("Unknown rcstype %r." % rcstype)
280 return CodeImportSourceDetails(
281 branch_id, rcstype, url, cvs_root, cvs_module)
282
258283
259class LaunchpadObjectFactory(ObjectFactory):284class LaunchpadObjectFactory(ObjectFactory):
260 """Factory methods for creating Launchpad objects.285 """Factory methods for creating Launchpad objects.
@@ -1409,31 +1434,6 @@
1409 code_import, machine, requesting_user, log_excerpt, log_alias,1434 code_import, machine, requesting_user, log_excerpt, log_alias,
1410 result_status, date_started, date_finished)1435 result_status, date_started, date_finished)
14111436
1412 def makeCodeImportSourceDetails(self, branch_id=None, rcstype=None,
1413 url=None, cvs_root=None, cvs_module=None):
1414 if branch_id is None:
1415 branch_id = self.getUniqueInteger()
1416 if rcstype is None:
1417 rcstype = 'svn'
1418 if rcstype in ['svn', 'bzr-svn', 'hg']:
1419 assert cvs_root is cvs_module is None
1420 if url is None:
1421 url = self.getUniqueURL()
1422 elif rcstype == 'cvs':
1423 assert url is None
1424 if cvs_root is None:
1425 cvs_root = self.getUniqueString()
1426 if cvs_module is None:
1427 cvs_module = self.getUniqueString()
1428 elif rcstype == 'git':
1429 assert cvs_root is cvs_module is None
1430 if url is None:
1431 url = self.getUniqueURL(scheme='git')
1432 else:
1433 raise AssertionError("Unknown rcstype %r." % rcstype)
1434 return CodeImportSourceDetails(
1435 branch_id, rcstype, url, cvs_root, cvs_module)
1436
1437 def makeCodeReviewComment(self, sender=None, subject=None, body=None,1437 def makeCodeReviewComment(self, sender=None, subject=None, body=None,
1438 vote=None, vote_tag=None, parent=None,1438 vote=None, vote_tag=None, parent=None,
1439 merge_proposal=None):1439 merge_proposal=None):
14401440
=== modified file 'utilities/sourcedeps.conf'
--- utilities/sourcedeps.conf 2010-02-18 13:53:20 +0000
+++ utilities/sourcedeps.conf 2010-02-22 05:40:42 +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=2492bzr-git lp:~launchpad-pqm/bzr-git/devel;revno=250
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=27075bzr-svn lp:~launchpad-pqm/bzr-svn/devel;revno=2707
6cscvs lp:~launchpad-pqm/launchpad-cscvs/devel;revno=4306cscvs lp:~launchpad-pqm/launchpad-cscvs/devel;revno=430
7dulwich lp:~launchpad-pqm/dulwich/devel;revno=4157dulwich lp:~launchpad-pqm/dulwich/devel;revno=416
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

Subscribers

People subscribed via source and target branches

to status/vote changes: