hg update over ssh not working (hg clone works well...) - mercurial

I have some code on bitbucket.org under mercurial version control. Now I want to download the code on my ubuntu machine over ssh. When I use hg clone everything works well. However hg update never updates any files. I'm not even asked for my ssh password. I checked these setting:
ssh -v hg#bitbucket.org
-> looks ok.
hg showconfig
-> path.default = ssh://hg#bitbucket.org/user/myrepo...
Do you have any idea what else to check?
Thanks.

hg update doesn't contact the remote repo, it pulls changes into the working directory from your local repository. That's why you are not being asked for your bitbucket password. Use hg pull to get the changes from the remote repo into your local repo, then hg update, or just use hg pull -u to do both at once.

Related

Mercurial - compare local and remote repositories?

In Git, there is the command
git remote show <remote>
When properly configured, this will show you the status of the remote compared to your local repository, including whether there are pending changes in either. I can't find a similar command in Mercurial. Am I missing something or does it just not exist?
Perhaps hg summary --remote?
To compare local and remote repositories follow these steps:
go to local repo folder (use cd path_to_local_repo)
run "hg outgoing -p path_to_remote_repo" (without quotes)
See GenerateDiffBetweenRepositories

how to setup a local repo of mercurial

here is the complete scenario:
Main repository: http://10.0.1.8:8000/ptest
I clone it at host 10.1.0.115, in the folder /LOCAL-REPO
Then, publish it using the command hg serve -p 9900 -d --webdir-conf hgwebconfig with the hgwebconfig file having
[paths]
ptest = /LOCAL_REPO/ptest
[web]
style = gitweb
now, on the same host 10.0.1.115, i create a seperate folder /QA and do:
hg clone http://10.0.1.115:9900/ptest
and get all the files, now i want to make changes and push them to the repo on
http://10.0.1.115:9900/ptest using the command
hg push ssh://10.0.1.115//??/ptest
I don't know what the correct value would be for ??. So the questions are:
How do i setup a user/password to push changes to this repo on 10.0.1.115?
what is the corect syntax in this case?
When I try to push the changes I get error:
hg push ssh://user#10.0.1.115/ptest
user#10.0.1.115's password:
remote: abort: There is no Mercurial repository here (.hg not found)!
abort: no suitable response from remote hg!
Do you really need to push via ssh:// when you pulled via http:// ?
After hg clone http://10.0.1.115:9900/ptest clone you should be able to push it via http as well, like hg push http://10.0.1.115:9900/ptest
But if you really need to push via ssh here it is: you must have your repository accessible under local account, e.g. if user is hg and it's homedir is /home/hg and you will have your repo in /home/hg/repository directory then you will be able to access it via command:
hg push ssh://hg#10.0.1.115/repository/
User/password will be same as to ssh onto user hg.

Review Board extension for mercurial not working on a Windows machine

I have installed mercurial and review board extension for mercurial on my Windows XP machine. In review board, I have added a repository say "MyRepo" which is on a central server.
I cloned "MyRepo" to my local machine, modified a file for testing and committed to my local repo. I haven't yet pushed it to my central repo.
Now I run "hg postreview" on my cloned local repo. I select "MyRepo" when postreview asks me to choose a repo.
I get a "File not found (207)" error after the command completion. Howver, my review request is uploaded to Review Board server but the diff file is not. Can you tell me what am I doing wrong or is there a patch or command I am not aware of?
I am a novice in DVCS and mercurial, so any help on this matter is really appreciated.
It sounds like you already pushed changes or did more than one commit to the clone (that diffs now more than one commit). Try this and refer to the changeset you created the clone from:
hg postreview -l -o --parent={changeset}
If you wan’t to submit further editings refer to the rewiewid and changeset your first postreview command submitted:
hg postreview -e {reviewid} -o --parent={changeset}

How to clone repository to a remote server/repository with Mercurial

Found myself quite confused today about this.
I create a blank repository locally(hg init), cloned it to working copy, added some code, commited and pushed it(to local repo obviously).
Now I need to share that repository with others. There is a server that has mercurial on it, how do I clone my repository to a remote one such that other developers can access it and pull/push code from/to it?
You'll want to check out the publishing repositories wiki page to get into web interfaces and access controls, but at it's most basic you can do something like this:
hg clone yourlocalrepo ssh://you#server//home/you/repo
That clones your local repo to a remote location of your choosing. Note that there are two double slashes in that URL.
You can't create a remote repo like that using http://, only ssh://. If all you have is http to hgweb.cgi you can 'hg init' an empty repo on the server and then hg push to it.
If your "official" repositories are served up by an HTTP server, and you want to create a repo in the central location based on a local machine's repo, here's one way. You need admin rights on the central server to do this.
e.g. I'm developing on windows, and my central repository is running on linux and served by lighttpd per the official guide. The server's central repo directory is /var/hg/repos/, owned by the user/group www-data. My local machine's IP is 10.1.10.100, and the repository I want to clone is named foo.
On the local machine, open a command prompt into the repository directory and type hg serve. This runs the local hg web server, which will allow the server to pull from it.
ssh into the central repo server, logging in as a user with sudo rights to www-data.
cd /var/hg/repos
sudo -u www-data hg clone http://10.1.10.100 foo
For those that come later and don't want to bother about the hassles of ssh for pushing changes to a server built to host repos, you can just init on the server, and then push as you do every other repo.
# on server:
cd repos/
mkdir myrepo
cd myrepo
hg init
cd ..
chown -R apache:apache myrepo
cd ..
vim hgweb.config
# change [paths]
[paths]
myrepo = /path/to/myrepo
# on your machine
# make sure you've configured hgrc correctly
[paths]
default = http://server/hg/repos/myrepo
hg push
# ???
# profit

Can not clone mercurial (hg) repository via http

I can't clone my repository via http:
abort: 'http://MYREPO' does not appear to be an hg repository!
Firstly, I created a new repo by hg init MYREPO followed by adding some file and commit.
The dir with my repo is password protected but there is no sign of problem because of it, I tried both methods of cloning:
(on my local machine)
hg clone http://MYREPO my_repo
and
hg clone http://user:password#MYREPO my_repo
Permissions of repo dir are: drwxrwxr-x
I can clone this very repository on my remote machine (the same repo is on) without any problems.
What could be possibly wrong?
UPDATE:
Looks like you're getting confusing between repository and hostname
If running "hg serve", "hg clone http://USER#HOST:8000" where host can be you machine's IP or the hostname (type "hostname" on linux or try "ping localhost"). You can change the default port from 8000 by passing a --port #### to hg serve.
If you want to do it over ssh, "hg clone ssh://USER#HOST//PATH/TO/YOUR/REPOSITORY". Suppose you made an repository in your home directory called MYREPO then you would do this: "hg clone ssh://USER#HOST/~/MYREPO"
You can only clone your repo via http is something is serving that repo over http. Mercurial provides a built in http server for you. Run "hg serve" while inside of your repo then attempt to clone it from another location (or another command shell). If you just want a local clone, you don't need to use http ("hg clone ").
Also, try "hg help clone" and "hg help serve" for details.
weirdly, cloning with ssh requires a non-intuitive extra forward slash.
this works for me on a host with ssh running on port 43211
hg clone ssh://example.com:43211//repos/myRepo ./myRepo
the double slash after the port number works, but a single slash there results in the ".hg not found" error
besszero is right, but why don't you clone using SSH if you are gonna use username and password anyway?
hg clone ssh://machine_ip//your/repo/location your_repo
It's also safer if you don't want to open another port for mercurial's http server and you don't need the hgweb features, the traffic is also encrypted. The only con is that you have to log in to checkout, but HTTP doesn't work for pushing back the changes, at least not in my experience.
Argh... One need to be careful with .htaccess configuration. In my case I needed to add 'hgwebdir.cgi' to the path to clone... Thanks for the answers though!
SSH seems logical but somehow I couldn't use it with user other than my local:
hg clone ssh://MY_REMOTE_USER#MYREPO
remote: abort: There is no Mercurial repository here (.hg not found)!