Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it safe to "branch" a local mercurial repository clone by just copying the entire directory?

If I have a rather large Mercurial project locally, and wish to experiment, can I safely just make a local copy of everything and work there?

For instance, let's say I do this:

  1. Clone the repository from a central server to a local directory
  2. Make some changes, commit them locally, do not push
  3. Make a copy of the directory locally
  4. Make some changes in both copies locally, commit, do not push
  5. Push original copy
  6. Push second copy

Will this be safe? Or is there some unique ID's being generated when I clone?

One project is rather large, and the server has a rather slow connection, or so it seems, so it takes ages to do a full clone from the central server.

like image 558
Lasse V. Karlsen Avatar asked Jun 02 '10 15:06

Lasse V. Karlsen


1 Answers

Yup, that's perfectly safe.

The only differences I can think of between cloning a repository locally, hg clone a/ b/, and copying the repository, cp -r a/ b/, are:

  • Cloning will use hard links, if possible, so less disk space will be used
  • Repository-specific configuration (eg, a/.hg/hgrc) will not be coppied by hg clone
  • If you clone, the default push/pull path of b/ will be set to a/

So, yea — no problem with simply copying the repo.

like image 186
David Wolever Avatar answered Sep 29 '22 11:09

David Wolever