[12:40] <rbasak> I'd like to get a list of all git_repository objects owned by ~usd-import-team with Ubuntu distribution source package targets.
[12:41] <rbasak> Does sharing_service.getSharedGitRepositories do what I want?
[12:41] <rbasak> How in launchpad do I get an object which has that method?
[12:46] <rbasak> in launchpadlib I mean
[12:57] <rbasak> tomwardill: ^ please
[12:57] <tomwardill> rbasak: err, I don't know :) I can have a look after this meeting
[12:58] <rbasak> Thanks ;)
[13:36] <tomwardill> rbasak: lp.git_repositories.getRepositories(target=<dsp>)
[13:36] <tomwardill> hmm, no, that's not quite what you want
[13:37] <tomwardill> I can't see a way other than doing lp.git_repositories.getRepositories(target=~usd-import-team) and then interating
[13:37]  * tomwardill defers to cjwatson 
[13:40] <cjwatson> I can't think of anything else.
[13:40] <cjwatson> Presumably a tiny minority of ~usd-import-team's repos *aren't* owned by DSPs
[13:41] <cjwatson> And sharing_service.getSharedGitRepositories is not what you want, no
[13:41] <cjwatson> (Fairly sure public repos won't appear there, which will be ~all of them)
[14:15] <rbasak> Ah
[14:16] <rbasak> I didn't realise that using ~usd-import-team as a target would give me those repositories (I thought the target was the DSP?)
[14:16] <rbasak> lp.git_repositories.getRepositories(target=lp.people['usd-import-team']) gives me 5412 entries, so that's probably it.
[14:17] <rbasak> I can filter that by Ubuntu DSP client-side - as you say most of them will match. Thanks!
[14:23] <cjwatson> It's a bit weird and possibly an accident.  But a convenient one ...
[14:23] <cjwatson> Should possibly add an optional owner argument to that
[14:24] <cjwatson> (My expectation without having checked the code recently would have been the same as yours.  But it does IGitCollection(target), and the IGitCollection adapter for Person is .ownedBy)
[14:30] <rbasak> To make this go faster, is there any way I can get the self_link for each entry in a collection without loading each entry from LP? I presume that's what happens if I just try to iterate over them?
[14:30] <rbasak> I'm really just after a list of the push URL for every repository currently imported by git-ubuntu for a fix-up hack script to chug through them all. So hacks are fine.
[14:31] <rbasak> So I can do the filter just by checking self_link.startswith(...).
[14:31] <rbasak> And compose the push URL string manually by hacking on the URL.
[14:47] <cjwatson> rbasak: Each batch of the collection response has the full representation of each of the entries in the batch.  You'd only need to optimise that way if you were looking at other objects referred to by those entries.
[14:47] <cjwatson> rbasak: Have a look at this to see what I mean:  curl -s 'https://api.launchpad.net/devel/+git?target=%22%2F~usd-import-team%22&ws.op=getRepositories' | jq -S
[14:48] <cjwatson> If you just iterate over the collection and only look at immediate properties of the entries in it, you'll make about n/75 requests.
[14:49] <rbasak> cjwatson: understood. Thanks!