how to ammend a changeset and push

7 views
Skip to first unread message

Uwe Brauer

unread,
Oct 18, 2024, 5:04:01 AM10/18/24
to Mercurial List, via hg-git

Hi

Here is my supposed workflow (for a fork in github)

- Fork the repository

- clone it to you machine

- commit a change on a new branch (bookmark)

- push

- changes that are suggested by the maintainer should be done by amending the changes to the commit that was already pushed!!!

- and then push again

I tried that using the latest hg-git vanilla (so no fancy stuff like named branches or topics).
I tried it with or without evolve, for example without evolve something like
hg commit -m "matlab-mode: update url to github, modify list of files" --amend

But then the push command returned

hg push
pushing to git+ssh://g...@github.com:ouboub/melpa-matlab.git
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
searching for changes
abort: unknown revision 'd7fc2eeb5a0aede72bb7f221d901656822a98c24'


I cannot use hg histedit because the changeset is already public.


Any idea how to do this?

Or is this beyond hg-git?

Regards

Uwe



--
I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel
I strongly condemn Putin's war of aggression against Ukraine.
I support to deliver weapons to Ukraine's military.
I support the EU and NATO membership of Ukraine.

Dan Villiom Podlaski Christiansen

unread,
Nov 18, 2024, 1:15:37 PM11/18/24
to hg-...@googlegroups.com, Mercurial List
You really should look into the `evolve` extension; not only is it
pretty awesome in itself, but it also simplifies editing history when
using hg-git a good deal.

You can also simply enable `obsolete` support locally, I believe; it
should have the same effect:

  [experimental]
  evolution = yes

In the default setup, any history modification consists of adding new
commits and stripping the old ones. There's nothing telling hg-git of
this fact, so you have to invoke `hg git-cleanup` after each modification.

If you do enable obsolete/evolution though, the old commits will stick
around, and be shown with the old Git pseudo-tags pointing to them. You
can then do a force push to update them.

(Not sure why evolution is still experimental at this point; it's been
around for years, and seems to work very well in practice ¯\_(ツ)_/¯)

Or just the short version: Run `hg git-cleanup` prior to pushing.

- Dan

Uwe Brauer

unread,
Nov 18, 2024, 1:30:14 PM11/18/24
to Dan Villiom Podlaski Christiansen, hg-...@googlegroups.com, Mercurial List
>>> "DVPC" == Dan Villiom Podlaski Christiansen <dan...@gmail.com> writes:

> You really should look into the `evolve` extension; not only is it
> pretty awesome in itself, but it also simplifies editing history when
> using hg-git a good deal.


Oh I do use that extension quite intensively mainly because of topics!
The problem I described was also present when I enabled evolve.

> You can also simply enable `obsolete` support locally, I believe; it
> should have the same effect:

>   [experimental]
>   evolution = yes

ok this setting I did not know, thanks


> In the default setup, any history modification consists of adding new
> commits and stripping the old ones. There's nothing telling hg-git of
> this fact, so you have to invoke `hg git-cleanup` after each
> modification.

Ok good to know, but in order to push, I had to use the force option, which make me shudder.


> If you do enable obsolete/evolution though, the old commits will stick
> around, and be shown with the old Git pseudo-tags pointing to them.
> You can then do a force push to update them.

> (Not sure why evolution is still experimental at this point; it's been
> around for years, and seems to work very well in practice ¯\_(ツ)_/¯)

> Or just the short version: Run `hg git-cleanup` prior to pushing.

Ok I will in the future.

Dan Villiom Podlaski Christiansen

unread,
Nov 18, 2024, 2:01:38 PM11/18/24
to Uwe Brauer, hg-...@googlegroups.com, Mercurial List
On 18/11/2024 19.30, Uwe Brauer wrote:

>>>> "DVPC" == Dan Villiom Podlaski Christiansen <dan...@gmail.com> writes:
>> You really should look into the `evolve` extension; not only is it
>> pretty awesome in itself, but it also simplifies editing history when
>> using hg-git a good deal.
>
> Oh I do use that extension quite intensively mainly because of topics!
> The problem I described was also present when I enabled evolve.


In that case, it sounds like a bug. If the commit still exists in
Mercurial, you shouldn't get that error. 1.2.0b1 may improve on that,
though…

>> You can also simply enable `obsolete` support locally, I believe; it
>> should have the same effect:
>>   [experimental]
>>   evolution = yes
> ok this setting I did not know, thanks
>
>
>> In the default setup, any history modification consists of adding new
>> commits and stripping the old ones. There's nothing telling hg-git of
>> this fact, so you have to invoke `hg git-cleanup` after each
>> modification.
> Ok good to know, but in order to push, I had to use the force option, which make me shudder.


One of the challanges with hg-git is that you have to understand two
version control systems. Using `--force` with hg-git should be
equivalent to using `--force-with-lease` with Git, so the push will
still be rejected if you haven't pulled the latest changes. But it's
necessary to update any branch in a non-linear fashion, i.e. if you
modified history.


- Dan

Uwe Brauer

unread,
Nov 18, 2024, 2:29:29 PM11/18/24
to Dan Villiom Podlaski Christiansen, Uwe Brauer, hg-...@googlegroups.com, Mercurial List

> On 18/11/2024 19.30, Uwe Brauer wrote:


> In that case, it sounds like a bug. If the commit still exists in
> Mercurial, you shouldn't get that error. 1.2.0b1 may improve on that,
> though…

Ok but I basically use the hg-git changeset which supports named-branches


> One of the challanges with hg-git is that you have to understand two
> version control systems. Using `--force` with hg-git should be
> equivalent to using `--force-with-lease` with Git, so the push will
> still be rejected if you haven't pulled the latest changes. But it's
> necessary to update any branch in a non-linear fashion, i.e. if you
> modified history.

In my case it was a fork of the MELPA repository, and the maintainer
wanted a series of changes, that should all only be amended. So he
himself did not pushed.

But it is good to know that --force-with-lease is supported

> - Dan

Uwe Brauer

unread,
Nov 19, 2024, 11:14:06 AM11/19/24
to Dan Villiom Podlaski Christiansen, hg-...@googlegroups.com, Mercurial List
>>> "DVPC" == Dan Villiom Podlaski Christiansen <dan...@gmail.com> writes:

> You really should look into the `evolve` extension; not only is it
> pretty awesome in itself, but it also simplifies editing history when
> using hg-git a good deal.

> You can also simply enable `obsolete` support locally, I believe; it
> should have the same effect:

>   [experimental]
>   evolution = yes
just to get this right
--8<---------------cut here---------------start------------->8---
[extensions]
evolve =
--8<---------------cut here---------------end--------------->8---

Is *not* enough!
Reply all
Reply to author
Forward
0 new messages