Differentiating explicit from implicit deletes

Benoit Boissinot bboissin at gmail.com
Mon Apr 18 02:55:42 CDT 2011


On Mon, Apr 18, 2011 at 9:18 AM, Matthew Watson <mattw.watson at gmail.com> wrote:
> 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?
>

I don't know any other way.

cheers,

Benoit


More information about the Mercurial-devel mailing list