Determining changeset presence

timeless timeless at gmail.com
Thu Jun 3 03:48:51 CDT 2010


On Thu, Jun 3, 2010 at 10:55 AM, Jason Harris <jason at jasonfharris.com> wrote:
> version 232:b24991eb83a9 is exactly the same as version 237:56c20556c649. You can see that because they have the same diff:
>
> [Bolt:/Development/MacHgDev/MacHgClone] MacHgClone 237(237) ⌘ hg diff -c 232 | md5
> c2838b6b38ab0823bac3486f82a246eb
> [Bolt:/Development/MacHgDev/MacHgClone] MacHgClone 237(237) ⌘ hg diff -c 237 | md5
> c2838b6b38ab0823bac3486f82a246eb

don't forget to use HGPLAIN, otherwise you'll be tripped by:
[defaults]
diff = -U 10 -p

> Thus one can compare revisions based on the md5 of their diff's to parents. Even more advanced would be some "diff hash" which then threw outthe line numbers, etc and could detect a patch even if the line numbers had changed.... etc.

One thing to consider is that I tend to take a patch and split it into
pieces. E.g. someone sent me a patch based on two bugs i reported
about transifex, i took the patch and split it into two commits, one
for each of the two unrelated bugs. This argues that you should in
fact be calculating hunk hashes instead of changeset hashes.

I actually spend a lot of time rewriting history :(.

In addition to splitting things, I sometimes will move a changeset
from after a file rename to before it -- This version is hopefully the
closest you'll find to a pathological edge case.


More information about the Mercurial-devel mailing list