Reputation: 131525
I want to see a sequence of diffs between consecutive (non-identical) revisions of the same file in a mercurial repository. I can obviously do that by parsing the result of hg log
, extracting the changesets, then reading those two lines at a time and issuing hg diff -r $first_changset -r $second_changeset
in a loop.
But - is there a more straightforward/elegant/graphical way of achieving the same?
Note: Not annotate though - at least not what it does by default. I want to be able to see all changes of the same changeset bunched together.
Upvotes: 0
Views: 82
Reputation: 8720
The quickest way to do this is with hg export
, e.g.:
hg export -r reva:revb
This will actually give you an importable patch, but the extra meta information is often helpful.
The most general solution with the most configurable output is hg log
with templates, e.g.:
hg log -r reva:revb -T '{diff()}\n'
The diff()
template function takes optional arguments to specify include and exclude patterns. See hg help templates
for details.
Note that this also works with -G
and will draw a dependency graph alongside the diffs. Even when the graph is linear, this can help in finding the beginning and end of a diff. Obviously, you can also add further information to the template, such as revision number, hash, commit message, and author.
Normally, hg diff -c
is intended for showing the diffs made by a revision, but unfortunately that does not work when you have multiple revisions.
Upvotes: 1