fu: Close-up of Fu, bringing a scoop of water to her mouth (fu)fu ([staff profile] fu) wrote,
@ 2011-09-07 03:10 pm UTC
  • Previous Entry
  • Add to Memories
  • Tell someone about this!
  • Next Entry
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:


--- 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.


(7 comments) - (Post a new comment)
(Flat) (Top-level comments only)

sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (skype, sophie, weemee)


[personal profile] sophie
2011-09-07 11:56 am UTC (link)
I didn't know any of this!

If wanted, I can put this into the global hgrc on the Dreamhack server. :)

(Reply to this)  (Thread


fu: Close-up of Fu, bringing a scoop of water to her mouth (fu)


[staff profile] fu
2011-09-07 11:57 am UTC (link)
Oooh sure that'd be cool :)

(Reply to this)  (Thread from start)  (Parent


ninetydegrees: Drawing: a girl's pale face, with a yellow and green stripe over her right eye (stripe)


[personal profile] ninetydegrees
2011-09-07 12:12 pm UTC (link)
Isn't showfunc=true on by default? Because I think I have this in my patches.
Also git=true messed things up for me (I can't remember how exactly but I think it messed my queue when I was adding/removing files) It was very probably because I didn't do things the right way, though.

(Reply to this)  (Thread


sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (skype, sophie, weemee)


[personal profile] sophie
2011-09-07 12:42 pm UTC (link)
Hmm, if it messes things up, then maybe it won't be a good idea to add it as the Dreamhack default.

As for showfunc, you're actually right - it *is* on by default on the old Dreamhack server, but not on the new Dreamhack server, which is where I generated my latest patch that Fu reviewed, which most likely prompted this post. I'll make sure showfunc is on by default on the new server too :)

(Reply to this)  (Thread from start)  (Parent


fu: Close-up of Fu, bringing a scoop of water to her mouth (fu)


[staff profile] fu
2011-09-12 10:24 am UTC (link)
Hm! Not on in mercurial by default, but from what [personal profile] sophie said, I bet that it's on by default in 'hacks!

I wonder what happened to your queue? I vaguely recall that there were some issues with older versions of mercurial, but I haven't run into anything in ages now.

(Reply to this)  (Thread from start)  (Parent


floatboth: (pic#881994)


[personal profile] floatboth
2011-09-07 03:22 pm UTC (link)
wow! wonder if git can do this…

(Reply to this)  (Thread


fu: Close-up of Fu, bringing a scoop of water to her mouth (fu)


[staff profile] fu
2011-09-12 10:29 am UTC (link)
I thought it might have showfunc, but so far I haven't been able to turn up any results!

(I wouldn't be too surprised if it was possible though...)

(Reply to this)  (Thread from start)  (Parent



(7 comments) - (Post a new comment)
(Flat) (Top-level comments only)