TAKE NOTE: If you try to push and Mercurial mentions:
- multiple branches
- multiple heads
- outstanding uncommitted changes
-archive has diverged
-or any other similar message
and then asks if you want to push anyway..
DON'T DO IT! This creates multiple heads.
After you give Mercurial a command, look at the output, read all the messages and respond to them.
These notes should help with some common problems we have all been having.
|General Command Meanings:|
|pull||pulls down current state of the archive (brings changes)|
|merge||remote hg directory has new changes, if your local copy is an older version, merge reconciles them.|
|commit||stores a "snapshot" of your copy of the archive|
|push||sends changes back to central server we are all using (MIT copy)|
|update||takes the changes and puts them in the working copy of the directory|
hg add hg commit -m "your commit message here" hg pull- if you get new stuff (files added) when / after pulling and Mercurial tells you that you need to merge.
- You will need to tell Mercurial to "record a delete for missing files"
- You will run into problems if you don't do this!
- error depicted here:
hg add hg rm -A
- You will get a very long listing both of removed files and files that Mercurial says "still exist and will not be removed".
[many files listed above as "not removing"............]
not removing Web/videos/video/module_02.html: file still exists (use -f to force removal)
removing Web/labs/providence/anna_kaziunas_france/resources/html_workshop/ HTML_Basics_2.0.odp
--> do not force remove anything
- This is what should happen.
- Mecural is updating.
hg commit -m "your commit message here" hg pull
You try to push and get:
"archive has diverged" message
"abort: push creates new remote heads on branch 'default'!"
"abort: crosses branches"
something similar to the above messages
- You need to Pull and Merge. DO NOT FORCE PUSH.
- First, pull to make sure you have an up to date copy of the archive.
hg pull- if you try to push and get: "abort: outstanding uncommitted changes (use 'hg status' to list changes)"
hg commit -m "your commit message here"- You should check status:
- if you have a "!" in front front of a file or directory name in the status listing, it means you deleted a file that Mercurial is tracking.
! Web/labs/providence/AnnaKaziunasFrance/resources/html_workshop/ HTML_Basics_2.0.odp
! Web/labs/providence/AnnaKaziunasFrance/resources/html_workshop/ HTML_Basics_2.0.pdf
- To fix this --> do the following:
hg add- tell Mercurial to record a delete for missing files
hg rm -A hg commit -m "your commit message here" hg pull
- if you get a message about "multiple heads" --> see next topic below.
$ hg pull
pulling from ssh://firstname.lastname@example.org/academy
searching for changes
adding file changes
added 50 changesets with 162 changes to 113 files (+1 heads)
abort: crosses branches (merge branches or use --check to force update)
warning: changegroup hook exited with status 255
(run 'hg heads' to see heads, 'hg merge' to merge)
- Mercurial will list heads .
$ hg heads
user: username <username@domaincom>
date: Thu Feb 03 13:40:38 2011 +0100
user: Anna Kaziunas France <email@example.com>
date: Thu Feb 03 08:23:21 2011 -0500
summary: created external css for resources page
- To merge with one of these heads (you can have many heads) --> type the number after "changeset:"
- I have shown the number in bold so you can see them more easily.
- For example, to merge with head -->changeset: 480:00cdd8eef593
hg merge 480- If there are multiple heads (more than one listed as the output of hg heads) you wil need to repeat the merge for each head until there is only one left
hg commit -m "commit message" hg push- don''t push if it says you shouldn't - "archive has diverged" - then pull instead.
hg pull hg update hg headsif you can't get all the heads resolved or the error messages - re-clone the archive.
hg init- The rest of the instructions are here
hg commit -m "removed .DSstore file"
remote: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ remote: @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ remote: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Since we the server doesn't match the one you set up last year, you'll have to remove the info about the old one from your known_hosts file. otherwise ssh thinks the ID is wrong and aborts the connection. So open .ssh/known_hosts - remove all the old fingerprints related to the fab academy. From the command line, type: nano .ssh/known_hosts Delete any entries beginning with "fabacademy.org", then try again. You'll be asked to confirm the new fingerprint, which will get saved in the known_hosts file.
Tutorial by Anna Kaziunas France - Fab Academy AS220 Providence, RI - Last Updated January 2014