Hobby-hacking Eric

2006-03-06

refactored SelectChanges.lhs

I'm probably being a little quick to judge here, but the function with_any_selected_change in SelectChanges.lhs is some serious spaghetti. I'll bet it started out all nice and simple, and we just kept adding functionality to it one tiny feature at time, and us the darcs developers being so used to the code, never noticing that things were getting out of hand.

It took my all Sunday staring at it, making notes on the wiki, and finally tearing it to pieces and putting it back together (just rearranging code) to get a clearer picture what it was doing. I hope my refactor is correct, that it doesn't introduce any weird bugs into the code. One thing I'm slighly worried about is that I took out seemingly pointless seq, something that looks like other_ps `seq` ps' where, if I understand correctly, other_ps is defined to be []. Anyway, so I seperated the notion of counting patches from that of simply deciding which patches to consider. This way I can reuse the latter function in the gui selector. The code compiles. I only hope it does what it's supposed to.


2006-03-05

absolute file stuff / mutt / SelectChanges

Sent off my absolute file patches this morning. I hope they do the right thing. I don't know, but I don't think it want to play with this anymore. Hopefully a third person can look at this because Juliusz is nervous about it and so am I... would be useful if somebody else came in and said, "yes, this is the way to go" or "no! are you crazy?"

Spent most of my hack day (i.e. the part where I wasn't at the gym or grocery shopping) switching to mutt on my laptop. I've been using mutt for a long time, but only at one account at a time, most recently at work. Spent some time splitting my configuration up and automating the relationship between my aliases and save hooks: makefiles and sed are useful for that. Whowouldathunkit. Using make to automatically generate parts of your muttrc. Wish I had thought of it earlier. Anyway, pleased with the switch. Apple Mail infuriates me in many small ways. I also switched to zsh today. Don't know why. Random impulse.

Other than that, I'm slowly starting to understand how SelectChanges works. It's kind of interesting, the frontier between the outer and middle layers of darcs (*). Also very gratifying. I like understanding stuff. You just have to stare at it long enough, and poke at it at the right angles, and eventually it opens up. The trick for SelectChanges was to grep with_selected in the code and write it up as a table on the wiki. I still don't actually know how it all works, but I've got a clearer picture what questions I need to be asking next.

I tend to see darcs in three layers... this is my naive view so far: you got an outer layer which consists of the commands and all their helper code, including stuff to invoke sendmail, etc; next you have the middle layer which deals with the various patch types and how they commute; and finally you have the inner layer, which is the core patch theory stuff. It's probably very hard to distinguish beteen the middle and inner layers for example.


2006-03-04

absolute directories

Two things: got the absolute directories tests running, although I had to hack them up a bit to fix what seems to be darcs bitrot and weird perl. Hope my modifications aren't actually breaking the tests.

Also, I've been going over my patch a little more thoroughly, and have found a few bugs. End result is that patch deux is smaller and cleaner. I'm still not entirely sure if it's correct though, and am hoping for some review from fellow developers. Here's the issues with my patch that I've fixed:
  1. Changes.lhs - was not accounting for the fact that repodir could be relative path; fixed by generalising fix_filepaths_here to fix_filepaths_wrt somerepo, where fix_filepaths_wrt has some extra smarts for detecting what kind of path the current repository is
  2. DarcsCommands.lhs - forgot that ghc 6.2.2 does not have canonicalizePath; tough luck, got rid of code which canonicalizes all the absolute paths. Disadvantage is that now, absolute paths detection doesn't always work. Advantage is that the code is a bit tidier and the patch is smaller
  3. Apply.lhs - was needlessly performing the absolute path conversion
  4. FilePathUtils.lhs - was not producing the right error message, and was not strict enough on what kind of repository paths it expects

Sigh... these aren't fixes to darcs, mind you. They're fixes to my patch, which were supposed to fix darcs.

Ok, wow, it's almost 4 in the morning. I keeping telling myself I'll go to bed earlier, yet I keep getting sucked in to stuff like this...


2006-03-03

wxDarcs, absolute paths and conflictors

Wow, I've been really tired lately. Ought to be going to bed earlier or something.

wxDarcs

Right, so one little bit of good news to lift my spirits: I managed to fix a couple of layout bugs today. For the OS X Tiger layout issue, all I had to do was pack my splitter window inside its own panel, and everything was ok. As a more general issue, I finally figured out how to force one of my buttons to the very bottom of screen (nitpicky that way) -- I just pack all the other buttons, the ones that go on top into their own column. Gui programming can be a pain that.

I also know why the obliterate gui was behaving funny - it seems to be more or less obliterate the reverse of the patches you tell it to. So if you've go 3 patches, foo bar and baz, and you tell it to obliterate foo, it will end up obliterating baz. It seems like gui_select was never implemeneted to deal with is_reverse, which is probably why David (i assume) didn't allow Unrecord/Unpull/Obliterate to accept --gui in the first place. So my new job if I want to get obliterating right is to figure out how to deal with selecting patches in reverse. It's kinda funny -- all this first middle last stuff is vaguely reminiscent of how Vijay-Shanker and Weir 1993 represent chart items in their parsing algorithm (more related to eric job stuff). Of course, there is probably zero relationship between the two except for this notion of head, middle tail... but who knows?

absolute paths

Anyway, after looking at that stuff, I got discouraged and decided to tackle some of my absolute path actions instead. Applied my patch -- very few conflicts -- and cleaned up some of my own code. Now I need to test it out, and sit down and figure out where it could go wrong. I hope the code is right though, because I would really like to get rid of it as soon as possible, and move on to other stuff like Understanding darcs.

conflictors

Starting to read the mailing list in chronological order. I had forgotten that I did not in fact download the entire archives. Wonder if there's any way I can convert this thing into something a lot friendlier for mass-reading. Hopefully the combination of this and my FOSDEM notes will allow me to produce a useful introduction.


2006-03-02

Juliusz seems at last to have had a pocket of free time to apply a few patches. Unfortunately, this breaks the wxDarcs (easy to fix). I'm kinda hesitant about sending these patches in. The darcs gui is really horribly horribly broken, the way I have it set up. Consider, for instance, that it obliterates the wrong patches! Sigh.

There's also my patch for fixing the absolute directory stuff which I need to think about and confirm.

Man... Been a long day. Time for bed.


2006-03-01

darcs developers at fosdem 2006!

Unfortunately, I didn't think to do this on Saturday when there were more of us, so sadly, Juliusz and Andres are missing from this little video:



In the video, you get David, Arjan, Ganesh and me (Eric). You also get members of the future darcs users group, Dmitry, Alexander, Michael, and Joseph. Although, I might add Dmitry has expressed a certain interest in formalising patch theory as a sequent calculus, or something like that, so maybe the darcs developers will have another logician on their side?

Oh, yes and I did mention a videoblog somewhere. This is being cross-posted to a collective video blog shared by a small group of friends from high school, gfdjax.


understanding darcs

I was supposed to spend my day off doing laundry, getting my hair cut, and running a million little errands, but instead I spent it writing my patch theory introduction in Understanding darcs. Oh well, at least I now know how merging works in the very simplest non-conflicting cases. Typical pattern for me. If I want to understand how something works, the best way for me to go about it is to write something in wikibooks about it.