[issue15917] hg hook to detect unmerged changesets

Ezio Melotti report at bugs.python.org
Tue Sep 11 18:02:18 CEST 2012


Ezio Melotti added the comment:

> I might be wrong, but the logic in your hook looks a bit complicated.

This might be true.  The logic I followed is that once a cset is merged, it becomes a parent of another cset (either in the same branch or in the "next" one).  So, if the cset is in 3.x and is not a parent, it should be merged.

> Wouldn't it be simpler to find all topological heads in the new csets
> (a topological head is a cset without any child), and check that none
> of them is on a 3.* branch?

If it's not a parent, it also means that it doesn't have any child, so we are looking at the same thing from two different points of view.

If I'm reading the code you linked correctly, it's adding all the incoming changesets in a set, and for each changeset added to the set, all its parent are removed, so that eventually only the childless changesets (the topological heads) are left.  This should also be equivalent to "set(allcsets) - set(allparents)".

On the other hand my code checks for specific branches, so if you commit on 3.1 and merge on default, the cset in 3.1 is not a topological head so it's not detected by the version you linked, whereas my script will complain saying that it should be merged with 3.2 and then with default (even if maybe it should complain because you merged it in the wrong branch).

----------
nosy: +eric.araujo

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15917>
_______________________________________


More information about the Python-bugs-list mailing list