abort: unsynced remote changes? - mercurial

I got a warning like this
abort: unsynced remote changes!
How do I
1) See what's the difference? hg diff? hg status?
2) Harmonize the code?
Thanks in advance. Here's what I got running hg inspecting the heads
$ hg heads
ändring: 192:e571b17295e9
märke: tip
förälder: 175:f50d4c4461e5
användare: tekniklas
datum: Sat Jan 08 04:45:07 2011 +0000
kortfattat: twitter support added
ändring: 191:9e419ce3e7e1
användare: tekniklas
datum: Wed Mar 09 12:56:27 2011 +0000
kortfattat: adsense maps
ä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
ubuntu#ubuntu:/media/Lexar/montao$

You have to pull latest changes before pushing:
hg pull
To view differences before pull:
hg in
After pull you have to merge changes you've pulled with the changes you're trying to push:
hg merge
After merge you'll have to commit your merge:
hg commit
And finally push without errors:
hg push

Just do a
hg incoming
You will see the list of changes that are available in the remote side

Related

Modify the Commit Message of a Pushed Commit. (Mercurial) [duplicate]

This question already has answers here:
How to edit incorrect commit message in Mercurial? [duplicate]
(12 answers)
Closed 9 years ago.
I created a dummy repository on bitbucket to try to learn how to do this. I've seen this done in Git, but I am unsure if this is possible in Hg.
I have the following hg log:
changeset: 3:742dd9f71f46
tag: tip
user: RHsu
date: Tue Apr 09 09:58:55 2013 -0400
summary: added some text to 3
changeset: 2:dd431695edcd
user: RHsu
date: Tue Apr 09 09:58:30 2013 -0400
summary: Let's try to amend this commit
changeset: 1:b59ed9c945f9
user: RHsu
date: Tue Apr 09 09:58:15 2013 -0400
summary: added some text to t1
changeset: 0:a8a24f3831ab
user: RHsu
date: Tue Apr 09 09:52:32 2013 -0400
summary: Add text files for testing
These changesets have been pushed to bitbucket. How can I ammend the commit message of changeset2?
EDIT: I have tried using histedit, but that only changes local commits. Then when I push, two heads are created.
EDIT: Different from the other question since this question deals with editing a commit that has been pushed onto bitbucket.
Bitbucket has a strip function that can be use to strip a changeset from the repository. That's what you have to use in order to get rid of the head you don't want. You get to it at https://bitbucket.org/<user>/<repo>/admin/strip. You can also click on the little gear icon when looking at your repo on the web page and then it will show you the admin interface which has a section for stripping changesets.

Why does MacHg tell me it's pushing hundreds of thousands of changesets when my project only had a few revisions?

Can anybody explain to me what's going on here? Are there two kinds of 'changesets' in Hg?
I have a big project with a lot of big files, and it was getting sluggish, so I deleted the .Hg folder and started over with a new repo in bitbucket. Or so I thought.
This particular Push should only have 200K or so of added/changed files, so not only do I not know why it's reporting so many changesets being pushed but I also don't know why it's taking so long. (At this rate it'll take an hour.)
When it finally did finish, it said it had pushed 2 changesets in the dialog.
Here's hg log, fwiw:
changeset: 3:e21eca3496ea
tag: tip
user: Jamie Fristrom <***#gmail.com>
date: Fri Nov 23 12:58:21 2012 -0800
summary: Project settings, fixed duplicate buildings, reshadow
changeset: 2:9ecb5aab03c2
user: Jamie Fristrom <***#gmail.com>
date: Thu Nov 22 21:59:09 2012 -0800
summary: Fresh new repo
changeset: 1:5b95e18a6377
user: Jamie Fristrom <***#gmail.com>
date: Tue Nov 20 17:20:02 2012 -0800
summary: Fresh new repo
changeset: 0:e2ad59f1136e
user: Jamie Fristrom <***#gmail.com>
date: Tue Nov 20 17:03:36 2012 -0800
summary: initialize repository
Could this have something to do with the way BitBucket works? I have a bunch of repos in BitBucket.

Should I run hg revert?

I'm running hg 1.7.5 and I had a similar problem earlier on the mercurial mailing list and we could solve it by running hg revert -a. Now I did run hg revert and it didn't solve the problem. I had problems with my filesystems and I had to interrupt a transaction now when I ran `hg commit' I get a new head
$ hg commit -m 'changes'
skapade ett nytt huvud
ubuntu#ubuntu:/media/Lexar/montao/montaoproject$
The localized message means hg created a new head. hg diff shows nothing. Could you say what I can do?
$ hg heads
ändring: 322:d74d7e14fe44
märke: tip
förälder: -1:000000000000
användare: niklasro
datum: Fri Dec 02 02:22:31 2011 +0000
kortfattat: changes
ändring: 321:470a570041e0
användare: niklasro
datum: Sat Nov 26 22:38:16 2011 +0000
kortfattat: bug fixes for insert
ubuntu#ubuntu:/media/Lexar/montao/montaoproject$
Update
I had to do a merge which it could do, then I could commit and push so now there is only one head like it should be:
$ hg heads
ändring: 324:eccc83b75b58
märke: tip
förälder: 323:5842204042f5
förälder: 322:d74d7e14fe44
användare: niklasro
datum: Fri Dec 02 09:01:35 2011 +0000
kortfattat: changes
ubuntu#ubuntu:/media/Lexar/montao/montaoproject$
If you want to keep your recent changes, try this:
Copy the whole working folder to some other place
run hg update -r 321 --clean
Copy the working folder backup back (do not copy .hg folder from the backup)
run hg commit -m 'changes'
If you don't need your changes, you may just update to the rev 321 and then strip rev 322 using patch queue. I'm not used to work with hg in console, so I'll write how to do this in TortoiseHg.
First, enable the 'mq' extension:
Open 'HG Workbench'
Go to 'File->Settings'
Select 'Extensions' from the list of features
Check 'mq'
Save changes
Close 'HG Workbench'
Strip revision:
Open 'HG Workbench'
Select rev 322
right-click on it
select 'Modify history'->'Strip'
click 'Strip'

Delete multiple heads

C:\Users\Itu\workspace\Compiler>hg branches
default 13:aa6af82c5458
C:\Users\Itu\workspace\Compiler>hg heads
changeset: 13:aa6af82c5458
tag: tip
user: Itun
date: Sun Sep 18 22:27:06 2011 +0400
summary: Update 1.0.0.2
changeset: 9:d36e5ac454b1
parent: -1:000000000000
user: Itu
date: Sun Sep 18 06:50:25 2011 +0400
summary: New PR
changeset: 8:758cd394d82a
user: Itun
date: Sun Sep 18 06:48:17 2011 +0400
summary: asdasd
changeset: 4:c4c981b4ff43
user: Itun
date: Sun Sep 18 03:31:58 2011 +0400
summary: Update
C:\Users\Itu\workspace\Compiler>hg merge
abort: branch 'default' has 4 heads - please merge with an explicit rev
(run 'hg heads .' to see heads)
How you can see I have the one branch and 4 heads.
When I try to pull in my eclipse mercurial plugin, it returns me message about multiple heads and offers me to rebase or merge. Then I did not understand anything and closed it.
I think I need something to delete this heads. It would be great if somebody could explain me this and show how to do this in the eclipse plugin, but other help is appreciated.
The safest way to remove the extra heads is to make a new clone, grabbing just the head you want with -r:
cd C:\Users\Itu\workspace
mv Compiler Compiler-backup
hg clone -r aa6af82c5458 Compiler-backup Compiler
This will move just aa6af82c5458 and its ancestors to the new clone, leaving the old heads in Compiler-backup. You can always hg pull them over later, or just delete the backup (losing your data).
Mercurial has an entire wiki page devoted to the topic of multiple heads.
I highly suggest reading it before proceeding on your apparent course of action.
The folks at Fog Creek have provided some friendlier material.
You might consider working with them, since it sounds like you might need some support.

Problem of hg clone src#tag dest

I have a repository named master which keeps product releases. It has several tags (such as 1.0,2.0,3.0) as baseline. When I want to create hot fix for one version, for example 1.0. I use command as following:
hg clone master#1.0 hotfix_1.0.1
cd hotfix_1.0.1
hg tip
changeset: 14:b2492c2611a1
tag: tip
user: codingboy <codingboy#gmail.com>
date: Thu Dec 09 14:03:23 2010 +0800
summary: fix bug4
I find tip version is what I need, but is not tagged with 1.0. It will cause my changes in hotfix_1.0.1 can not be push to master. the error is
(abort) unknown 1.0 revision.
I check master repository. the log shows below
changeset: 15:3497c46cbc7f
tag: tip
user: codingboy <codingboy#gmail.com>
date: Thu Dec 09 14:03:27 2010 +0800
summary: Added tag 1.0 for changeset b2492c2611a1
changeset: 14:b2492c2611a1
tag: 1.0
user: codingboy <codingboy#gmail.com>
date: Thu Dec 09 14:03:23 2010 +0800
summary: fix bug4
so it seems cloned repository lost changset#15. My understanding is hg clone src#tag dest should clone tag which I need. But this operation can not clone child of changeset#14 which is do tagging. So what I have done is to use command
hg clone master hotfix_1.0.1 -u 1.0
I do not like this command. if master repository is huge and I just want to fix old version, It will waste time to clone and push changes.
Do I have any other approach to clone one repository from one baseline or tag correctly?
thanks...
Due to the design of Mercurial tags, the tagged revision does not contain that tag. In other words, 1.0 doesn't "know" it's 1.0.
Mercurial recommends the solution you give at the end. A possible mitigation for the performance issues is to keep (pulling as needed) a single clone of master that you don't modify. Then, (as needed) clone that locally and update to the desired version. The clone will (assuming same volume and a modern filesystem) use hard links, minimizing the required copying.