mrcrowl/vscode-hg

Pushes fail with the topic extension in use

Closed this issue · 3 comments

When I'm using the topic/evolve Mercurial extensions, pushes from within the vscode extension complain

Branch 'default' has multiple heads. Merge required before pushing.

Pushing from the command line has no such problem.

The topic extension does allow multiple heads in the view of tools unaware of it (including Mercurial where it has not been enabled). However, in this specific instance I don't even have multiple heads: the “topic branch” I'm in is simply ahead of what would be considered the head of “default”. hg heads only shows the head of the topic branch as a head, and Mercurial without the topic extension should also only see that head as a head. So I'm not sure how vscode-hg could be confused.

Alternatively it could be that Changeset Evolution “obsoleting” changesets is confusing vscode-hg, if it somehow tries to internally keep track of the state. But I haven't had this problem on repositories where I use Changeset Evolution and don't have topic branches.

Note that I'm not asking for vscode-hg to support the topic/evolve extensions, but at the same time, if the underlying Mercurial is aware of them, I don't think their use should confuse vscode-hg as currently seems to be the case.

This may have been fixed in #37.
@yadayadaydadaa could you please share instructions on how to reproduce the problem?

$ mkdir test
$ cd test
~/test$ hg init
~/test$ echo 1 > fubar
~/test$ hg add fubar
~/test$ hg commit -m init
~/test$ cat > .hg/hgrc << EOF
> [paths]
> default = ../test2
> EOF
~/test$ hg clone . ../test2
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
~/test$ hg topic test-topic
marked working directory as topic: test-topic
~/test$ code -n fubar 

Now edit the file in VSCode, commit (using vscode-hg). So far no problem. Try to push with vscode-hg: get the complaint.

Just confirmed: this is fixed by #37 :)

The reason this happened is because 'hg log -r head()' (which was using for detecting multiple heads) returns two heads: the topic branch head, and the public head.

We now use 'hg log -r heads(all())' instead of 'hg log -r head()'