Mercurial has a setting which tries to figure out what function you're in, and adds that to the patch output. It's really helpful when reviewing, so I recommend turning it on. For example, compare this diff:
With this one:
Voila, instant context :) To turn it on, edit your .hgrc file:
nano ~/.hgrc
And then paste this section in it:
showfunc=true makes Mercurial try to parse out the function the lines are changing in. git=true makes Mercurial behave git-like in some aspects, the most important one being that it'll save changes to binary files (such as images) within the generated patch, so that someone applying the patch will have your image placed into the proper path. That is, without your needing to upload the image separately along with instructions for where the image should go.
--- a/bin/upgrading/s2layers/core2.s2 Tue Aug 30 22:12:52 2011 -0500
+++ b/bin/upgrading/s2layers/core2.s2 Wed Aug 31 04:45:59 2011 +0000
@@ -331,6 +331,8 @@
var readonly Tag[] tags "Array of tags applied to this entry.";
var Image userpic "The userpic selected to relate to this entry.";
+ var Image userpic_orig "FIXME";
+ var int itemid "Server stored ID number for this entry";
var readonly string{} metadata "Post metadata. Keys: 'music', 'mood', 'location', 'groups', 'xpost'. Comment metadata. Key: 'poster_ip'";
@@ -378,7 +380,6 @@
var bool new_day "Is this entry on a different day to the previous one?";
var bool end_day "Is this the last entry of a day?";
- var int itemid "Server stored ID number for this entry";
function print_metatypes(bool icon, bool info) "Print the metatype information for this entry";
With this one:
--- a/bin/upgrading/s2layers/core2.s2
+++ b/bin/upgrading/s2layers/core2.s2
@@ -331,6 +331,8 @@ class EntryLite
var readonly Tag[] tags "Array of tags applied to this entry.";
var Image userpic "The userpic selected to relate to this entry.";
+ var Image userpic_orig "FIXME";
+ var int itemid "Server stored ID number for this entry";
var readonly string{} metadata "Post metadata. Keys: 'music', 'mood', 'location', 'groups', 'xpost'. Comment metadata. Key: 'poster_ip'";
@@ -378,7 +380,6 @@ class Entry extends EntryLite
var bool new_day "Is this entry on a different day to the previous one?";
var bool end_day "Is this the last entry of a day?";
- var int itemid "Server stored ID number for this entry";
function print_metatypes(bool icon, bool info) "Print the metatype information for this entry";
Voila, instant context :) To turn it on, edit your .hgrc file:
nano ~/.hgrc
And then paste this section in it:
[diff]
showfunc=true
git=true
showfunc=true makes Mercurial try to parse out the function the lines are changing in. git=true makes Mercurial behave git-like in some aspects, the most important one being that it'll save changes to binary files (such as images) within the generated patch, so that someone applying the patch will have your image placed into the proper path. That is, without your needing to upload the image separately along with instructions for where the image should go.
Has anyone ever managed to retrieve old comment text from a quick reply -- for example, if you accidentally closed your browser window, and then reopened it again?
I'm currently looking at it, and I see code that says it should be retrieving the saved form values, but I've never had it work, and I'm trying to figure out if it's just my browser / setup, or if it just plain doesn't work.
I'm currently looking at it, and I see code that says it should be retrieving the saved form values, but I've never had it work, and I'm trying to figure out if it's just my browser / setup, or if it just plain doesn't work.
perltidy is so tempting
Mar. 1st, 2011 11:37 pmYou could tie perltidy to the mercurial commit hook, and use that as an automatic checker for style before commit.
We have so much old code in various styles, this would be much easier than tweaking things by hand to make everything conform, and once you've gotten past that first big burst of formatting, you could run it again and see any style issues in any new patches.
And yet, and yet...
We have so much old code in various styles, this would be much easier than tweaking things by hand to make everything conform, and once you've gotten past that first big burst of formatting, you could run it again and see any style issues in any new patches.
And yet, and yet...
Put together some bash scripts to determine which repositories we've modified
Feb. 21st, 2011 02:33 pmI just stuck this in my .bashrc file, to let me easily find out which repositories have had commits since the last time it was tagged, so I can put a new tag on it:
( bash scripts )
( bash scripts )
Mercurial Queues
Feb. 9th, 2011 09:14 pmA Git User’s Guide to Mercurial Queues is pretty good, and has led me to investigate (and use) multiple patch queues.
Guards are much more flexible, and let you disable/enable patches easily, as well as mix and match different groups of patches. Everything you can do with qqueue, you can probably do with a guard.
For my purposes, qqueue is better, though. I don't need all that flexibility. I just want to group patches into logical branches, and be able to work on them as a group, as well as be able to stay "on topic" -- any new patches I create being automatically grouped with the patches I'm currently working on.
qqueue has made a few small changes to my workflow that have made my dev work much easier:
* hg qnew automatically adds a new patch in the same queue you're working on. No need to go back and do "hg qguard +featurename" each and every patch. No more annoying miscellaneous unguarded patches that need to be sorted out!
* hg qq -l brings up a list of all patches in the queue. With hg qguard, to find everything applicable, I'd need to do hg qguard -l | grep $featurename
* hg qq --delete $queuename lets me forget about all patches in a queue with a single command -- just what I need when I'm done with something
I still use guards within the patch queue, but only for small things: I use them to tweak configuration, or to disable a patch before running a test. My tests are almost always in a separate patch from my features code these days ;-)
Disadvantages: it's not easy to move patches from one queue to another and you can't apply patches from two different queues at the same time.
For what I need though, it's perfect.
Guards are much more flexible, and let you disable/enable patches easily, as well as mix and match different groups of patches. Everything you can do with qqueue, you can probably do with a guard.
For my purposes, qqueue is better, though. I don't need all that flexibility. I just want to group patches into logical branches, and be able to work on them as a group, as well as be able to stay "on topic" -- any new patches I create being automatically grouped with the patches I'm currently working on.
qqueue has made a few small changes to my workflow that have made my dev work much easier:
* hg qnew automatically adds a new patch in the same queue you're working on. No need to go back and do "hg qguard +featurename" each and every patch. No more annoying miscellaneous unguarded patches that need to be sorted out!
* hg qq -l brings up a list of all patches in the queue. With hg qguard, to find everything applicable, I'd need to do hg qguard -l | grep $featurename
* hg qq --delete $queuename lets me forget about all patches in a queue with a single command -- just what I need when I'm done with something
I still use guards within the patch queue, but only for small things: I use them to tweak configuration, or to disable a patch before running a test. My tests are almost always in a separate patch from my features code these days ;-)
Disadvantages: it's not easy to move patches from one queue to another and you can't apply patches from two different queues at the same time.
For what I need though, it's perfect.
Commit attribution
Feb. 7th, 2011 03:24 pmThinking about attribution. Right now, we have it so that the committer is logged as the patch author in mercurial, and the patch author is listed in the text of the commit message.
I wonder how much work it would be to have the author be in the mercurial log, and the committer noted in the text for accountability.
On the one hand, it would be easier to pull out a list of names for statistics! On the other hand, some commits need to be attributed to multiple people, and there's no way to log multiple authors for a patch other than just listing them all (which wouldn't help with statistics).
Eh, hm.
I wonder how much work it would be to have the author be in the mercurial log, and the committer noted in the text for accountability.
On the one hand, it would be easier to pull out a list of names for statistics! On the other hand, some commits need to be attributed to multiple people, and there's no way to log multiple authors for a patch other than just listing them all (which wouldn't help with statistics).
Eh, hm.
map, sort, map
Feb. 5th, 2011 01:23 pmThe Schwartzian transform came up briefly in conversation in #dreamwidth. It is a way to sort by a calculated value, useful when calculating for said value is expensive.
I think I have seen it before, but I didn't realize it was a common enough idiom to have a name. I like how deceptively confusing it is, but once it is explained line-by-line it suddenly makes sense!
I think I have seen it before, but I didn't realize it was a common enough idiom to have a name. I like how deceptively confusing it is, but once it is explained line-by-line it suddenly makes sense!
Supporting Atom Publishing Protocol
Jan. 11th, 2011 12:54 amI've been working on updating our implementation of the Atom Publishing Protocol for Bug 852, and I have a patch up there now.
Have several longish comments, but the short version is that our implementation was old to the point where I don't think any clients could use it, so I have felt free to break the old URLs while updating our implementation.
That is, I've removed support for:( old urls )
And I've implemented a new interface:
( new URL breakdown )
Does anyone have any concrete reasons I shouldn't push forward with this?
Also, any suggestions for how / whether to support posting to communities? What URL should we use? :-)
Have several longish comments, but the short version is that our implementation was old to the point where I don't think any clients could use it, so I have felt free to break the old URLs while updating our implementation.
That is, I've removed support for:( old urls )
And I've implemented a new interface:
( new URL breakdown )
Does anyone have any concrete reasons I shouldn't push forward with this?
Also, any suggestions for how / whether to support posting to communities? What URL should we use? :-)
Test::More documentation
Jan. 1st, 2011 10:56 amThere's lots of nice stuff over at the Test::More documentation. In particular, I've just had a huge "D'OH" moment, and have switched to using
is_deeply for many of my new tests where I check complex object structures. (Instead of, say, doing a for loop for each variable).(no subject)
Dec. 3rd, 2010 11:23 amOh hey, you can make the jQuery validation plugin do both a summary of all errors before the form, and a per-field error message (best of both worlds?)
I'd been worrying that we'd need to do our own implementation, but now it looks like we don't. Ain't open source grand?
I'd been worrying that we'd need to do our own implementation, but now it looks like we don't. Ain't open source grand?
Yak-shaving
Nov. 18th, 2010 02:52 pmI got sick of typing ?usescheme=* six times for each webpage I was working on, so I turned to the Chrome extension docs.
It took me about 30 minutes to whip up an extension which does all the typing for me, with one click:
https://github.com/afuna/dw-siteskin-pr eviews
I dispensed with some of the niceties (like an icon to click on -- I just click on blank empty space), and it's otherwise very rough, but it's usable. No more typing ?usescheme=blah six times on each page *G*
It took me about 30 minutes to whip up an extension which does all the typing for me, with one click:
https://github.com/afuna/dw-siteskin-pr
I dispensed with some of the niceties (like an icon to click on -- I just click on blank empty space), and it's otherwise very rough, but it's usable. No more typing ?usescheme=blah six times on each page *G*
(no subject)
Nov. 18th, 2010 02:03 pmDoing massive massive cleanup of the site CSS. If I do everything right, everything should just work and it should be easier to work on frontend moving forward.
Have committed all patches that I might otherwise break in my cleanup, but ignoring the rest for now so I don't lose my train of thought.
It is just Thursday! That's good, I thought it was Friday and I'd run out of time *g*
Have committed all patches that I might otherwise break in my cleanup, but ignoring the rest for now so I don't lose my train of thought.
It is just Thursday! That's good, I thought it was Friday and I'd run out of time *g*
While deep in the bowels of S2, trying to track down something unrelated, I stumbled across the
Possibly helpful for things like oh, date formats or margins or whatever.
There's no frontend for it, but it would be simple enough to make it so that if you have a custom value (say one entered via the layer editor), it would show up in the dropdown (so it wouldn't be wiped when you use the customization wizard). Otherwise, just show the default set of values (as before).
Another possible interface would be to have a "custom..." option which would show a hidden text box using JS, but that's a bit more work and probably not worth it unless we had a specific use case in mind.
allow_others attribute for properties, which allows custom values to be saved for properties which usually show up in a dropdown.Possibly helpful for things like oh, date formats or margins or whatever.
There's no frontend for it, but it would be simple enough to make it so that if you have a custom value (say one entered via the layer editor), it would show up in the dropdown (so it wouldn't be wiped when you use the customization wizard). Otherwise, just show the default set of values (as before).
Another possible interface would be to have a "custom..." option which would show a hidden text box using JS, but that's a bit more work and probably not worth it unless we had a specific use case in mind.
Hmm, how odd -- er strike that
Nov. 4th, 2010 05:45 pmWas about to post an entry musing about some odd behavior I'd run into on entry preview, and then it occurred to me that I could probably track down the cause with a couple of moments of investigative work.
Few minutes later, I have a patch, a bug filed, and a fix committed.
(The things I get up to while procrastinating from writing the news post, oops)
Few minutes later, I have a patch, a bug filed, and a fix committed.
(The things I get up to while procrastinating from writing the news post, oops)