Shelving and UnShelving TortoiseHG code on two separate computers? - mercurial

Can i shelve some code I've been working on, at work, with TortoiseHG .. go home .. pull/merge/update ... and then UnShelve and continue working at home?
Does TortoiseHG offer this?
At work, I created a new shelve and added all my 'touched' files into the shelve. But when I got home I couldn't find/see the shelve, etc.

The shelf is just a file on the local copy of the repository, so if you are working from another computer you won't see the shelf.
Note: TortoiseHg's implementation is just to create a diff in the file .hg\shelve, so potentially you could email the file home and place it in the .hg folder (being careful not to destroy an existing shelf of course!)

MQ with pull|push including mq-patches maybe more natural way

In Windows, you can automatically sync shelves using a cloud storage sync service like DropBox or Google Drive. Move the shelves directory (in .hg) to your cloud storage folder and replace it with a directory junction. You can create a directory junction by running this in the .hg directory:
mklink /h shelves C:/Users/<username>/Google Drive/shelves
Of course, replace the target with whatever location you are actually using. Repeat this on all computer you are using Mercurial on.

You can put the files you are working on in DropBox (or similar) shared folder.
In this way you will always have synchronized copy of your file on several computers.
Maybe this is not the cleanest solution but it works.

Related

Mercurial - how to make a local central repository

I would like to have a central repository in a directory on my local computer without setting up a server.
Context: I am working with my boss on a local server inside our LAN. We both are using a vnc connection onto the server, and are doing our work there for simplicity reasons. I would like to set it up so that I can have a copy of my scripts for development, and then when I get to a release, I will push it to a different directory that my boss can then run them from (or even better pull from to his own set and run from there).
I read that you can create a hg server by running 'hg serve', but I do not want to open it up to the LAN, because I don't want it to be accessible.
I tried running 'hg push /home/source' and it gave me an error.
I then ran 'hg init' while in that directory and tried again. It looked like it worked, and then didn't show any files in the directory. I ran status and it showed nothing, and then ran log and it showed the commits.
... without setting up a server
One way I've used to share a "central" Mercurial repository without having to deal with any "server" issues is to have the "central" repository in a folder on Dropbox.
For example, suppose:
your repository is named "repo" and that your "private" copy is in ~/repo
your Dropbox directory on your computer is ~/Dropbox/
Then:
cd ~/Dropbox
hg clone ~/repo
Now suppose you make some changes in ~/repo. You can then "push" them from ~/repo to ~/Dropbox/repo, or (more easily, as explained below) "pull" them into ~/Dropbox/repo when you're ready.
To make updating the "central" repository convenient, you might like to create a script such as:
#!/bin/bash
cd ~/Dropbox/repo
hg tip
hg pull -u
hg tip
Notice that in the script, there is no need to specify the source from which to pull; the hgrc file that's created when you created the clone keeps track of that. (Thank you, hg.)
If your colleague has direct access to a folder on your computer, then you could still adopt the strategy described above, without using Dropbox.
Needless to say, there are many variations.
Needless to say also, if more than one person attempts to commit changes to the shared folder, chaos can easily ensue.

Partial download by filepath with mercurial

How do you download a specific folder from a Mercurial repo? This is a similar question to partial cloning, but I don't want to actually create a local repo, since I won't be versioning these files. I just want to quickly download a specific folder containing a few KB worth of files from a repo that's several hundreds MB in size.
Specifically, I want to download all the entire "examples/plugins" folder from the Gazebo project.
I've tried searching hg's manpage and Google, but all my searches keep bringing me back to pages that assume I want to create a full repo and make a partial clone or narrow clone, which hg doesn't support.
If the Mercurial repository is running hgweb, it's possible to download a specific folder remotely. For example for the official hg repository, you can download https://www.mercurial-scm.org/repo/hg/archive/REVISION.tar.bz2/SUBPATH/.
Example: https://www.mercurial-scm.org/repo/hg/archive/19c5b0913960.tar.bz2/contrib/
This uses the 'hg archive' functionality Edward mentions, but through the web-interface.

Repository is changed after push on mercurial

When I create repository and push on server and when we clone the repository in local system the files are come with red signal means they are changed.
When we compare both repository I found that the content of files in .hg folder is changed.
Can anyone pls tell me how to remove this problem!
Edit:
When we change the .hg folder the red icon becomes green!!!!
If you take 1 modified (changed) file, watch the diff closely, and only see the difference is in new lines only, this is the classical newlines mess.
(happens to most people when working crossplatform)
There is a ready to use Mercurial Extension, taking care of this is problem.
It's called eol.
Learn how to use it and the problem from here:
https://www.mercurial-scm.org/wiki/EolExtension
how do you push localy created repository to server? If there is no repo with same name(on server), you could not be able to create remote repo by push, you have to clone it to the server. Or, if there already is repository with same name, and you push some new localy created, there definitely will be something more in .hg on the server then on the local. Check if there isn't repo with same name on the server already. HTH

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 repository backup when hidden files can not be backupped

Our company policy is not to back up hidden folders.
Is it possible to change the .hg folder name to something visible?
There's no way to rename that directory using standard mercurial configuration options. If you're on unix, and I'm guessing your are if .hg sounds hidden, you could use a pre-backup script (or cron job) to snapshot it using cp -al into something with a different name. Using -l gets you hardlinks, so it won't actually take up extra disk.
However, most people back up their .hg repositories with a push to a different mercurial server, which can be easily scripted too.
Can you create a tar archive of the repository before your company's backup cycle runs via cron?
You can always try to fool the back up system by creating a link to the .hg folder with a "backupable" name.