Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I move my Mercurial working directory to another location?

I am new to Mercurial and version control in general, so I'm sure this is a pretty basic question but I have, as yet, been unable to find the answer.

I am working on a small project which is under Mercurial version control. The project and the .hg repository are currently on my local drive (C:\MyProject.hg), however I would like to move the whole lot to another location (in this case a network drive) which is backed up every night. I would want this new location to become my working directory.

My question is, can I simply copy the MyProject directory (and hence the .hg repository) to the new location and have everything work as it did on my local drive? Or does this via Mercurial commands (eg clone) so that Mercurial knows about the change of location?

like image 337
gregorE Avatar asked Jun 01 '11 15:06

gregorE


2 Answers

You can do a normal copy of the folder, but if you plan to continue using your local version, you should make the copy with the hg clone, so you can do a hg pull or hg push to sync the versions. You can still push and pull if you don't use hg clone but it makes it a little easier.

like image 55
mikerobi Avatar answered Sep 22 '22 00:09

mikerobi


You can completely move your local version to a network drive and make that your new "local" version. You do not have to let mercurial know that its parent (project) directory is being moved.

As another answer mentioned however, it might be to your benefit to keep your project locally, and create another repository on the network drive (one that doesn't have a working directory) by cloning the one on your local machine to the networked drive. That way, you can keep your own repository locally and not have to change anything, while also getting to backup your repository on the network drive. You could setup a nightly cron job on either your machine (push) or on the network machine (pull) so that they remain in sync.

like image 39
Diego Avatar answered Sep 26 '22 00:09

Diego