hg push aborts with "push includes obsolete changeset" warning, but hg evolve says there's nothing to fix

Manuel Jacob me at manueljacob.de
Sat Mar 7 09:34:01 UTC 2020


Hi Diab!

On 2020-03-07 06:08, Diab Jerius wrote:
> Mercurial 5.3, evolve 9.30, topic 0.18.0
> 
> I've been doing some histediting of a repository which has resulted in 
> an
> obsolete branch with a bookmark:

I’m not entirely sure what’s the behavior with histedit and bookmarks, 
but in my experience the bookmarks are usually moved properly. Can you 
find a minimal reproducible example that shows a case where the bookmark 
is not moved?

Independent of that, you may want to consider moving away from 
bookmarks. Named branches are a good choice if you want the branch name 
to be in the history permanently. It is perfect for use with permanent 
lines of development. Personally I also use them for feature branches 
because I like that the branch name is shown when looking at the history 
later. Topics are a good choice if you want the branch name to be 
relevant only during the changesets are draft.

If you’re using bookmarks because you push to a Git server, you may fing 
a patch I’ve sent to hg-git useful. It allows to flexibly configure 
which changesets should get git refs. The documentation is not really 
existing at the moment, but you can look at the test 
(https://foss.heptapod.net/mercurial/hg-git/merge_requests/8/diffs?commit_id=c53e3cce0418bd9f3216c72c5b4d878657708309#6af25606bfd4c7217ddbb5a602fab0c84988a0fa).

> % hg heads
> changeset:   349:309951f88722
> tag:         tip
> user:        Diab Jerius <djerius at cfa.harvard.edu>
> date:        Fri Mar 06 21:47:33 2020 -0500
> summary:     optimize mask creation
> 
> changeset:   298:5250d56286e6
> bookmark:    master
> user:        Diab Jerius <djerius at cfa.harvard.edu>
> date:        Fri Mar 06 21:47:33 2020 -0500
> obsolete:    rebased using histedit as 349:309951f88722
> summary:     optimize mask creation

Changesets become hidden when they are obsolete, have no children, are 
not a parent of the working directory ("checked out"), and have no 
bookmark pointing on them. In your case, the bookmark is keeping it 
alive.

> When I try to push this to an empty repo,  hg aborts with an obsolete
> changeset error:
> 
> % hg push
> pushing to /proj/axaf/simul/src/hg/cxcregion
> searching for changes
> abort: push includes obsolete changeset: 5250d56286e6!
> (use 'hg evolve' to get a stable history or --force to ignore warnings)

I’ve been running into a related bug (where it complains about orphans 
instead of obsolete changesets) for a long time. The issue is that 
Mercurial doesn’t realize that the changeset is already on the server.

In your specific case, the problem should have been fixed by moving the 
bookmark. A general workaround is to explicitly push (with -r) only the 
specific changeset you want to push.

It is a funny coincidence that after months of being annoyed by that 
bug, I wrote a WIP patch a few hours before your email. 
(https://foss.heptapod.net/octobus/mercurial-devel/merge_requests/27)

> However,
> 
> % hg evolve
> no troubled changesets
> 
> Out of desperation I deleted the "master" bookmark associated with the
> obsolete branch and the push succeeded.
> 
> I don't know what the expected behavior is, but the abort message 
> output by
> push didn't provide enough information to debug the issue.

As explained above, deleting the master makes the old changeset hidden, 
fixing the message. The abort message is resulting from the bug.

> Thanks,
> Diab

-Manuel



More information about the Mercurial mailing list