Get logs for repo remotely - mercurial

Is there a way to get logs for a mercurial repo like so:
hg log -v "http://some/remote/repository"
instead of
hg log -v "C:\Users\Repo"

Mercurial does not support that operation. You firstly have to clone the repository.
See more here

If you have an http-served mercurial repository (which you seem to) you can get the log by going to http://some/remote/repository in your web browser. You can also start a web server on any repo by issuing the hg serve command. By default, this will start a web server on port 8000 and you can view it by going to http://repothost:8000/ or, if local, http://localhost:8000/.

Related

Hgweb and changegroup hook not working

I'm using hgweb to publish my local repositories.
/project_path/project_name/.hg/.hgrc have:
[hooks]
changegroup.bitbucket = hg push ssh://hg#bitbucket.org/user/repo
When i'm use hg serve, all changegroup hooks working fine, but when i'm using hgweb through nginx with fcgi it's not working at all. I need those functionality to have some kind of backups.
It's mostly like Trust.
Mercurial needs to trust a hgrc file before it will parse/run it. If your /project_path/project_name/.hg/.hgrc file is owned by you then when you run hg serve with Mercurial running as you it's parsed/used. However, nginx runs as its own user, probably nginx which doesn't trust files owned by you, so when it invokes Mercurial those files are ignored (see Note).
That Mercurial trust link gives a better explanation and talks about how to say "nginx trusts X", but if it's a single-user system or you want everyone to trust you you can just throw a trust block in the system-global /etc/mercurial/hgrc file saying everyone trusts X.
Note: It doesn't actually just ignore those files it puts a warning on STDERR which in apache-land you'd find in your error.log, but in nginx land no one ever seems to find those warnings so I've no idea where nginx puts them.
I assume you have some kind of authentication issue here. When running hg serve from the command line, your ssh credentials are provided by an ssh-agent running in the background.
However, this does not work when running hgweb as a service, because there is no ssh-agent running in the background. If you would start an ssh-agent, there would be no possibility to enter the password for your ssh key.
Bitbucket uses ssh keys to authenticate you, so you can't just add your password to the above hg push command.
One possible solution would be to not use bitbucket as your backup, but a different mercurial server that let's you provide a simple password on the command line.
I'm afraid I can't help you further with this.

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

Using Mercurial, how to see History and Log on other Repos

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.

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}

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)!