Open Bug 1517657 Opened 6 years ago Updated 5 years ago

Provide a smart-annotate that works well with changes (e.g. clang-format) that fold multiple lines into one

Categories

(Developer Services :: General, task)

task
Not set
normal

Tracking

(Not tracked)

People

(Reporter: karlt, Unassigned)

References

(Blocks 1 open bug)

Details

The `hg smart-annotate` alias from bug 1508002 uses the experimental `--skip` flag for hg annotate. This flag may be suitable for changesets that don't fold multiple lines into one, but the clang-format changes often do fold multiple lines into one. STR: execute one of the following commands. % hg smart-annotate -c -r 5826b2352ac0 dom/worklet/Worklet.cpp | sed -n 426p % hg annotate -w --skip 'desc("ignore-this-changeset") or extdata(get_ignored_changesets)' -c -r 5826b2352ac0 dom/worklet/Worklet.cpp | sed -n 426p Actual: 59c14257aba5* Worklet::~Worklet() { mImpl->NotifyWorkletFinished(); } Expected: 704371789faa* Worklet::~Worklet() { mImpl->NotifyWorkletFinished(); } Mercurial versions 4.7.2 and 4.8.1 provide the same results. See also https://hg.mozilla.org/mozilla-central/annotate/8c2f7b067abe/dom/worklet/Worklet.cpp#l458 or % hg annotate -c -r PRE_TREEWIDE_CLANG_FORMAT dom/worklet/Worklet.cpp | sed -n 459,+3p 59c14257aba5: Worklet::~Worklet() 16197254fa36: { 704371789faa: mImpl->NotifyWorkletFinished(); 16197254fa36: } 59c14257aba5 is the oldest changeset contributing to line 426 in 5826b2352ac0. Reporting the oldest changeset in the annotation unhelpfully skips the more recent behavior-affecting changes.

Marco might have some ideas

Flags: needinfo?(mcastelluccio)

I have written a tool, microannotate, to generate a mirror repository of an already existing repository which makes it possible to have blame information at the word-level rather than the line-level.
It can be used both to have a more detailed visualization of blame, and/or to fix a few bugs (this one included) with line-level blame (with the additional advantage that any whitespace change is ignored, even in patches that are not only changing the formatting, and without a need for a hardcoded list of revisions to skip).

Something similar was built for Linux, so we have an example of the result: https://cregit.linuxsources.org/code/4.19/net/ethernet/eth.c.html.

Flags: needinfo?(mcastelluccio)
You need to log in before you can comment on or make changes to this bug.