Lasse V. Karlsen
Lasse V. Karlsen

Reputation: 391704

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.

Upvotes: 7

Views: 376

Answers (1)

David Wolever
David Wolever

Reputation: 154682

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.

Upvotes: 6

Related Questions