简体   繁体   中英

How do I have more than one workspace with Mercurial (hg)?

I am just trying to my head round Mercurial, so this may be a daft question..

Open I wish to have more than one version of a program compiled on my machine, for example, I may need to single step both the “working versions” and the “bracken” version in a debugger until I find way the behave differently.

I also like to checkout to a clean workspace after I have done a check, so I can check (by doing a build) that I have not forgot to add a file.

This is easy to do in most source code control system, but Mercurial does not seem to support this. What am I missing?

Mercurial supports this model better than most Version Control Systems.

The trick is that you can have multiple repositories of the same code on your machine. Each repository supports one working directory, where you will keep your code.

You can move changes between the repositories, or from these to repositories on other machines, such as a central repo.

A Mercurial user might read your statement "I also like to checkout to a clean workspace after I have done a check...." as "I would like to clone a new copy of the repository after I have committed my checked code." And this is easily done.

Anther option is the Share Extension , distributed with Mercurial 1.3 or later.

See Does mercurial (hg) have functionality similar to git's worktree?

  • hg clone URL dir1
  • hg clone URL dir2

... hack-debug-fix] ...

  • hg commit
  • hg push
  • cd ...
  • del dir*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM