Hg Extension writing questions

Dave Brosius dbrosius at mebigfatguy.com
Sat Apr 10 00:18:26 CDT 2010


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 <http://mercurial.selenic.com/wiki/MercurialApi> says:

"A file context is an object which provides convenient access to various 
data related to a particular file revision. File contexts can be 
converted to a string (for printing, etc - the string representation is 
the "path at shortID"), *tested for truth value (False is "nonexistent")*, 
compared for equality, and used as keys in a dictionary."



        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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial/attachments/20100410/751fdbab/attachment.htm>


More information about the Mercurial mailing list