Tortoisehg on a remote folder (ssh/sftp) - mercurial

My hg repository is on a server that I can reach with ssh and sftp.
So I can mount the remote dir on my desktop (debian) and can edit the file there.
Now I would like to use Tortoisehg, but I would rather not to clone the repo locally, but just using the remote one that is now mounted locally.
How can I do th?

Now I would like to use Tortoisehg, but I would rather not to clone the repo locally, but just using the remote
It's, in common, The Bad Idea (tm) to use repository from network drive, but:
use this repo the same way, as you edited files in working dir of repository
* Mount to any point of local FS
* Add repository to TortoiseHG Workbench, using "translated" local path to repository
* Use repository as any other really local
But clone|push way is more natural and bullet-proof (no chances to get corrupted repo, real backup of your local repository on remote host)

Related

How to automatically keep remote mercurial repository at tip after pushes

I created a mercurial repository on some file servers net share.
Is it possible to automatically get the remote repository updated to tip if somebody pushes its changes?
Because some other people (purely users) may copy the repositories content (rather than cloning, because of lack of .hg) and i want them to get the newest version.
Since it is a share on a simple NAS it would be good if the pushing client could invoke this update.
It seems that a hook on the changegroup event can solve this.
Add the following lines to the repository's configuration file (repo/.hg/hgrc)
[hooks]
changegroup = hg update
This solution was suggested on a slightly different question:
Cloning mercurial repo to the remote host
At least under windows this seems only to work on local repositories. The reason for this is, that hg tries run a cmd on the remote path that fails, since it does not support UNC paths as current direcory.
Adding explicitly the repository url fixes this, but its not client independent anymore.
[hooks]
changegroup = hg update -R %HG_URL%
You could treat the server repository as your "local working directory" and then PULL from your own PC to that location. If you use hg pull --update then it will automatically update the working folder to the latest.
One way to do this is to login to your NAS and physically run the hg command line program there. If not, you could also mount the NAS folder on your local PC and then chdir to its mapped local folder and use your local hg client to do so.
This might seem like an odd thing to do but Mercurial doesn't care which is the "clone" and which is the "server", you can swap them interchangeably in your workflow.

Mercurial subrepository different folder

I have different repositories on my server, the main repo of the application (MyApplication A, B, C) and the library repo (I'd like to reuse this repo in many applications).
on server side
\\Server\Share\MyApplicationA\
\\Server\Share\MyApplicationB\
\\Server\Share\MyApplicationC\
\\Server\Share\MyLibrary\
When I clone the repo I put the LibraryRepo inside the application in use (A, B or C).
on my computer
C:\MyApplicationA\
C:\MyApplicationA\MyLibrary\
C:\MyApplicationB\
C:\MyApplicationB\MyLibrary\
C:\MyApplicationC\
C:\MyApplicationC\MyLibrary\
This is my .hgsub
MyLibrary = MyLibrary
When I try to push on remote repo (on server) I get this error:
repository Z:/SERVER/Share/MyApplicationA/MyLibrary non trovato
...because the Library Repo on server is on different folder.
I have to create/link the subrepo on server side before?
To manage the repository I use TortoiseHG (Mercurial).
Any suggestion will be appreciated.
Thanks.
I found this solution that work on fake remote repo (fake becasue the remote repo is on my external HD and simulate my SERVER share) but doesn't work on real repo on my server.
Open DOS command line (with Admin rights), write:
mklink /D MyLibrary ".\..\MyLibrary"
How to create symlink on remote path ?
Thanks for any suggestions.

Committing to local and network mercurial repository at the same time

I wasn't able to get the system admin to run a mercurial server on the network, so I am trying to find a work around.
Using the tortoise interface (preferred interface) or just the normal command line, is there a way to setup mercurial to commit a local files to a repository located on a network drive without using the mercurial server?
I would like to store the repository on a network drive, clone the repo to a local directory and then commit to both the local and the network drive.
I want to right click in the local directory that has the files I want to commit and then select commit and it will commit to both a repo on the network and to the local repo that in the directory that I right clicked on.
Stephen
You can push/pull from a network drive, I do this all the time to validate the push from a local to the remote (network drive). The repo can be on a network drive, it can be considered local if you access its files directly. Just open the repository in TortoiseHg with it's network name.
Assuming you are using Windows: \pc\share\folder\repo. You can also connect or mount the drive, if it is easier for you.
But you cannot commit once to many repositories simultaneously; a file has to be in the repository you are committing to. Either you do it remotely, on the network drive, with your file in the network repository, or you do it locally, on your local drive repository. After that, it is simply a matter of synchronizing the 2 repositories, using push or pull.

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 move a Mercurial repository created on a local PC to a web server?

I have created and committed to Mercurial repository that was created on my local drive. I now have a remote Windows 2003 web server setup to serve repositories via hgwebdir.cgi.
How do I move the locally created repository to the web server?
It looks like an ftp of the .hg folder on the local drive to the remote web server does the trick. Am I doing it the right way. Is there a more efficient way?
Copying the .hg directory is a completely valid way to do it.
NOTE: You will probably want to exclude, remove or edit the .hg/hgrc file if you have one, as it may contain an absolute path to the original location of the repository.
You could also initialise an empty repository on the remote server, ensure that write permissions are set up correctly, and then run hg push https://wherever. I haven't measured, but I imagine that this method would be slower.