Merge lp:~james-w/launchpad/new-code-import-method-on-branchtarget into lp:launchpad
Proposed by
James Westby
on 2010-03-26
| Status: | Merged |
|---|---|
| Approved by: | Michael Hudson-Doyle on 2010-03-26 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | not available |
| Proposed branch: | lp:~james-w/launchpad/new-code-import-method-on-branchtarget |
| Merge into: | lp:launchpad |
| Prerequisite: | lp:~james-w/launchpad/remove-code-import-list |
| Diff against target: |
234 lines (+108/-2) 5 files modified
lib/lp/code/interfaces/branchtarget.py (+18/-0) lib/lp/code/model/branchtarget.py (+27/-0) lib/lp/code/model/codeimport.py (+2/-0) lib/lp/code/model/tests/test_branchtarget.py (+49/-1) lib/lp/code/model/tests/test_codeimport.py (+12/-1) |
| To merge this branch: | bzr merge lp:~james-w/launchpad/new-code-import-method-on-branchtarget |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Michael Hudson-Doyle | 2010-03-26 | Approve on 2010-03-26 | |
|
Review via email:
|
|||
Commit Message
New method IBranchTarget.
Description of the Change
Hi,
This adds a newCodeImport() method on IBranchTarget that is quite
a simple wrapper around ICodeImportSet.
The reason for this is basically to export it later from that
position.
It also adds a new property to IBranchTarget, supports_
which indicates, surprisingly, whether the target supports code imports.
This is in the spirit of supports_
only enabled for products, so there is no change from before.
Thanks,
James
To post a comment you must log in.
| Michael Hudson-Doyle (mwhudson) wrote : | # |
Download full text (4.9 KiB)
review:
Approve
| James Westby (james-w) wrote : | # |
Whitespace issues fixed.
Thanks,
James

Two minor whitespace tweaks please, or rather the same one in two
places. Other than that, awesome!
> === modified file 'lib/lp/ code/interfaces /branchtarget. py' code/interfaces /branchtarget. py 2010-01-05 08:18:23 +0000 code/interfaces /branchtarget. py 2010-03-26 01:45:34 +0000 merge_proposals = Attribute( code_imports = Attribute( eable(other_ target) : registrant, branch_name, rcs_type,
> --- lib/lp/
> +++ lib/lp/
> @@ -88,6 +88,9 @@
> supports_
> "Does this target support merge proposals at all?")
>
> + supports_
> + "Does this target support code imports at all?")
> +
> def areBranchesMerg
> """Are branches from other_target mergeable into this target."""
>
> @@ -113,3 +116,18 @@
>
> def getBugTask(bug):
> """Get the BugTask for a given bug related to the branch target."""
> +
> + def newCodeImport(
> + url=None, cvs_root=None, cvs_module=None):
This should be formatted like so:
def newCodeImport( registrant, branch_name, rcs_type, url=None,
cvs_root= None, cvs_module=None):
(https:/ /dev.launchpad. net/PythonStyle Guide#Wrapping% 20long% 20arguments% 20in%20function %20definitions)
> + """Create a new code import for this target. code_imports is False.
> +
> + :param registrant: the `IPerson` who should be recorded as creating
> + the import and will own the resulting branch.
> + :param branch_name: the name the resulting branch should have.
> + :param rcs_type: the type of the foreign VCS.
> + :param url: the url to import from if the import isn't CVS.
> + :param cvs_root: if the import is from CVS the CVSROOT to import from.
> + :param cvs_module: if the import is from CVS the module to import.
> + :returns: an `ICodeImport`.
> + :raises AssertionError: if supports_
> + """
> === modified file 'lib/lp/ code/model/ branchtarget. py' code/model/ branchtarget. py 2010-01-05 08:18:23 +0000 code/model/ branchtarget. py 2010-03-26 01:45:34 +0000 interfaces. branchcollectio n import IAllBranches interfaces. branchtarget import ( stacked_ on, IBranchTarget) interfaces. codeimport import ICodeImportSet interfaces. pocket import PackagePublishi ngPocket launchpad. webapp. interfaces import ICanonicalUrlData
> --- lib/lp/
> +++ lib/lp/
> @@ -19,6 +19,7 @@
> from lp.code.
> from lp.code.
> check_default_
> +from lp.code.
> from lp.registry.
> from canonical.
>
> @@ -36,6 +37,12 @@
> def __ne__(self, other):
> return self.context != other.context
>
> + def newCodeImport(self, registrant, branch_name, rcs_type, url=None,
> + cvs_root=None, cvs_module=None):
Similarly.
> + return getUtility( ICodeImportSet) .new( cvs_module) rget(_BaseBranc hTarget) : IBranchTarget) code_imports( self): eable(self, other_target)...
> + registrant, self, branch_name, rcs_type, url=url,
> + cvs_root=cvs_root, cvs_module=
> +
>
> class PackageBranchTa
> implements(
> @@ -95,6 +102,11 @@
> """See `IBranchTarget`."""
> return True
>
> + @property
> + def supports_
> + """See `IBranchTarget`."""
> + return False
> +
> def areBranchesMerg