Match a revset pattern against repo.changegroup?

Angel Ezquerra angel.ezquerra at gmail.com
Sun Oct 9 15:13:03 CDT 2011


Hi,

is there an easy way to match a revset pattern against the received
changegroup on the pretxnchangegroup hook?

I am hacking on Jason's excluded-changesets extension (that he
mentioned on a recent thread). I'd like to add support for using
revision sets to define the revisions that should never be accepted
during a push. To do so I am currently checking each revision in the
changegroup one by one, by doing the following:

for node in descendantList:
    if revset,match(ui, "%s and %s" % (node, rset))

where rset is a string containing the revision set that we want to
match, and descedantList was obtained as follows:

startRev = int(repo[node])
descendantRevs = list(repo.changelog.descendants(startRev))
descendantRevs.append(startRev)

The actual code is a bit more complex but not very different from the
code above.

It seems that there should be a better (more efficient) way than
checking the nodes one by one against the revision set using a look.

Any ideas?

Angel


More information about the Mercurial-devel mailing list