Annotating backouts

Gregory Szorc gregory.szorc at gmail.com
Wed Nov 13 12:58:37 CST 2013


Transplant and graft write fields into changectx.extra to denote the 
source changeset being cloned. This information can later be queried 
through origin() and destination() to glean some useful info about how 
changesets moved around inside the repository.

I think it could be useful for backouts to record similar annotations.

First, having these annotations would give repositories a more complete 
picture of how changesets "evolve" over time. Currently, Mercurial makes 
no attempt to identify a backout as such - it just looks like a normal 
commit. I'm not sure if the Mercurial core could do anything useful with 
a backout annotation. If not today, having this metadata would open 
doors for future possibilities (although YAGNI applies).

I think the real value of backout annotations would be user benefit. You 
could have revset functions like backout() - select all changesets that 
performed backouts - or backedout() - select all changesets that have 
been backed out. You might even be able to construct a chain from 
initial landing through a backout to final/sticking landing (although 
this is a hard problem). This all could lead to some interesting code 
metrics such as deriving a set of "risky" files/functions/lines that 
have a history of being backed out or even identifying authors with a 
tendency to get backed out.

Is this something that would be considered for core or should it remain 
in the realm of extensions? Would there be technically more to this 
problem beyond stuffing a "backout_source" (or similar) field in extra 
from inside the backout command?

Gregory


More information about the Mercurial mailing list