Hg Extension writing questions

Benoit Boissinot bboissin at gmail.com
Sat Apr 10 04:54:34 CDT 2010


On Sat, Apr 10, 2010 at 7:18 AM, Dave Brosius <dbrosius at mebigfatguy.com> wrote:
> Greetings,
>
>     I am attempting to write a Hg extension, and am both an Hg and python
> rookie; and am trying to deal with deleted files in change sets, as i get
>
> abort: foo/bar/deletedfile.txt at 0e91d4a6d2cb: not found in manifest!
>
> I am looping over change sets, and just printing out the path for now
>
> i thought the if (fc) would avoid deleted files, based on what the Mercurial
> API says:

"if f in c" should work.

>         while (lVer <= tipVer):
>             c = repo.changectx(lVer)
>             files = c.files()
>             for f in files:
>                 fc = c[f]
>                 if (fc):
>                     path = fc.path();
>
>                     print repo.root + "/" + path
>             lVer=lVer+1
>
> I was wondering how to avoid this error.
>
> Also is there a way to programmatically get the hgext directory from which
> my extension is run?
>

yourextension.__file__ ? (but careful, I don't know how it works in
some circumstances, like with py2exe).

Benoit


More information about the Mercurial mailing list