Fwd: Question regarding to hg diff command
Matt Mackall
mpm at selenic.com
Wed May 20 16:31:29 UTC 2015
On Wed, 2015-05-20 at 08:16 -0300, Emanuel Agustin Ocampo wrote:
> Hello!
>
> How to get the complete methods(not only modified line) that contain
> changes in diff file?
In general, Mercurial itself can't do this (not can the vast majority of
version control tools) because it doesn't actually know anything about
the syntax of programming languages and a "method" in C looks very
different from a method in Python, Lisp, or Haskell.
This is actually very hard to do right because it means precisely
parsing the language the way a compiler does.
> I need only the modified methods.
> I tried with hg diff -p but does not work.
hg diff -p copies its behavior from diff -p, which simply reports the
most recent line that wasn't indented at the top of each diff hunk. This
worked pretty well for languages from the 70s (when diff was invented)
that didn't still have line numbers, but doesn't work for lots of more
recent languages.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list