[07:27] cjwatson, okay, thanks for the explanation :-) === danilos` is now known as danilos [08:58] cjwatson: When you're around, can we discuss your snap browser branches? [09:57] wgrant: Sure [10:00] cjwatson: The listing branch has an awful lot of tentacles. [10:00] What was the motivation behind IHasSnaps? [10:01] The IBranchCollection/IGitCollection getSnaps methods are a little neater than the alternative, but I'm not sure IHasSnaps is worth its weight. [10:02] Hm, so originally it was partly because I was going to use it for SnapAddView [10:02] But then I ended up attaching those to Branch/GitRef directly [10:03] And originally I had a bit more per-implementer logic there [10:03] Using it to attach views might be justifiable. [10:03] But those tend to be slightly customised anyway. [10:03] So it can possibly go away now [10:03] https://code.launchpad.net/~wgrant/launchpad/snap-listings <- here's one I prepared earlier [10:04] The invention of SnapSet.findByContext was fairly late in the development of that branch [10:04] Ah, that'd do it. [10:04] I also don't really like the IBranchCollection and IGitCollection tentacles, but they're far more contained so if it's not easy to give a method on SnapSet a BranchCollection or GitCollection then they're not unreasonable. [10:06] (I realise this is a standard that code hasn't previously been held to, but I'd prefer the situation not continue to get worse) [10:06] Browser tentacles are somewhat unavoidable, but they're at least not inflating the overhuge classes. [10:06] The main problem with moving the *Collection bits out is that they need to use _getBranchSelect etc. [10:07] Right. [10:07] It may be okaaaay to make that publicer. [10:07] It's certainly no less gross than putting Snappy bits on the Code collections. [10:07] Then you can use it as a subselect in SnapSet. [10:07] Er [10:07] No more gross. [10:09] It's going to be unfortunately slow either way. [10:09] I guess it may remain quick if the number of snap packages doesn't increase beyond a few thousand. [10:25] wgrant: Your branch causes lp.snappy.browser.tests.test_snaplisting.TestSnapListing.test_branch_links_to_snaps to fail, because DecoratedBranch isn't a thing that can be passed to SnapSet.findByContext; since there's no longer an interface in use here, lazr.delegates doesn't fix it up for us. What's the least bad way to fix this? Maybe make lp.snappy.browser.hassnaps explicitly check for Decoratedbranch? [10:25] *DecoratedBranch [10:27] That's relatively foul, but all the alternatives I can think of are much worse [10:29] cjwatson: Oh, I'd forgotten decoratedbranch was a thing. [10:29] Hmm, uglyu. [10:29] We should really abolish DecoratedBranch at some point, but unwrapping in snappy isn't entirely gross. [10:30] Except that DecoratedBranch exists only in browser. [10:30] I don't quite get why it isn't just eager loading. [10:30] And cachedproperties. [10:30] Because cachedproperties in the model weren't a thing then. [10:30] Oh right, that. [10:30] It's easy enough to abolish now. [10:30] It's only in browser, indeed, so I can't unwrap it in SnapSet.findByContext. [10:30] But could possibly unwrap it in lp.snappy.browser.hassnaps. [10:31] Ah yes, indeed. [10:31] That'll do for now. [10:38] I've pulled your branch and fixed that up. I'll work on the *Collection bits next, and then merge into snap-add-view and make sure everything still works there. [10:39] Thanks. Other than that it looks sensible. [10:39] One day we will be free of ridiculous circular imports. [10:40] wgrant: Hm, would it be OK to use collection.getBranches().get_plain_result_set()._get_select() in SnapSet? That's all _getBranchSelect does, so it'd save exporting a new interface method [10:41] Though maybe that also means it's fairly harmless to export. [10:41] cjwatson: I'm not sure you even need _get_select. [10:42] I think you can do .is_in(resultset) [10:42] No leading underscores sounds like an invitation to me. [10:43] Can you do .is_in(DecoratedResultSet) though? [10:43] I doubt it. [10:43] But get_plain_result_set() is not private. [10:44] If is_in is given something that's not an Expr, it list()ifies it first. [10:44] So it might work, but will not be quick. [10:45] Ah, damn. [10:45] _get_select it is, then. [10:46] It even makes it obvious that it's a bit icky. [10:47] Maybe I should just export _getBranchSelect rather than writing it out again, though. [10:47] Fair. [10:47] * cjwatson gets more coffee rather than dithering. [10:48] Do you have an opinion on the practice of exporting interface methods with leading underscore as an "ok, you don't have to remove the sec proxy, but it's still icky" indicator? [10:48] I guess we have a few of those ... [10:50] It is evil, but luckily there is sed. [10:50] In fact that method's only referenced in that file. [10:50] Mm [10:50] I guess the ickiness indicator is valuable. [10:50] So I'm not fussed either way. [11:11] 6 files changed, 19 insertions(+), 111 deletions(-) [11:12] (disentangling from {Branch,Git}Collection [11:12] ) [11:14] but how [11:15] just the disentanglement commit, not the whole thing :) [11:16] yeah, still surprisingly productive. [11:26] wgrant: All done and pushed, both snap-listings and snap-add-view [11:31] Huh. [11:31] It ended up nearly 500 lines shorter! [11:31] Thanks. [11:35] Spotting that get{Branch,Repository}Ids were already exported and are nearly the same thing helped. [11:35] ahh. [11:36] Are the three related snap templates identical? [11:37] Almost. Let me see if I can unify/macro them [11:38] I wonder if the snap templates should live in lib/lp/snappy/ ? [11:38] That would indeed make sense, if they can be unified. [11:39] There's precedent for e.g. stuff in code defining pages for registry objects. [11:39] True. [11:39] But better if we can unify them :) [11:39] Though that might be a bit too odd since *-index are still going to have to link to them. [11:49] Is that odder than the template in Code referencing weird mixins from Snappy? [12:14] wgrant: Pushed, what do you think? I haven't addressed your review comments yet, that's next [12:24] cjwatson: Looks good. [12:25] Code's running out of Snappy tentacles. [12:26] All this magic dependency injection, I feel like a Java programmer [12:27] Hm, it doesn't seem to terrible to me. [12:27] too [12:31] I didn't *actually* say it was terrible :-) [12:34] wgrant: "There won't always be matching GitRefs, so this preloading won't always find everything." but if they don't exist we don't need to preload them [12:34] cjwatson: But if the preloading is useful, then whatever it is useful to will make queries for the refs that aren't in the cache. [12:36] Ah, yes. Maybe Snap.git_ref should be a cachedproperty so that I can fill it in here. [12:37] Actually I suspect that bit of preloading isn't doing anything right now. [12:39] Yep. [12:42] I'll pull that out and sort it out in a later branch. === timrc_ is now known as timrc [20:42] morning [21:31] Morning blr. [21:32] hey wgrant