问题
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?
回答1:
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.
回答2:
- hg clone URL dir1
- hg clone URL dir2
... hack-debug-fix] ...
- hg commit
- hg push
- cd ...
- del dir*
回答3:
Anther option is the Share Extension, distributed with Mercurial 1.3 or later.
See Does mercurial (hg) have functionality similar to git’s worktree?
来源:https://stackoverflow.com/questions/8039390/how-do-i-have-more-than-one-workspace-with-mercurial-hg