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

本小妞迷上赌 提交于 2019-12-20 07:07:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!