How to serve my local Mercurial repository? - mercurial

I created a repository with TortoiseHg. Is it possible to share it with other machines? Or do I need to install another application?

Right click your repository, TortoiseHG, Web Server menu option. That'll pop up a dialog, and you just hit the Start button.
Say your start port's 8000. Then on your other machines, right click in the folder where you want the new clone, select TortoiseHG, Clone a Repository. In the Source Path, put "http://originalmachine:8000/" and hit the "clone" button.
Web Server's great for temporary sharing. If you want something more persistent, that doesn't require a task sitting in your task bar, look here for instructions on how to get hgwebdir set up on Windows (but this requires Mercurial, rather than TortoiseHg).

Yep, just share the folder and have the other machines push/pull.
You can also right-click your repo and choose "Web server" under the TortoiseHG menu. This serves the repo over TCP/IP.

Related

How to create a central repo in TortoiseHg without it showing up in the Repository Registry?

I set up a local repo in TortoiseHg and can see the folder in the Repository Registry list. I want to create a central repository that I can push to and pull from when I'm on different computers. I have a Microsoft OneDrive account so I thought I would use that. I did File>Clone Repository... and browsed to OneDrive where I had created a "Mercurial" folder. It apparently did clone the repo since now I see a second repo in the list by the same name but in Bold letters.
I really didn't want to see the central repo in the list. That is only going to cause confusion. At work, we use BitBucket for our central repo and that doesn't show up in the list, so why does the OneDrive repo? Any way to hide it?
Right-click the entry in the Repository Registry and select "Remove from Registry".

Mercurial connect to webserver

after some research I think I am the only one that is dumb enough to don't understand how to connect to a TortoiseHg on a Webserver with my local Hg.
I can't find any configurations in Hg or am I so stupid and blind?
Can anyone help my helpless brain?
TortoiseHG is simply a GUI for mercurial. It sounds like you are trying to interact with 2 different mercurial repos.
First of all, to connect to the repo on your webserver you have to make sure it is currently serving. You can do this by going onto that box, opening a cmdline with its current directory as your repo, and then typing
hg serve
This will then show a message with a url, like
listening at http://Mywebserver:8000/ (bound to *:8000)
Alternatively, if you have TortoiseHG installed on the webserver, you can rightclick the folder containing the repo, and in the TortoiseHG shell extension click Web Server. In the window that opens, click start to serve the repo.
This repo is now accessible to any machine than can reach that machine and port.
To use TortoiseHG to clone this repo from your local machine ( assuming you have tortoiseHG installed on your machine ):
Open an explorer window, Right click, and in the TortoiseHG shell extension click clone.
In source, enter the url that was displayed when you served on the webserver. For destination, you can enter the name of the folder you would like the repo created in.
A clone of that repo will now be created where you specified.
By default, all its push and pull commands will reference the url of the repo on the webserver. IE, if you do a push or pull cmd on your cloned repo without specify the repo to push or pull to, mercurial will assume it should push or pull to that url.
To interact with the remote repo:
Navigate to the directory containing your repo.
Right click your repo's folder, and in the TortoiseHG shell extension click Synchronize.
You should see that the url field is already filled in with the url you cloned from. You can now click the incoming, pull, outgoing and push buttons to perform those actions.

How do I use Tortoise HG to set up a repository on my computer?

I was given the company website for our repository on a new project, but I don't know how to set up the repository on my computer using Tortoise HG. Our previous project was already set up on my machine when I started working so I didn't need to know how. I would feel more comfortable asking this community rather than my boss.
The repository is a "Mercurial repository". The website itself is set up in this way.
I've downloaded the files from the "zip" button, but don't know how to connect that file to the website using Tortoise so things I do will actually affect the real repository.
How do I set up the Tortoise workbench so that I can pull and push changes to the repository?
The zip contains only the files without any of the mercurial specific part. You can delete it, we won't use it to setup your personal repository.
First of all you need to have the URL to access your repository. Depending on the configuration of the server, it can be through HTTP, SSH or even a network share. Then you will eventually need credentials.
You can look for a "clone" URL somewhere on the website or ask a coworker / your boss for this.
Once you have the URL, you simply clone the repository with TortoiseHG : http://tortoisehg.bitbucket.io/manual/2.9/clone.html
You can now use your repository like the precedant one.

Mercurial to Manage Existing Website?

Getting ready to launch a website/project that was in beta testing. I want to switch it over to version control (Mercurial since I'm familiar with it).
Problem is, I am not sure how to go about doing it since the code on the website is already up and in-use and how to deal with the directories I do not need to manage (vendor and web/Upload).
Whats the best way to go about this?
Would I put the entire site into a folder, init a Merc repo, use hgignore to not track vendor and web/Upload, commit, then clone it to the live server?
Thanks! Just confused on what to do since the site is live and has user uploads.
I'm assuming you want to turn the website directory on your web server into a Mercurial repository. If that's the case, you would create a new repository somewhere on that computer, then move the .hg directory in the new repository into the website directory you want to be the root of the repository. You should then be able to run
hg add * --exclude vendor --exclude web/Upload
hg commit -m "Adding site to version control."
to get all the non-user files into version control.
I recommend, however, that you write a script or investigate tools that will deploy your website out of a repository outside your web root. You don't want your .hg directory exposed to the world. Until you get a deploy script/tool working, make sure you tell your webserver to prohibit/reject all requests to your .hg directory.

Mercurial and online sharing - how to proceed

A noob question... i think
I use Mercurial for my project on my laptop. How do i submit the project to an online server like codeplex?
I'm using tortoisehg and i cant find the upload interface for submit the project online...
From the command line, the command is:
hg push <url>
to push changes a remote repository.
In TortoiseHg, this is accessed through the "Synchronize" function, which seems to show up if you right-click in a Windows Explorer window but not on any file. It's also available in the workbench; the icon is 2 arrows pointing in a circle.
For these things, I find the best way to go is to use the command line interface - TortoiseHG is OK if you need to perform some common operations from the file browser, and it's a nice tool to visualize some aspects of your repository, but it doesn't implement all of mercurial's features in full detail, and it renames and bundles some operations for no apparent reason.
I don't know how things work at codeplex, but I assume it is similar to bitbucket or github, in which case here's what you'd do:
Create an empty repository on the remote end (codeplex / bitbucket / ...).
Find the remote repository's URL - for bitbucket, it is https://bitbucket.org/yourname/project, or ssh://hg#bitbucket.org/yourname/project.
From your local repository, commit all pending changes, then issue the command: hg push {remote_url}, where {remote_url} is the URL of the remote repository. This will push all committed changes from your local repository to the remote repository.
Since the remote's head revision (an empty project) is the same as the first revision in your local copy (because all hg repositories start out empty), mercurial should consider the two repositories related and accept the push.
For an introductory guide to command-line mercurial, I recommend http://hginit.com/