Extension writing questions

Vishakh Harikumar vsh426 at gmail.com
Sat Apr 10 09:17:24 CDT 2010


On Sat, Apr 10, 2010 at 6:26 PM, Dave Brosius <dbrosius at baybroadband.net>wrote:

>  Greetings,
>
> 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."
>
> Also from the MercurialApi [section 5]
    ctx.files() - the files changed in the changeset
so a deleted file would appear in ctx.files(), but you cannot get a
filecontext for it since it does not exist in that changectx.

if you want files that do exist in the changeset
    for filename in changectx - loops over all files in the changeset (in
sorted order)
"for file in c: c[file]" is enough to go through the files

>         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?
>
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial
>
>


-- 
vsh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial/attachments/20100410/25a56d99/attachment.htm>


More information about the Mercurial mailing list