/srv/irclogs.ubuntu.com/2015/09/17/#launchpad-dev.txt

rpadovanicjwatson, okay, thanks for the explanation :-)07:27
=== danilos` is now known as danilos
wgrantcjwatson: When you're around, can we discuss your snap browser branches?08:58
cjwatsonwgrant: Sure09:57
wgrantcjwatson: The listing branch has an awful lot of tentacles.10:00
wgrantWhat was the motivation behind IHasSnaps?10:00
wgrantThe IBranchCollection/IGitCollection getSnaps methods are a little neater than the alternative, but I'm not sure IHasSnaps is worth its weight.10:01
cjwatsonHm, so originally it was partly because I was going to use it for SnapAddView10:02
cjwatsonBut then I ended up attaching those to Branch/GitRef directly10:02
cjwatsonAnd originally I had a bit more per-implementer logic there10:03
wgrantUsing it to attach views might be justifiable.10:03
wgrantBut those tend to be slightly customised anyway.10:03
cjwatsonSo it can possibly go away now10:03
wgranthttps://code.launchpad.net/~wgrant/launchpad/snap-listings <- here's one I prepared earlier10:03
cjwatsonThe invention of SnapSet.findByContext was fairly late in the development of that branch10:04
wgrantAh, that'd do it.10:04
wgrantI 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:04
wgrant(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
wgrantBrowser tentacles are somewhat unavoidable, but they're at least not inflating the overhuge classes.10:06
cjwatsonThe main problem with moving the *Collection bits out is that they need to use _getBranchSelect etc.10:06
wgrantRight.10:07
wgrantIt may be okaaaay to make that publicer.10:07
wgrantIt's certainly no less gross than putting Snappy bits on the Code collections.10:07
wgrantThen you can use it as a subselect in SnapSet.10:07
wgrantEr10:07
wgrantNo more gross.10:07
wgrantIt's going to be unfortunately slow either way.10:09
wgrantI guess it may remain quick if the number of snap packages doesn't increase beyond a few thousand.10:09
cjwatsonwgrant: 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
cjwatson*DecoratedBranch10:25
cjwatsonThat's relatively foul, but all the alternatives I can think of are much worse10:27
wgrantcjwatson: Oh, I'd forgotten decoratedbranch was a thing.10:29
wgrantHmm, uglyu.10:29
wgrantWe should really abolish DecoratedBranch at some point, but unwrapping in snappy isn't entirely gross.10:29
wgrantExcept that DecoratedBranch exists only in browser.10:30
cjwatsonI don't quite get why it isn't just eager loading.10:30
cjwatsonAnd cachedproperties.10:30
wgrantBecause cachedproperties in the model weren't a thing then.10:30
cjwatsonOh right, that.10:30
wgrantIt's easy enough to abolish now.10:30
cjwatsonIt's only in browser, indeed, so I can't unwrap it in SnapSet.findByContext.10:30
cjwatsonBut could possibly unwrap it in lp.snappy.browser.hassnaps.10:30
wgrantAh yes, indeed.10:31
wgrantThat'll do for now.10:31
cjwatsonI'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:38
wgrantThanks. Other than that it looks sensible.10:39
wgrantOne day we will be free of ridiculous circular imports.10:39
cjwatsonwgrant: 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 method10:40
cjwatsonThough maybe that also means it's fairly harmless to export.10:41
wgrantcjwatson: I'm not sure you even need _get_select.10:41
wgrantI think you can do .is_in(resultset)10:42
wgrantNo leading underscores sounds like an invitation to me.10:42
cjwatsonCan you do .is_in(DecoratedResultSet) though?10:43
wgrantI doubt it.10:43
wgrantBut get_plain_result_set() is not private.10:43
cjwatsonIf is_in is given something that's not an Expr, it list()ifies it first.10:44
cjwatsonSo it might work, but will not be quick.10:44
wgrantAh, damn.10:45
wgrant_get_select it is, then.10:45
wgrantIt even makes it obvious that it's a bit icky.10:46
cjwatsonMaybe I should just export _getBranchSelect rather than writing it out again, though.10:47
wgrantFair.10:47
* cjwatson gets more coffee rather than dithering.10:47
cjwatsonDo 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
cjwatsonI guess we have a few of those ...10:48
wgrantIt is evil, but luckily there is sed.10:50
wgrantIn fact that method's only referenced in that file.10:50
wgrantMm10:50
wgrantI guess the ickiness indicator is valuable.10:50
wgrantSo I'm not fussed either way.10:50
cjwatson 6 files changed, 19 insertions(+), 111 deletions(-)11:11
cjwatson(disentangling from {Branch,Git}Collection11:12
cjwatson)11:12
wgrantbut how11:14
cjwatsonjust the disentanglement commit, not the whole thing :)11:15
wgrantyeah, still surprisingly productive.11:16
cjwatsonwgrant: All done and pushed, both snap-listings and snap-add-view11:26
wgrantHuh.11:31
wgrantIt ended up nearly 500 lines shorter!11:31
wgrantThanks.11:31
cjwatsonSpotting that get{Branch,Repository}Ids were already exported and are nearly the same thing helped.11:35
wgrantahh.11:35
wgrantAre the three related snap templates identical?11:36
cjwatsonAlmost.  Let me see if I can unify/macro them11:37
cjwatsonI wonder if the snap templates should live in lib/lp/snappy/ ?11:38
wgrantThat would indeed make sense, if they can be unified.11:38
cjwatsonThere's precedent for e.g. stuff in code defining pages for registry objects.11:39
wgrantTrue.11:39
wgrantBut better if we can unify them :)11:39
cjwatsonThough that might be a bit too odd since *-index are still going to have to link to them.11:39
wgrantIs that odder than the template in Code referencing weird mixins from Snappy?11:49
cjwatsonwgrant: Pushed, what do you think?  I haven't addressed your review comments yet, that's next12:14
wgrantcjwatson: Looks good.12:24
wgrantCode's running out of Snappy tentacles.12:25
cjwatsonAll this magic dependency injection, I feel like a Java programmer12:26
wgrantHm, it doesn't seem to terrible to me.12:27
wgranttoo12:27
cjwatsonI didn't *actually* say it was terrible :-)12:31
cjwatsonwgrant: "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 them12:34
wgrantcjwatson: 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:34
cjwatsonAh, yes.  Maybe Snap.git_ref should be a cachedproperty so that I can fill it in here.12:36
cjwatsonActually I suspect that bit of preloading isn't doing anything right now.12:37
wgrantYep.12:39
cjwatsonI'll pull that out and sort it out in a later branch.12:42
=== timrc_ is now known as timrc
blrmorning20:42
wgrantMorning blr.21:31
blrhey wgrant21:32

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!