https://bz.mercurial-scm.org/show_bug.cgi?id=6965
Bug ID: 6965 Summary: hg diff -p is confused by function names that start with an underscore Product: Mercurial Version: 6.8.1 Hardware: PC OS: NetBSD Status: UNCONFIRMED Severity: feature Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: mercurial-bugzi...@campbell.mumble.net CC: mercurial-de...@mercurial-scm.org Python Version: --- For example: Elf_Addr _rtld(...) { `hg diff -p' shows `Elf_Addr' as the context, but it should show `_rtld(...)' as the context. If I change the name from `_rtld' to `rtld' it works as expected. Test case (currently fails): #!/usr/bin/env cram $ export HGRCPATH="$(pwd)/.hgrc" $ cat <<EOF >$HGRCPATH > [ui] > username = f...@example.com > interactive = no > quiet = yes > verbose = no > EOF Create a repository and add a file: $ hg init repo $ cat <<EOF >repo/foo.c > #include <stdio.h> > > /* > * comment > */ > Elf_Addr > _rtld(void) > { > EOF $ for i in 0 1 2 3; do for j in 0 1 2 3; do printf '\tprintf("foo %d %d\\n");\n' $i $j; done; done >>repo/foo.c $ printf '\treturn 0;\n' >>repo/foo.c $ cat <<EOF >>repo/foo.c > } > EOF $ hg -R repo add repo/foo.c $ hg -R repo commit -d '0 1' -m 'initial tree' repo/foo.c Change a line in the file and view the diff with function context -- should show the function name, but actually shows the return type, as the context: $ sed -i -e 's/foo 2 2/bar 2 2/' repo/foo.c $ hg diff -p --nodates repo/foo.c diff -r 689a7b2c7d0a foo.c --- a/foo.c +++ b/foo.c @@ -16,7 +16,7 @@ _rtld(void) \tprintf("foo 1 3\\n"); (esc) \tprintf("foo 2 0\\n"); (esc) \tprintf("foo 2 1\\n"); (esc) -\tprintf("foo 2 2\\n"); (esc) +\tprintf("bar 2 2\\n"); (esc) \tprintf("foo 2 3\\n"); (esc) \tprintf("foo 3 0\\n"); (esc) \tprintf("foo 3 1\\n"); (esc) -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel