I am trying to clone a remote repository over VPN connection. It takes forever to clone. Our remote repository exposed as http endpoint. Using Tortoise Hg clone takes forever to complete. Here is the hg command appeared while cloning in tortoise hg.
hg clone --verbose -- httpurlofremoterepository
Size of the repository is less than 3 GB. Using CISCO VPN Any Connect client. Can I make this clone faster?
Related
I have a Mercurial repository on a remote VPS. The VPS has SSH access enabled. What are my options for pushing code changes from my development machine to the remote VPS?
If your VPS has Mercurial installed, simply:
hg push ssh://username#host/path/relative/to/home
or add to the repo's hgrc
[paths]
default-push = ssh://username#host/path/relative/to/home
and just
hg push
how can I reset my local repository, to the state of remote one?
I have commited local changes (didn't push).
I want to delete all the differencies.
There are several options:
Make a new clone of the remote repo and throw away the old clone.
Make a new clone of the local repo, but limit it to the last revision in the remote. (e.g. hg clone -r <last remote changeset> <local_repo_old> <local_repo_new>).
Use the hg strip command from the mq extension to remove the changesets from your local repo
NOTE: When trying options 2 or 3, you can use the hg outgoing command to see which changesets have not yet been pushed to the remote repo.
Let's say the repo I have on my notebook's hard drive is cloned from a remote Repo2 initially, the "all serious" Repo, and then we use Repo1 for tmp storage and code sharing.
So now, what if I do a
hg in ssh://someuser#dev.example.com//code/repo1
and then also on repo2, and see some new changesets on both repos, how do I look at what Peter changed for the 3 files he committed and pushed on Repo1?
And how to do it for Repo2? (on Mac and PC)
What about just looking at the log history?
Is it better that Repo1 and Repo2 both run a process "hg serve" at port 8000 and 8001 for other people to look at history using a web browser?
What if there are no such processes running, then the only way is to ssh to that host and cd to the directory and do hg log and hg diff?
Yes, you must have the repository on your local machine to be able to do hg log and all other commands. Mercurial is a distributed revision control system, and so you are expected to make a local clone before you work with a repository.
Setting up hg serve is a good alternative for when you need to quickly look at the history without cloning it first. But for command line operations, you should make a clone.
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
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)!