Mercurial / hg - abort: outstanding uncommitted merges

47,685

Solution 1

hg update --clean -r tip resolved the problem...

[mpenning@host1 login]$ hg update --clean -r tip
resolving manifests
getting Protocol.py
getting Session.py
getting mp_getconf.py
getting mp_runcmd.py
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
[mpenning@host1 login]$ hg up
resolving manifests
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
[mpenning@host1 login]$

Solution 2

At some point you did:

$ hg pull (or maybe someone pushed to you)
$ hg merge

...and then carried on. This left the merge uncommitted. That's what 'abort: outstanding uncommitted merges' means. You can't do 'x' because there's you haven't finished working on the merge you started.

What you should have done is:

$ hg pull
$ hg merge
  <Sorted out any issues>
$ hg commit -m 'Merged the blah with wibble-wah'

...and then carried on.

hg status and hg summary would have shown there were outstanding changes.

Share:
47,685
Mike Pennington
Author by

Mike Pennington

--&gt;

Updated on July 09, 2022

Comments

  • Mike Pennington
    Mike Pennington almost 2 years

    I have a master repo on host1 and made an update to a repo on host2. I hg pushed the changes from host2 to host1 with

    [mpenning@host2 login]$  hg push ssh://host1//opt/python/login
    

    However, when I try to update or merge, I get

    [mpenning@host1 login]$ hg update
    abort: outstanding uncommitted merges
    [mpenning@host1 login]$ hg merge
    abort: outstanding uncommitted merges
    [mpenning@host1 login]$ 
    

    I also tried a hg pull from host1, but that didn't work either...

    [mpenning@host1 login]$ hg pull ssh://host2//opt/python/login
    running ssh host2 'hg -R /opt/python/login serve --stdio'
    mpenning@host2's password:
    pulling from ssh://host2//opt/python/login
    searching for changes
    no changes found
    [mpenning@host1 login]$ hg merge
    abort: outstanding uncommitted merges
    [mpenning@host1 login]$
    

    What do I need to do to update my master repo on host1 with the changes from host2?


    More information about the repo on host1...

    [mpenning@host1 login]$ hg parents
    changeset:   27:6d530d533997
    user:        Mike Pennington <[email protected]>
    date:        Wed Sep 26 11:44:51 2012 -0500
    files:       mp_getconf.py
    description:
    fix issue where config retrieval was broken
    
    
    changeset:   29:eaf3b5aacfe6
    user:        Mike Pennington <[email protected]>
    date:        Wed Sep 26 11:43:15 2012 -0500
    files:       mp_getconf.py
    description:
    fix artifact of using the script to run generic commands, but this broke config retrieval
    
    
    [mpenning@host1 login]$
    
  • Mike Pennington
    Mike Pennington over 11 years
    Your allegation is that I had outstanding changes... if so, why didn't hg update / hg commit fix that problem? hg commit told me there was nothing to commit
  • Paul S
    Paul S over 11 years
    'hg update' wont do anything when theres outstanding changes unless you give '--clean' to throw the changes away, just as you did in your self-answer. The fact that 'hg parents' gave two parents shows you had a merge outstanding. There was no attempt to commit in your first post.
  • Mike Pennington
    Mike Pennington over 11 years
    There was no commit because it wasn't doing anything; unless you come up with more information than hg commit, I'm afraid this would not have helped
  • Chip McCormick
    Chip McCormick over 11 years
    if you're working on a specific branch, change that to: hg update --clean -r <branchname>
  • Johan Tidén
    Johan Tidén over 9 years
    I just got the same issue. There is nothing in hg status, hg diff or hg out. Still, I cannot update or merge. The accepted answer solved it for me.
  • Paul S
    Paul S over 9 years
    @JohanTidén : An update --clean will solve the issue because it cleans out all outstanding changes, including having multiple parents (i.e. you're doing a merge). I expect what is happening is that people try to do a merge, and then abort it by doing revert -a. revert only undoes the changes to the files, and doesn't break the link to the second parent, leaving you in a state like this (status and diff blank because file changes have been reverted, outgoing blank because no outgoing commits). This can be useful for doing a "null merge", but isn't usually what you want.
  • Csaba Toth
    Csaba Toth almost 9 years
    I haven't done any revert or anything. I just forgot to commit before pull, and now hg is trippin'. This is ridiculous (form hg). If the problem is that I had outstanding commits, why there's nothing to commit now?
  • Csaba Toth
    Csaba Toth almost 9 years
    BTW, I do not want to clean my commits, that would be stupid. But there's nothing to commit.
  • Csaba Toth
    Csaba Toth almost 9 years
    I do not want to loose commits (--clean). Although I don't see them now.
  • Ryan110
    Ryan110 about 5 years
    do not use this untill you have to. this would remove your change
  • Mike Pennington
    Mike Pennington about 5 years
    There’s a simple workaround for loosing the change; make a backup of all files you care about before running the command