Question

I'm writing an extension for which it would be very convenient to be able to perform some logic after a rollback is made.

I looked through all of the documentation I could find on hooks, but I couldn't find a rollback hook. I also tried the post-* hooks (namely, post-rollback), but that also didn't fire. My next step would be to dive into the source, but I thought I'd ask this question in case someone knows.

Is there a rollback hook? And if so, is it possible to wire it up in a Python extension using uisetup() or reposetup()?

Was it helpful?

Solution

After looking around Mercurial's source code, indeed, the internal rollback function (_rollback) doesn't seem to be calling any hooks, so there doesn't seem to be a way to tie in to this event.

I needed the rollback hook because I was writing an extension which maintained metadata about changesets as they occurred. In lieu of being able to tie-in to the rollback event, I ended up writing a custom command as part of the extension to auto-clean any inconsistent state by itself (e.g. a reference to a commit that no longer exists because it was rollback'd).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top