Differentiating explicit from implicit deletes

Matthew Watson mattw.watson at gmail.com
Mon Apr 18 02:18:26 CDT 2011


Hi Guys,

I'm working on an extension and I want to be able to differentiate
"merged in" deletes of file from real explicit "hg rm file" commits.

Why? because in our tool, we get cases where a file is created and
deleted and then 13 more entries saying it has been deleted, which are
really merges of the delete.

Now I could just check if the file only exist in ctx.p1() and not
ctx.p2(), then classify it as a merged in delete, but there is an edge
case, where a file is added on a branch then removed DURING a merge,
as in:

hg add X
hg commit
... other commits...
hg merge
hg rm X
hg commit

So, the only way I can see is to check:

if not file in ctx and file in ctx.p1() and not file in ctx.p2() and
file in ctx.p1().ancestor(ctx.p2())

So

Is there a better way to do this?

Thanks,
Matt


More information about the Mercurial-devel mailing list