Search code examples
c++cmercurial

Is there a way to ignore a commit in hg blame?


I have files with a lot of macros which I want to replace with C++ code with templates.

In doing so, I'll have to change code like this

#define stuff_to_do (x) \
   do_some_stuff_##x( );  \
   do_some_more_stuff( x ); 

into

template <class T>
void stuff_to_do( T x ) {
       do_some_stuff<T>();
       do_some_more_stuff(); 
}

i.e. change tabs/spaces, and escape characters, and small insertions (like <T>) here and there.

It is important, however, that the annotations can point to the programmer who did the changes before this.

  • Can I make mercurial annotations ignore a particular commit ?
  • If not, is there another trick that I could do?

Solution

  • There's no way to tell hg annotate to not show certain commits. Henceforth people checking "who originally wrote this" are going to have to look "before" this mass change themselves.

    Some things that might make that future detective work easier are:

    1. do the commit as a non-human user. Something like hg commit --user "codeformat bot" so folks know not to "blame" you
    2. leave the old version in place but commented out -- duplicating it and changing the copy rather than changing the original will make it easy to see the original blame info on the commented out lines (provided a block comment is used and is legal in macros...)