commit --amend creates a different changeset ID than when MQ is used
Nathan Goldbaum
nathan12343 at gmail.com
Wed Jun 28 13:41:19 UTC 2017
No, this is working as intended.
If you look at "hg log --debug" in repo2, you'll see a field that looks
like:
extra: amend_source=9a2a7254aaf678e1af77432798a74fb6891c7ded
The "extra" fields are included in the commit metadata used to calculate
the hash. In this case, mercurial recorded that your commit was the result
of an amend operation and records the hash of the original commit.
MQ does not record that information, so it ends up with an extras field
that matches the commit in repo1.
On Tue, Jun 27, 2017 at 2:04 PM, Kaminar <Kaminar at seznam.cz> wrote:
> Hi,
>
> I found during amending a changeset something weird which seems to be a
> bug. I tried it on Mercurial 4.2.1. I will show it on simple example.
>
> Firstly, I create simple repository repo1:
>
> $ hg init repo1
> $ cd repo1
> $ echo "Hello" > file.txt
> $ hg add
> $ hg commit -d "2017-01-01" -m "Message"
> $ hg log -T "{node}\n"
> 17731128c8db3022b3a83f1a0e23601e8b490da7
>
> Now I create the second repository repo2 witch should be same as repo1:
>
> $ hg init repo2
> $ cd repo2
> $ echo "Helo" > file.txt
> $ hg add
> $ hg commit -d "2017-01-01" -m "Message"
>
> In file file.txt I introduced mistake "Helo" --> "Hello". I will fix it
> with commit --amend.
>
> $ echo "Hello" > file.txt
> $ hg commit --amend -d "2017-01-01" -m "Message"
> $ hg log -T "{node}\n"
> ebf71e8762e89cf1eb541e32dfe14a558b61f09f
>
> But changeset ID of amended changeset differs from repo1 changeset ID.
>
> Now I will use MQ for amend mistake. (When continuing from the repo2
> state, it is enough to refresh patch only.)
>
> $ hg qimport -r 0
> $ hg qrefresh -d "2017-01-01"
> $ hg qfinish -a
> $ hg log -T "{node}\n"
> 17731128c8db3022b3a83f1a0e23601e8b490da7
>
> If MQ used for amend, changeset ID in repo2 equals to changeset ID in
> repo1.
>
> Obviously, commit --amend doesn't produce equal changeset IDs even when
> the content and history should be identical in both repositories.
>
> Is it bug?
>
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20170628/7e108371/attachment-0002.html>
More information about the Mercurial
mailing list