Mercurial - Part 2

These notes are in continuation with Mercurial Notes - Part 1. This part puts forth
1) Various issues that might arrive during the journey... not only initially but also when one finds oneself at home with Mercurial

Purpose - Describe the experienced issues and ways out

Issues

"hg update" throws abort: not a linear update

April 09 and 10, 2014

For a few weeks I had not used mercurial myself to commit the changes. I used to send it to Alex and he used commit. On April 09, 2014 we decided this time I will do that myself.

So April 09, 2014 - whole night took me to "hg pull". That reveals: neither did I push nor did I pull for long! Everything went great. Now, as we know "hg pull" does not pull the working directory, one has to execute "hg update" to have the working directory pulled in correctly. So I did

(path to fabacademy)/academy.2014$ sudo hg update


In response got the following message -

abort: not a linear update
(merge or update --check to force update)

A thorough search on google did not show up anything concrete except that A few results on patches containing this string and a few forums.

Then a few readings took me to "hg update null". However, I was afraid to do this. Then it was "hg update --clean". This too I was afraid of to execute.

At some point in time I remembered something about "hg update to a specific version". The mercurial help showed me the way

hg update tip

This resolved the problem to some extent. I noticed, the folder "amitraj.deshmukh" I used to have in my local version was automatically deleted and "deshmukh.amitraj" appeared with the latest version available on the central repository. I am wondering how this could happen, as I remember I had pushed twice earlier, while I having "amitraj.deshmukh" (and not "deshmukh.amitraj").

However, there is a hint - I also remember, I used to wonder earlier how my index.html page in inside "deshmukh.amitraj" on the central repository while locally it is different! Back then, I kept it parked. It is perhaps falling in line now.

So, making "hg update tip" resolved the situation and I could update the working directory. However, when I cross checked with

hg outgoing

I could see an old commit that I had made but not pushed. This was a new point!

I'm thinking it is perhaps comfirtable now to remain on the same page as the central repository, for a fresh start and then take up from that point. So, with the qustion "how to cancel any chamges", I came across "hg strip" as a hint.

Functionality called as "hg strip" has been provided by Mercurial extension named as "mq". To enable the extension one has to edit the hgrc file in .hg folder in academy.2014:

sudo kate hgrc

and add following:

[extensions]
mq=

Linkt to: Extension mq

Now, I executed

hg strip 'roots(outgoing())'

Mercurial took some time - around 5 mins - to come back with a response.

Post this action I executed again

sudo hg outgoing

to see -

comparing with ssh://hg@fabacademy.org/academy.2014
searching for changes
no changes found

This resolved everything!! Again to ensure everything I executed:

hg strip 'roots(outgoing())'

to see -

abort: empty revision set

"abort" is a difficult situation usually. So I am not sure if this is okay. In generral it is logical to comapre the local and remote repositories. So I executed:

sudo hg summary --remote

to see

parent: 1642:777bdba6a728 tip
week10 updated
branch: default
commit: (clean)
update: (current)
remote: (synced)

The last three lines confirm that the local repository is same as remote.

Now, moving on to commit and push....

"hg outgoing" throws The authenticity of host 'fabacademy.org (91.126.132.8)' can't be established.

Resolution:

edit ./hg/hgrc and add write the following to it.
[ui]
username = First Last < user@machine.domain >
ssh = ssh -p 846 -i ~/.ssh/keys/academy -C

[hooks]
changegroup = hg update >&2

<..to add 'why'..>