Merge lp:~cjwatson/launchpad/codeimport-worker-refactor into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 18231
Proposed branch: lp:~cjwatson/launchpad/codeimport-worker-refactor
Merge into: lp:launchpad
Prerequisite: lp:~cjwatson/launchpad/codeimport-source-details-refactor
Diff against target: 547 lines (+114/-96)
7 files modified
lib/lp/code/xmlrpc/codeimportscheduler.py (+4/-4)
lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py (+5/-5)
lib/lp/codehosting/codeimport/tests/test_worker.py (+16/-16)
lib/lp/codehosting/codeimport/tests/test_workermonitor.py (+6/-6)
lib/lp/codehosting/codeimport/worker.py (+74/-56)
lib/lp/codehosting/codeimport/workermonitor.py (+5/-5)
lib/lp/testing/factory.py (+4/-4)
To merge this branch: bzr merge lp:~cjwatson/launchpad/codeimport-worker-refactor
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+308122@code.launchpad.net

Commit message

Refactor various bits of the code import worker to be less Bazaar-specific.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
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/code/xmlrpc/codeimportscheduler.py'
2--- lib/lp/code/xmlrpc/codeimportscheduler.py 2016-10-11 13:46:57 +0000
3+++ lib/lp/code/xmlrpc/codeimportscheduler.py 2016-10-11 13:46:57 +0000
4@@ -69,10 +69,10 @@
5 job = self._getJob(job_id)
6 arguments = CodeImportSourceDetails.fromCodeImportJob(
7 job).asArguments()
8- branch = job.code_import.branch
9- branch_url = canonical_url(branch)
10- log_file_name = '%s.log' % branch.unique_name[1:].replace('/', '-')
11- return (arguments, branch_url, log_file_name)
12+ target = job.code_import.target
13+ target_url = canonical_url(target)
14+ log_file_name = '%s.log' % target.unique_name[1:].replace('/', '-')
15+ return (arguments, target_url, log_file_name)
16
17 @return_fault
18 def _updateHeartbeat(self, job_id, log_tail):
19
20=== modified file 'lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py'
21--- lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py 2016-10-11 13:46:57 +0000
22+++ lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py 2016-10-11 13:46:57 +0000
23@@ -57,20 +57,20 @@
24 self.assertEqual(code_import_job.id, job_id)
25
26 def test_getImportDataForJobID(self):
27- # getImportDataForJobID returns the worker arguments, branch url and
28+ # getImportDataForJobID returns the worker arguments, target url and
29 # log file name for an import corresponding to a particular job.
30 code_import_job = self.makeCodeImportJob(running=True)
31 code_import = removeSecurityProxy(code_import_job).code_import
32- code_import_arguments, branch_url, log_file_name = \
33+ code_import_arguments, target_url, log_file_name = \
34 self.api.getImportDataForJobID(code_import_job.id)
35 import_as_arguments = CodeImportSourceDetails.fromCodeImportJob(
36 code_import_job).asArguments()
37 expected_log_file_name = '%s.log' % (
38- code_import.branch.unique_name[1:].replace('/', '-'))
39+ code_import.target.unique_name[1:].replace('/', '-'))
40 self.assertEqual(
41- (import_as_arguments, canonical_url(code_import.branch),
42+ (import_as_arguments, canonical_url(code_import.target),
43 expected_log_file_name),
44- (code_import_arguments, branch_url, log_file_name))
45+ (code_import_arguments, target_url, log_file_name))
46
47 def test_getImportDataForJobID_not_found(self):
48 # getImportDataForJobID returns a NoSuchCodeImportJob fault when there
49
50=== modified file 'lib/lp/codehosting/codeimport/tests/test_worker.py'
51--- lib/lp/codehosting/codeimport/tests/test_worker.py 2016-10-11 13:46:57 +0000
52+++ lib/lp/codehosting/codeimport/tests/test_worker.py 2016-10-11 13:46:57 +0000
53@@ -78,7 +78,7 @@
54 get_default_bazaar_branch_store,
55 GitImportWorker,
56 ImportDataStore,
57- ImportWorker,
58+ ToBzrImportWorker,
59 )
60 from lp.codehosting.safe_open import (
61 AcceptAnythingPolicy,
62@@ -428,7 +428,7 @@
63 source_details = self.factory.makeCodeImportSourceDetails()
64 # That the remote name is like this is part of the interface of
65 # ImportDataStore.
66- remote_name = '%08x.tar.gz' % (source_details.branch_id,)
67+ remote_name = '%08x.tar.gz' % (source_details.target_id,)
68 local_name = '%s.tar.gz' % (self.factory.getUniqueString(),)
69 transport = self.get_transport()
70 transport.put_bytes(remote_name, '')
71@@ -442,7 +442,7 @@
72 source_details = self.factory.makeCodeImportSourceDetails()
73 # That the remote name is like this is part of the interface of
74 # ImportDataStore.
75- remote_name = '%08x.tar.gz' % (source_details.branch_id,)
76+ remote_name = '%08x.tar.gz' % (source_details.target_id,)
77 content = self.factory.getUniqueString()
78 transport = self.get_transport()
79 transport.put_bytes(remote_name, content)
80@@ -457,7 +457,7 @@
81 source_details = self.factory.makeCodeImportSourceDetails()
82 # That the remote name is like this is part of the interface of
83 # ImportDataStore.
84- remote_name = '%08x.tar.gz' % (source_details.branch_id,)
85+ remote_name = '%08x.tar.gz' % (source_details.target_id,)
86 content = self.factory.getUniqueString()
87 transport = self.get_transport()
88 transport.put_bytes(remote_name, content)
89@@ -481,7 +481,7 @@
90 store.put(local_name)
91 # That the remote name is like this is part of the interface of
92 # ImportDataStore.
93- remote_name = '%08x.tar.gz' % (source_details.branch_id,)
94+ remote_name = '%08x.tar.gz' % (source_details.target_id,)
95 self.assertEquals(content, transport.get_bytes(remote_name))
96
97 def test_put_ensures_base(self):
98@@ -509,7 +509,7 @@
99 store.put(local_name, self.get_transport(local_prefix))
100 # That the remote name is like this is part of the interface of
101 # ImportDataStore.
102- remote_name = '%08x.tar.gz' % (source_details.branch_id,)
103+ remote_name = '%08x.tar.gz' % (source_details.target_id,)
104 self.assertEquals(content, transport.get_bytes(remote_name))
105
106
107@@ -585,8 +585,8 @@
108 transport = store.import_data_store._transport
109 source_details = store.import_data_store.source_details
110 self.assertTrue(
111- transport.has('%08x.tar.gz' % source_details.branch_id),
112- "Couldn't find '%08x.tar.gz'" % source_details.branch_id)
113+ transport.has('%08x.tar.gz' % source_details.target_id),
114+ "Couldn't find '%08x.tar.gz'" % source_details.target_id)
115
116 def test_fetchFromArchiveFailure(self):
117 # If a tree has not been archived yet, but we try to retrieve it from
118@@ -631,7 +631,7 @@
119
120 def makeImportWorker(self):
121 """Make an ImportWorker."""
122- return ImportWorker(
123+ return ToBzrImportWorker(
124 self.source_details, self.get_transport('import_data'),
125 self.makeBazaarBranchStore(), logging.getLogger("silent"),
126 AcceptAnythingPolicy())
127@@ -728,7 +728,7 @@
128 import_worker.import_data_store.put('git.db')
129 # Make sure there's a Bazaar branch in the branch store.
130 branch = self.make_branch('branch')
131- ImportWorker.pushBazaarBranch(import_worker, branch)
132+ ToBzrImportWorker.pushBazaarBranch(import_worker, branch)
133 # Finally, fetching the tree gets the git.db file too.
134 branch = import_worker.getBazaarBranch()
135 self.assertEqual(
136@@ -747,7 +747,7 @@
137 import_worker.import_data_store.put('git-cache.tar.gz')
138 # Make sure there's a Bazaar branch in the branch store.
139 branch = self.make_branch('branch')
140- ImportWorker.pushBazaarBranch(import_worker, branch)
141+ ToBzrImportWorker.pushBazaarBranch(import_worker, branch)
142 # Finally, fetching the tree gets the git.db file too.
143 new_branch = import_worker.getBazaarBranch()
144 self.assertEqual(
145@@ -767,13 +767,13 @@
146 :source_details: A `CodeImportSourceDetails` describing the import.
147 """
148 tree_transport = get_transport(config.codeimport.foreign_tree_store)
149- prefix = '%08x' % source_details.branch_id
150+ prefix = '%08x' % source_details.target_id
151 if tree_transport.has('.'):
152 for filename in tree_transport.list_dir('.'):
153 if filename.startswith(prefix):
154 tree_transport.delete(filename)
155 branchstore = get_default_bazaar_branch_store()
156- branch_name = '%08x' % source_details.branch_id
157+ branch_name = '%08x' % source_details.target_id
158 if branchstore.transport.has(branch_name):
159 branchstore.transport.delete_tree(branch_name)
160
161@@ -822,7 +822,7 @@
162 """Get the Bazaar branch 'worker' stored into its BazaarBranchStore.
163 """
164 branch_url = worker.bazaar_branch_store._getMirrorURL(
165- worker.source_details.branch_id)
166+ worker.source_details.target_id)
167 return Branch.open(branch_url)
168
169 def test_import(self):
170@@ -885,7 +885,7 @@
171 self.addCleanup(lambda: shutil.rmtree(tree_path))
172
173 branch_url = get_default_bazaar_branch_store()._getMirrorURL(
174- source_details.branch_id)
175+ source_details.target_id)
176 branch = Branch.open(branch_url)
177
178 self.assertEqual(self.foreign_commit_count, branch.revno())
179@@ -1345,7 +1345,7 @@
180 self.assertEqual(
181 CodeImportWorkerExitCode.SUCCESS, worker.run())
182 branch_url = self.bazaar_store._getMirrorURL(
183- worker.source_details.branch_id)
184+ worker.source_details.target_id)
185 branch = Branch.open(branch_url)
186 self.assertEquals(self.revid, branch.last_revision())
187
188
189=== modified file 'lib/lp/codehosting/codeimport/tests/test_workermonitor.py'
190--- lib/lp/codehosting/codeimport/tests/test_workermonitor.py 2016-10-11 13:46:57 +0000
191+++ lib/lp/codehosting/codeimport/tests/test_workermonitor.py 2016-10-11 13:46:57 +0000
192@@ -241,21 +241,21 @@
193 return worker_monitor.getWorkerArguments().addCallback(
194 self.assertEqual, args)
195
196- def test_getWorkerArguments_sets_branch_url_and_logfilename(self):
197- # getWorkerArguments sets the _branch_url (for use in oops reports)
198+ def test_getWorkerArguments_sets_target_url_and_logfilename(self):
199+ # getWorkerArguments sets the _target_url (for use in oops reports)
200 # and _log_file_name (for upload to the librarian) attributes on the
201 # WorkerMonitor from the data returned by getImportDataForJobID.
202- branch_url = self.factory.getUniqueString()
203+ target_url = self.factory.getUniqueString()
204 log_file_name = self.factory.getUniqueString()
205 worker_monitor = self.makeWorkerMonitorWithJob(
206- 1, (['a'], branch_url, log_file_name))
207+ 1, (['a'], target_url, log_file_name))
208
209 def check_branch_log(ignored):
210 # Looking at the _ attributes here is in slightly poor taste, but
211 # much much easier than them by logging and parsing an oops, etc.
212 self.assertEqual(
213- (branch_url, log_file_name),
214- (worker_monitor._branch_url, worker_monitor._log_file_name))
215+ (target_url, log_file_name),
216+ (worker_monitor._target_url, worker_monitor._log_file_name))
217
218 return worker_monitor.getWorkerArguments().addCallback(
219 check_branch_log)
220
221=== modified file 'lib/lp/codehosting/codeimport/worker.py'
222--- lib/lp/codehosting/codeimport/worker.py 2016-10-11 13:46:57 +0000
223+++ lib/lp/codehosting/codeimport/worker.py 2016-10-11 13:46:57 +0000
224@@ -15,6 +15,7 @@
225 'ForeignTreeStore',
226 'GitImportWorker',
227 'ImportWorker',
228+ 'ToBzrImportWorker',
229 'get_default_bazaar_branch_store',
230 ]
231
232@@ -268,18 +269,20 @@
233 of the information suitable for passing around on executables' command
234 lines.
235
236- :ivar branch_id: The id of the branch associated to this code import, used
237- for locating the existing import and the foreign tree.
238+ :ivar target_id: The id of the Bazaar branch associated with this code
239+ import, used for locating the existing import and the foreign tree.
240 :ivar rcstype: 'cvs', 'git', 'bzr-svn', 'bzr' as appropriate.
241 :ivar url: The branch URL if rcstype in ['bzr-svn', 'git', 'bzr'], None
242 otherwise.
243 :ivar cvs_root: The $CVSROOT if rcstype == 'cvs', None otherwise.
244 :ivar cvs_module: The CVS module if rcstype == 'cvs', None otherwise.
245+ :ivar stacked_on_url: The URL of the branch that the associated branch
246+ is stacked on, if any.
247 """
248
249- def __init__(self, branch_id, rcstype, url=None, cvs_root=None,
250+ def __init__(self, target_id, rcstype, url=None, cvs_root=None,
251 cvs_module=None, stacked_on_url=None):
252- self.branch_id = branch_id
253+ self.target_id = target_id
254 self.rcstype = rcstype
255 self.url = url
256 self.cvs_root = cvs_root
257@@ -289,7 +292,7 @@
258 @classmethod
259 def fromArguments(cls, arguments):
260 """Convert command line-style arguments to an instance."""
261- branch_id = int(arguments.pop(0))
262+ target_id = int(arguments.pop(0))
263 rcstype = arguments.pop(0)
264 if rcstype in ['bzr-svn', 'git', 'bzr']:
265 url = arguments.pop(0)
266@@ -305,34 +308,34 @@
267 else:
268 raise AssertionError("Unknown rcstype %r." % rcstype)
269 return cls(
270- branch_id, rcstype, url, cvs_root, cvs_module, stacked_on_url)
271+ target_id, rcstype, url, cvs_root, cvs_module, stacked_on_url)
272
273 @classmethod
274 def fromCodeImportJob(cls, job):
275 """Convert a `CodeImportJob` to an instance."""
276 code_import = job.code_import
277- branch = code_import.branch
278- if branch.stacked_on is not None and not branch.stacked_on.private:
279- stacked_path = branch_id_alias(branch.stacked_on)
280+ target = code_import.target
281+ if target.stacked_on is not None and not target.stacked_on.private:
282+ stacked_path = branch_id_alias(target.stacked_on)
283 stacked_on_url = compose_public_url('http', stacked_path)
284 else:
285 stacked_on_url = None
286 if code_import.rcs_type == RevisionControlSystems.BZR_SVN:
287 return cls(
288- branch.id, 'bzr-svn', str(code_import.url),
289+ target.id, 'bzr-svn', str(code_import.url),
290 stacked_on_url=stacked_on_url)
291 elif code_import.rcs_type == RevisionControlSystems.CVS:
292 return cls(
293- branch.id, 'cvs',
294+ target.id, 'cvs',
295 cvs_root=str(code_import.cvs_root),
296 cvs_module=str(code_import.cvs_module))
297 elif code_import.rcs_type == RevisionControlSystems.GIT:
298 return cls(
299- branch.id, 'git', str(code_import.url),
300+ target.id, 'git', str(code_import.url),
301 stacked_on_url=stacked_on_url)
302 elif code_import.rcs_type == RevisionControlSystems.BZR:
303 return cls(
304- branch.id, 'bzr', str(code_import.url),
305+ target.id, 'bzr', str(code_import.url),
306 stacked_on_url=stacked_on_url)
307 else:
308 raise AssertionError("Unknown rcstype %r." % code_import.rcs_type)
309@@ -340,7 +343,7 @@
310 def asArguments(self):
311 """Return a list of arguments suitable for passing to a child process.
312 """
313- result = [str(self.branch_id), self.rcstype]
314+ result = [str(self.target_id), self.rcstype]
315 if self.rcstype in ['bzr-svn', 'git', 'bzr']:
316 result.append(self.url)
317 if self.stacked_on_url is not None:
318@@ -374,7 +377,7 @@
319 """
320 self.source_details = source_details
321 self._transport = transport
322- self._branch_id = source_details.branch_id
323+ self._target_id = source_details.target_id
324
325 def _getRemoteName(self, local_name):
326 """Convert `local_name` to the name used to store a file.
327@@ -394,7 +397,7 @@
328 if dot_index < 0:
329 raise AssertionError("local_name must have an extension.")
330 ext = local_name[dot_index:]
331- return '%08x%s' % (self._branch_id, ext)
332+ return '%08x%s' % (self._target_id, ext)
333
334 def fetch(self, filename, dest_transport=None):
335 """Retrieve `filename` from the store.
336@@ -505,57 +508,23 @@
337 class ImportWorker:
338 """Oversees the actual work of a code import."""
339
340- # Where the Bazaar working tree will be stored.
341- BZR_BRANCH_PATH = 'bzr_branch'
342-
343- # Should `getBazaarBranch` create a working tree?
344- needs_bzr_tree = True
345-
346- required_format = BzrDirFormat.get_default_format()
347-
348- def __init__(self, source_details, import_data_transport,
349- bazaar_branch_store, logger, opener_policy):
350+ def __init__(self, source_details, logger, opener_policy):
351 """Construct an `ImportWorker`.
352
353 :param source_details: A `CodeImportSourceDetails` object.
354- :param bazaar_branch_store: A `BazaarBranchStore`. The import worker
355- uses this to fetch and store the Bazaar branches that are created
356- and updated during the import process.
357 :param logger: A `Logger` to pass to cscvs.
358 :param opener_policy: Policy object that decides what branches can
359 be imported
360 """
361 self.source_details = source_details
362- self.bazaar_branch_store = bazaar_branch_store
363- self.import_data_store = ImportDataStore(
364- import_data_transport, self.source_details)
365 self._logger = logger
366 self._opener_policy = opener_policy
367
368- def getBazaarBranch(self):
369- """Return the Bazaar `Branch` that we are importing into."""
370- if os.path.isdir(self.BZR_BRANCH_PATH):
371- shutil.rmtree(self.BZR_BRANCH_PATH)
372- return self.bazaar_branch_store.pull(
373- self.source_details.branch_id, self.BZR_BRANCH_PATH,
374- self.required_format, self.needs_bzr_tree,
375- stacked_on_url=self.source_details.stacked_on_url)
376-
377- def pushBazaarBranch(self, bazaar_branch):
378- """Push the updated Bazaar branch to the server.
379-
380- :return: True if revisions were transferred.
381- """
382- return self.bazaar_branch_store.push(
383- self.source_details.branch_id, bazaar_branch,
384- self.required_format,
385- stacked_on_url=self.source_details.stacked_on_url)
386-
387 def getWorkingDirectory(self):
388 """The directory we should change to and store all scratch files in.
389 """
390 base = config.codeimportworker.working_directory_root
391- dirname = 'worker-for-branch-%s' % self.source_details.branch_id
392+ dirname = 'worker-for-branch-%s' % self.source_details.target_id
393 return os.path.join(base, dirname)
394
395 def run(self):
396@@ -594,7 +563,56 @@
397 raise NotImplementedError()
398
399
400-class CSCVSImportWorker(ImportWorker):
401+class ToBzrImportWorker(ImportWorker):
402+ """Oversees the actual work of a code import to Bazaar."""
403+
404+ # Where the Bazaar working tree will be stored.
405+ BZR_BRANCH_PATH = 'bzr_branch'
406+
407+ # Should `getBazaarBranch` create a working tree?
408+ needs_bzr_tree = True
409+
410+ required_format = BzrDirFormat.get_default_format()
411+
412+ def __init__(self, source_details, import_data_transport,
413+ bazaar_branch_store, logger, opener_policy):
414+ """Construct a `ToBzrImportWorker`.
415+
416+ :param source_details: A `CodeImportSourceDetails` object.
417+ :param bazaar_branch_store: A `BazaarBranchStore`. The import worker
418+ uses this to fetch and store the Bazaar branches that are created
419+ and updated during the import process.
420+ :param logger: A `Logger` to pass to cscvs.
421+ :param opener_policy: Policy object that decides what branches can
422+ be imported
423+ """
424+ super(ToBzrImportWorker, self).__init__(
425+ source_details, logger, opener_policy)
426+ self.bazaar_branch_store = bazaar_branch_store
427+ self.import_data_store = ImportDataStore(
428+ import_data_transport, self.source_details)
429+
430+ def getBazaarBranch(self):
431+ """Return the Bazaar `Branch` that we are importing into."""
432+ if os.path.isdir(self.BZR_BRANCH_PATH):
433+ shutil.rmtree(self.BZR_BRANCH_PATH)
434+ return self.bazaar_branch_store.pull(
435+ self.source_details.target_id, self.BZR_BRANCH_PATH,
436+ self.required_format, self.needs_bzr_tree,
437+ stacked_on_url=self.source_details.stacked_on_url)
438+
439+ def pushBazaarBranch(self, bazaar_branch):
440+ """Push the updated Bazaar branch to the server.
441+
442+ :return: True if revisions were transferred.
443+ """
444+ return self.bazaar_branch_store.push(
445+ self.source_details.target_id, bazaar_branch,
446+ self.required_format,
447+ stacked_on_url=self.source_details.stacked_on_url)
448+
449+
450+class CSCVSImportWorker(ToBzrImportWorker):
451 """An ImportWorker for imports that use CSCVS.
452
453 As well as invoking cscvs to do the import, this class also needs to
454@@ -674,7 +692,7 @@
455 return CodeImportWorkerExitCode.SUCCESS_NOCHANGE
456
457
458-class PullingImportWorker(ImportWorker):
459+class PullingImportWorker(ToBzrImportWorker):
460 """An import worker for imports that can be done by a bzr plugin.
461
462 Subclasses need to implement `probers`.
463@@ -806,7 +824,7 @@
464 return config.codeimport.git_revisions_import_limit
465
466 def getBazaarBranch(self):
467- """See `ImportWorker.getBazaarBranch`.
468+ """See `ToBzrImportWorker.getBazaarBranch`.
469
470 In addition to the superclass' behaviour, we retrieve bzr-git's
471 caches, both legacy and modern, from the import data store and put
472@@ -828,7 +846,7 @@
473 return branch
474
475 def pushBazaarBranch(self, bazaar_branch):
476- """See `ImportWorker.pushBazaarBranch`.
477+ """See `ToBzrImportWorker.pushBazaarBranch`.
478
479 In addition to the superclass' behaviour, we store bzr-git's cache
480 directory at .bzr/repository/git in the import data store.
481
482=== modified file 'lib/lp/codehosting/codeimport/workermonitor.py'
483--- lib/lp/codehosting/codeimport/workermonitor.py 2013-01-07 02:40:55 +0000
484+++ lib/lp/codehosting/codeimport/workermonitor.py 2016-10-11 13:46:57 +0000
485@@ -134,7 +134,7 @@
486 self.codeimport_endpoint = codeimport_endpoint
487 self._call_finish_job = True
488 self._log_file = tempfile.TemporaryFile()
489- self._branch_url = None
490+ self._target_url = None
491 self._log_file_name = 'no-name-set.txt'
492 self._access_policy = access_policy
493
494@@ -143,7 +143,7 @@
495 context = {
496 'twisted_failure': failure,
497 'http_request': errorlog.ScriptRequest(
498- [('code_import_job_id', self._job_id)], self._branch_url),
499+ [('code_import_job_id', self._job_id)], self._target_url),
500 }
501 report = config.create(context)
502
503@@ -169,15 +169,15 @@
504 def getWorkerArguments(self):
505 """Get arguments for the worker for the import we are working on.
506
507- This also sets the _branch_url and _log_file_name attributes for use
508+ This also sets the _target_url and _log_file_name attributes for use
509 in the _logOopsFromFailure and finishJob methods respectively.
510 """
511 deferred = self.codeimport_endpoint.callRemote(
512 'getImportDataForJobID', self._job_id)
513
514 def _processResult(result):
515- code_import_arguments, branch_url, log_file_name = result
516- self._branch_url = branch_url
517+ code_import_arguments, target_url, log_file_name = result
518+ self._target_url = target_url
519 self._log_file_name = log_file_name
520 self._logger.info(
521 'Found source details: %s', code_import_arguments)
522
523=== modified file 'lib/lp/testing/factory.py'
524--- lib/lp/testing/factory.py 2016-10-03 17:00:56 +0000
525+++ lib/lp/testing/factory.py 2016-10-11 13:46:57 +0000
526@@ -492,11 +492,11 @@
527 epoch = datetime(2009, 1, 1, tzinfo=pytz.UTC)
528 return epoch + timedelta(minutes=self.getUniqueInteger())
529
530- def makeCodeImportSourceDetails(self, branch_id=None, rcstype=None,
531+ def makeCodeImportSourceDetails(self, target_id=None, rcstype=None,
532 url=None, cvs_root=None, cvs_module=None,
533 stacked_on_url=None):
534- if branch_id is None:
535- branch_id = self.getUniqueInteger()
536+ if target_id is None:
537+ target_id = self.getUniqueInteger()
538 if rcstype is None:
539 rcstype = 'bzr-svn'
540 if rcstype in ['bzr-svn', 'bzr']:
541@@ -516,7 +516,7 @@
542 else:
543 raise AssertionError("Unknown rcstype %r." % rcstype)
544 return CodeImportSourceDetails(
545- branch_id, rcstype, url, cvs_root, cvs_module,
546+ target_id, rcstype, url, cvs_root, cvs_module,
547 stacked_on_url=stacked_on_url)
548
549