← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] lp:~cjwatson/launchpad/codeimport-git-url-per-target-rcs into lp:launchpad

 

Review: Approve code



Diff comments:

> 
> === modified file 'lib/lp/code/model/codeimport.py'
> --- lib/lp/code/model/codeimport.py	2016-10-15 02:20:53 +0000
> +++ lib/lp/code/model/codeimport.py	2016-11-12 02:33:42 +0000
> @@ -364,9 +364,14 @@
>          return CodeImport.selectOneBy(
>              cvs_root=cvs_root, cvs_module=cvs_module)
>  
> -    def getByURL(self, url):
> +    def getByURL(self, url, target_rcs_type):
>          """See `ICodeImportSet`."""
> -        return CodeImport.selectOneBy(url=url)
> +        clauses = [CodeImport.url == url]
> +        if target_rcs_type == TargetRevisionControlSystems.BZR:
> +            clauses.append(CodeImport.branch != None)
> +        else:
> +            clauses.append(CodeImport.git_repository != None)

A target_rcs_type of None or some other wrong type implies git, which is possibly an accident waiting to happen.

> +        return IStore(CodeImport).find(CodeImport, *clauses).one()
>  
>      def getByBranch(self, branch):
>          """See `ICodeImportSet`."""


-- 
https://code.launchpad.net/~cjwatson/launchpad/codeimport-git-url-per-target-rcs/+merge/310696
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.


References