graft/rebase without changing the hash

Georges Racinet georges.racinet at octobus.net
Sat Nov 26 13:38:28 UTC 2022


On 11/26/22 14:30, Uwe Brauer wrote:
>>>> "AB" == Arne Babenhauserheide <arne_bab at web.de> writes:
> Hi Arne
>> Hi Uwe,
>> Uwe Brauer <oub at mat.ucm.es> writes:
>>> [[S/MIME Signed Part:Good signature from
>>> D472940B79E53E815167CEC95E244FB27DD2E8DB /CN=BRAUER UWE RICHARD OTTO
>>> - X2064123B/C=ES/SN=BRAUER/GN=UWE RICHARD
>>> OTTO/SerialNumber=IDCES-X2064123B (trust undefined)]]
>>> Is there any possibility to graft/rebase a change set from say the
>>> default branch to another named branch, say main, *without* changing the
>>> hash?
>> No, because the branch name is part of the hash calculation.
> Ok, that makes sense.
>
>>> I can rebase them, (with or without evolve enabled) but the rebased changeset
>>> gets a new hash which means that if I push it, it will confuse git
>>> users.
>> It sounds like what you want is to have the resulting git-hash equal,
>> not to have the Mercurial-hash equal. This could in theory be possible
>> (because the branch name is not part of the hash-generation in git), but
>> I do not know whether it is possible in practice.
> I just realised with *evolve enabled*, the rebase results in no githash at
> all, a bug?
>
> Hg log  -G --follow --template "\x1B[33mcommit {rev}:{gitnode}\nAuthor: {author}\nDate: {date|rfc822date}\n\n{desc}\n{nofiles}\n"
>
> Before the rebase gave
>
> ◍  commit 2:1b0c5dd30a1d0ab00b3f56b2b1202bc4cbc1cb00
> │  Author: Uwe Brauer <oub at mat.ucm.es>
> │  Date: Sat, 26 Nov 2022 14:19:58 +0100
>> │  Git test ode15t non linear blows up
>
> But after the rebase
> @  commit 3:
> │  Author: Uwe Brauer <oub at mat.ucm.es>
> │  Date: Sat, 26 Nov 2022 14:19:58 +0100
>> │  Git test ode15t non linear blows up
>
> But without evolve
> @  commit 1:28f81e628e71ca993da2d5184a5c5c31fa1cef87
> │  Author: Uwe Brauer <oub at mat.ucm.es>
> │  Date: Sat, 26 Nov 2022 14:18:26 +0100
>> │  Add ode15s for the nonlinear equation
>> ○  commit 0:3c82db0a937415e0ffc067c7a7d1891109db021f
>     Author: Uwe Brauer <oub at mat.ucm.es>
>     Date: Sat, 26 Nov 2022 14:17:54 +0100
>
>     First commit to the main branch
>
> In any case this is not good at all.
> I could force a push, but this would make things worse
>
> Any comments from the hg-git team?

Yes! hg-git won't convert to Git unless you tell it to do so (using the 
`gexport` command) or it is really needed (push). Therefore there is no 
corresponding Git hash known yet.

So, please run `hg gexport`. Is it still the same?

Also, Heptapod has been using hg-git, evolve and topics together since 
day 0.


Best,

-- 
Georges Racinet
https://octobus.net, https://about.heptapod.host, https://heptapod.net
GPG: BF5456F4DC625443849B6E58EE20CA44EF691D39, sur serveurs publics



More information about the Mercurial mailing list