Help with extension writing

Greg Ward greg-hg at gerg.ca
Wed Apr 14 20:28:31 CDT 2010


On Wed, Apr 14, 2010 at 6:06 PM, Matthew Watson <mattw.watson at gmail.com> wrote:
> I should add some doco and send you a patch, as when you are completely new
> to the api, it's quite hard to figure out what you are being returned and
> how one can use it, i.e. what the values in the manifest are, what the
> linkrev is etc - there is little doco in the API and this added to my
> confusion.

Please do!  I have successfully tricked the core developers into
coughing up valuable hints on several occasions by writing an
imperfect docstring, sending a patch, and awaiting feedback to correct
my obvious misconceptions.  Repeat until docstring patch is accepted.
Mercurial gains a better docstring, you gain some knowledge and
brownie points, and everybody wins.  It seems to work better if you
use polite circumlocation to point out confusing code rather than
bitchy complaints.

(Which reminds me, I never did finish my brave attempt at documenting
some of the weird internal interfaces around localrepository.push()...
;-)

> One last question: Sometimes when a file has 2 parents, we may want to find
> the closest changectx mergepoint for the 2 ancestor revisions (I guess there
> could be more than one, but there would be 1 that is closer or as close as
> the others) - like changectx.ancestor(self, c2), but for descendants - there
> doesn't appear to be one on changectx, is there something like this
> elsewhere?

Doesn't the linkrev of the parent file revs give what you want?  If
memory serves, filectx.parents() returns 1 or 2 other filectxs, each
of which has a linkrev().  I believe linkrev() is a revnum in the
changelog.  I think that is as close as you're going to get.  If not,
can you show us a cooked example where that doesn't work?

Greg


More information about the Mercurial-devel mailing list