4

My repository can't merge, can't pull and can't do update just because it can't simply close unwanted heads that were mistakes. It seems I've got changes in hg that complicates merging. I expect the changes (heads) to be rather irrelevant and I want to enable just one head and just one branch.

$ hg merge
branch 'default' has 4 heads    
$ hg merge -r e571b17295e9
outstanding uncommitted changes (use 'hg status' to list changes)
$ hg commit -m ''
nothing changed

Did I forget hg push or hg pull somewhere? If nothing changed, why does it say outstanding uncommitted changes? This is my latest output from hg head. How do I find out more about what these changes were? Why is it nearly impossible to do something as simple as getting rid of one of the heads? I'm not curious how hg defines a changeset, a revision, a head, a branch etc, I just want the simple actions to be simple.

$ hg head
ändring:     233:88de4be7943c
märke:       tip
användare:   niklasro
datum:       Mon Sep 05 18:30:37 2011 +0000
kortfattat:  addremove

ändring:     176:e571b17295e9
användare:   tekniklas
datum:       Sat Jan 08 04:45:07 2011 +0000
kortfattat:  twitter support added

ändring:     159:f8d974793b12
förälder:    157:ef1d955b9236
användare:   tekniklas
datum:       Sat Dec 18 17:05:45 2010 +0000
kortfattat:  remove

ändring:     89:008a2ac46b4f
användare:   tekniklas
datum:       Sun Aug 01 07:10:40 2010 +0000
kortfattat:  classifiedsmarket/market/market_ad_preview.html

I don't fully understand how to use mercurial and I want more control e.g. see what happened these dates when there were several so-called heads. I'm mostly the sole developer on this repository but want ability to update it from many locations. I asked before about these changes and I can't seem to figure out how to do a hg pull to sync from repository to local. I can do a hg clone and add changes but the listed changes above means that I forgot to sync something and I want to make it easier to

abort: unsynced remote changes?

How to see a mercurial difference

How to get rid of older mercurial heads?

Now hg diff, hg status and hg incoming don't display any changes and I've managed to clean the repository (which is on googlecode.com) and even update files via the web ui googlecode.com has so I want to make it easier to sync between repository and local.

Thanks for any advice

Edit: I can see that the changeset 176:e571b17295e9 is not important and I just want to merge it with the tip with no actual change but getting 1 head.

enter image description here

So I try and I get that the changeset is irrevelavant and I don't care about this change:

$ hg diff -c e571b17295e9
diff -r f50d4c4461e5 -r e571b17295e9 classifiedsmarket/app.yaml
--- a/classifiedsmarket/app.yaml    Thu Jan 06 11:36:10 2011 +0000
+++ b/classifiedsmarket/app.yaml    Sat Jan 08 04:45:07 2011 +0000
@@ -4,6 +4,10 @@
 api_version: 1
 default_expiration: "400d 5h"
 handlers:
+- url: /twitter
+  script: /twitter_oauth_handler.py
+- url: /oauth.*
+  script: /twitter_oauth_handler.py
 - url: /
   script: i18n.py
 - url: /li

So why do I need so much administation about changesets that do not matter at all?

So now I try this other way which also fails. Great. Choose mercurial and you won't be able to do development since all you do is try to lose some garbage:

hg update -r 123
hg commit --close-branch -m 'Closing old branch'
hg update -C default

My try:

$ hg update -r e571b17295e9
avbryter: crosses branches (merge branches or use --clean to discard changes)

Great, nothing works and what I'm trying to do is really simple. I try some more to really understand that it's impossible to do something really simple and how we lose time trying to do the most basic thing and how Mercurial can't do something simple:

$ hg head
ändring:     235:68bc6873fafb
märke:       tip
användare:   niklasro
datum:       Tue Sep 06 11:53:32 2011 +0000
kortfattat:  added fblist

ändring:     176:e571b17295e9
användare:   tekniklas
datum:       Sat Jan 08 04:45:07 2011 +0000
kortfattat:  twitter support added

ändring:     159:f8d974793b12
förälder:    157:ef1d955b9236
användare:   tekniklas
datum:       Sat Dec 18 17:05:45 2010 +0000
kortfattat:  remove

ändring:     89:008a2ac46b4f
användare:   tekniklas
datum:       Sun Aug 01 07:10:40 2010 +0000
kortfattat:  classifiedsmarket/market/market_ad_preview.html

$ hg merge -r e571b17295e9
avbryter: outstanding uncommitted changes (use 'hg status' to list changes)

So I try another way just to make clear how VCS completely stops me from being able to do development and these stupid revisions instead that won't work not even when it's really simple you're trying to do:

$ hg update -r e571b17295e9
avbryter: crosses branches (merge branches or use --clean to discard changes)

I ended creating a new local directory for each revision I wanted to close, cloned the revision, closed it, committed and pushed from the local clone and it seems to have worked but did I do this the right way? It seems I can still "open" the closed heads which is good but I didn't try yet to sync with other people's changes and I didn't try to do a change via the webui in googlecode.com and pull / merge with local clone.

So I closed uncommitted(?) changesets to mercurial by cloning 3 revisions and close them one by one instead of just hg head -r -close or some simple gear to hg that can handle uncommitted changesets.

It looks resolved now and I can view what the multiple heads were:

o  changeset:   181:bb0545ceff33
|  parent:      179:b03d10fc4260
|  user:        tekniklas
|  date:        Sun Jan 09 04:39:33 2011 +0000
|  summary:     twitter support
|
| o  changeset:   180:9bbefafbdb16
| |  parent:      178:e571b17295e9
| |  user:        niklasro
| |  date:        Tue Sep 06 14:09:19 2011 +0000
| |  summary:     close badbranch, this approach never worked
| |
o |  changeset:   179:b03d10fc4260
| |  parent:      177:f50d4c4461e5
| |  user:        tekniklas
| |  date:        Sun Jan 09 04:32:12 2011 +0000
| |  summary:     removed aeoid
| |
| o  changeset:   178:e571b17295e9
|/   user:        tekniklas
|    date:        Sat Jan 08 04:45:07 2011 +0000
|    summary:     twitter support added
|
o  changeset:   177:f50d4c4461e5
|  user:        tekniklas
|  date:        Thu Jan 06 11:36:10 2011 +0000
|  summary:     i18n reports

...

o  changeset:   163:aa078cbdbbe5
|  parent:      161:51ec76c45cf0
|  user:        tekniklas
|  date:        Sat Dec 18 19:20:25 2010 +0000
|  summary:     fb login
|
| o  changeset:   162:37951de836dc
| |  parent:      160:f8d974793b12
| |  user:        niklasro
| |  date:        Tue Sep 06 14:17:18 2011 +0000
| |  summary:     close badbranch, this approach never worked
| |
o |  changeset:   161:51ec76c45cf0
| |  parent:      159:652958f895e2
| |  user:        tekniklas
| |  date:        Sat Dec 18 19:19:41 2010 +0000
| |  summary:     fb login
| |
| o  changeset:   160:f8d974793b12
| |  parent:      158:ef1d955b9236
| |  user:        tekniklas
| |  date:        Sat Dec 18 17:05:45 2010 +0000
| |  summary:     remove
| |
o |  changeset:   159:652958f895e2
| |  parent:      157:9658adb05792
| |  user:        tekniklas
| |  date:        Sat Dec 18 19:19:17 2010 +0000
| |  summary:     fb login
| |
| o  changeset:   158:ef1d955b9236
|/   user:        tekniklas
|    date:        Sat Dec 18 17:05:00 2010 +0000
|    summary:     removed
|
o  changeset:   157:9658adb05792
|  user:        tekniklas
|  date:        Fri Dec 17 21:57:36 2010 +0000
|  summary:     tabs

...

o  changeset:   92:9e48ce2a444e
|  parent:      90:a381c59aedc1
|  user:        ubuntu@ubuntu
|  date:        Mon Aug 02 04:30:31 2010 +0000
|  summary:     coordinates
|
| o  changeset:   91:84facd40c690
| |  parent:      89:008a2ac46b4f
| |  user:        niklasro
| |  date:        Tue Sep 06 14:18:58 2011 +0000
| |  summary:     close badbranch, this approach never worked
| |
o |  changeset:   90:a381c59aedc1
| |  parent:      88:cfcd7313278d
| |  user:        ubuntu@ubuntu
| |  date:        Mon Aug 02 04:30:16 2010 +0000
| |  summary:     logo
| |
| o  changeset:   89:008a2ac46b4f
|/   user:        tekniklas
|    date:        Sun Aug 01 07:10:40 2010 +0000
|    summary:     classifiedsmarket/market/market_ad_preview.html
|
o  changeset:   88:cfcd7313278d
|  user:        ubuntu@ubuntu
|  date:        Sun Aug 01 05:58:50 2010 +0000
|  summary:     previewform

...

Community
  • 1
  • 1
Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424
  • 1
    The fact that merge says "outstanding changes" and that there's nothing to commit sounds a bit odd. (what does hg status list if you get that error? If you clone the entire repo, can you merge there and then push the merges back?) However, the amount of help you seek (& need) seems to indicate that you will probably receive better help in a chat or on the mercurial mail list than here on SO proper. (You're not asking a simple, answerable question, at least not anymore, sinceyou've amended quite a bit since the start.) – Macke Sep 06 '11 at 19:10
  • Thanks for the comment. I'm glad I no longer have "multiple heads" and I read it makes sense for bugfixes / going back and in my case the changesets were mistakes with trivial changes that were committed anyway with later changesets so I'd like to have a program like `hg heads -remove -r` to just behead the changes. Now I want to see if I can change in the googlecode.com web ui a file and sync it with many clones since this week I'm getting contributions to the repository. – Niklas Rosencrantz Sep 06 '11 at 19:15

2 Answers2

2

You can run

hg diff -c R

to see what you changed in changeset R. You can also use a log viewer like TortoiseHg se see that and to see where the changesets appear in the changeset graph.

The basic work cycle is

# work
hg commit
# work
hg commit
hg push
# aborts: multiple remote heads
hg pull
# hg heads show two heads
hg merge
hg commit
hg push
Martin Geisler
  • 72,968
  • 25
  • 171
  • 229
2

Take a look at the revision graph, and it shall be clearer to you:

This can be done via:

  • hg serve and open webbrowser to http://localhost:8000
  • hg glog if you've enabled the graph log extension (use -l 20 to se latest 20 commits only)
  • Use TortoiseHg, if available on your OS.

It will looks something like this:

 TortoiseHg revision log view

In order to combine the changes in these heads, you need to merge them. See 68040 above, which combines two heads into one. This is necessary if you have commits coming in from several locations simultaneously.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Macke
  • 24,812
  • 7
  • 82
  • 118
  • I looked at a changeset of one of the multiple heads and it's only 2 lines changed and it doesn't matter. I just want to forget that change and go on with development instead of this counterintuitive management where it's impossible to do something simple. Why is it so difficult with mercurial to do something really simple i.e. remove, delete, forget about a change? – Niklas Rosencrantz Sep 06 '11 at 12:19
  • I can't merge since it says there are 4 heads so I'm back where I started with 4 heads and nothing is possible. – Niklas Rosencrantz Sep 06 '11 at 12:53
  • @Niklas: If there are only 2 heads, and you have checked out one, Mercurial will automatically merge with "the other". In other cases, you need to specify which revision to merge with. (With TortoiseHg, you can merge and chose to discard the "other" branch from the GUI. This makes it easy to record that a certain change doesn't matter). (Also, may I suggest to calm down, relax a bit and try to read some Mercurial FAQs for common operations, so you learn how and why things are done with Mercurial.) – Macke Sep 06 '11 at 19:01
  • Thanks. I could close the 3 unwanted heads by cloning to that revision and closing the branch. I pasted the output from `hg glog` and it seems these changesets that branched were unimportant and the good changes of those changesets were included anyway. I just tried to make a small change from the web ui googlecode.com has and now I can do `hg pull` and `hg update` after being rather confused what is meant with heads, branches, revisions, changesets, clones, co:s, pulls, updates, merges, and pushes. I wan nervous about doing merge and this way I didn't have to merge and the branch can reopen. – Niklas Rosencrantz Sep 07 '11 at 05:42