4
votes

I am running an archival filesystem on a Windows server that does automatic offsite replication which makes it the ideal place to host Mercurial repositories and be sure of their safety. This filesystem is Windows-only so I have no choice but to use Windows as the host OS.

Setup:

Server ('ungoliant', internal to my network):

  • Windows 7 master repository host machine.
  • Cygwin ssh daemon.
  • hg 1.9.3
  • Created new repository "/cygdrive/j/mercurial/rcstudio" on Windows with "hg init".

Clients:

  • Mac OSX 10.7.4 running hg 2.1.2
  • FreeBSD 8.3 running hg 2.1.2

Problem on Clients (identical on Mac and FreeBSD):

$ hg clone ssh://cjp@ungoliant//cygdrive/j/mercurial/rcstudio
running ssh cjp@ungoliant 'hg -R /cygdrive/j/mercurial/rcstudio serve --stdio'
remote: abort: There is no Mercurial repository here (.hg not found)!
abort: no suitable response from remote hg!

I've confirmed that the path and the URI are correct. There absolutely is an ".hg" directory there:

$ ls -la
total 0
drwxr-xr-x   3 cjp  staff   102 Jun  5 17:41 .
drwxr-xr-x  41 cjp  staff  1394 Jun  5 16:30 ..
$ scp -r cjp@ungoliant:/cygdrive/j/mercurial/rcstudio/.hg .
$ ls -la
total 0
drwxr-xr-x   3 cjp  staff   102 Jun  5 17:41 .
drwxr-xr-x  41 cjp  staff  1394 Jun  5 16:30 ..
drwxr-xr-x   5 cjp  staff   170 Jun  5 17:41 .hg
$ ls -la .hg
total 16
drwxr-xr-x  5 cjp  staff  170 Jun  5 17:41 .
drwxr-xr-x  3 cjp  staff  102 Jun  5 17:41 ..
-rw-r--r--  1 cjp  staff   57 Jun  5 17:41 00changelog.i
-rw-r--r--  1 cjp  staff   33 Jun  5 17:41 requires
drwxr-xr-x  2 cjp  staff   68 Jun  5 17:41 store

I've found plenty of stackoverflow questions where the issue was an improperly formatted ssh URI ... mine is formatted correctly and describes an absolute path.

I have confirmed all the following:

  • hg commands run fine both on the server and through ssh.
  • If I paste the absolute path I am able to confirm the existence of the .hg directory through ssh.
  • Other hg commands manually issued through ssh succeed (e.g.: ssh cjp@ungoliant 'cd /cygdrive/j/mercurial/rcstudio; hg diff;').
  • On the host machine I can clone locally from that same absolute path.

I'm stumped here. The Mercurial docs make it sound like 2.1.2 should be able to clone from 1.9.3 parents, so it doesn't appear to be a version conflict.

Would very much appreciate your help! Thanks!

3
Which hg binary is used when you access your repo via ssh? Maybe there is a non-cygwin binary there, which can't handle the cygwin paths, and expect j:\mercurial\rcstudio instead.Rudi
You're exactly right.My own ignorance of remote ssh command processing lead to this problem. If I would ssh to the machine, "which hg" resulted with the cygwin-aware binary "/usr/local/Rjak
You're exactly right. My own ignorance of remote ssh command processing lead to this problem. If I would ssh to the machine, "which hg" resulted with the cygwin-aware binary "/usr/bin/hg", but if I did a remote command issue "ssh cjp@ungoliant 'which hg'", it returned the path to a windows binary I also have installed on that machine.Rjak

3 Answers

4
votes

What I have ended up with is a workaround and not an answer.

My own ignorance of remote ssh command processing lead to a misunderstanding. If I would ssh to the machine, "which hg" resulted with the cygwin-aware binary "/usr/bin/hg", but if I did a remote command "ssh cjp@ungoliant 'which hg'", it returned the path to a windows binary I also have installed on that machine.

I played with my .bashrc file and could not get remote command execution to prioritize the cygwin binary. The PATH doesn't even include the Windows PATH entries, so I started hacking around the problem and eventually decided to stop fighting with it.

I have since abandoned the entire idea because I'm convinced that even if I get it to work it will be a delicate kludge and not at all worth the time I've spent on it. I now host my repositories on a BSD box and I have a cron on the Windows machine that pulls from that repository onto the archival filesystem once every 24 hours. It's simple and worked like a charm with zero problems.

1
votes

I had the same issue, solved it by adding the option --remotecmd like this

hg clone --remotecmd /usr/bin/hg ssh://me@mywindowspc//cygdrive/m/hgrepo

0
votes

When you attempt an scp you would do the following:

scp username@ipaddr:/cygdrive/d/test/foo.txt ./myDestFolder

Unfortunately for hg that does not work. Instead try:

hg clone ssh://username@ipaddr/D:/testRepo