[英]Check Out Files in Mercurial / Hg
I learned version control with Subversion, and now I am trying to use Mercurial. 我用Subversion学习了版本控制,现在我正在尝试使用Mercurial。 In Subversion, I had one project in a repository by itself, and I could check it out into my Visual Studio Projects folder and work on it there. 在Subversion中,我自己在一个存储库中有一个项目,我可以将它检查到我的Visual Studio Projects文件夹中并在那里进行处理。 Now I am using a Mercurial repo with more than just my project. 现在我使用的Mercurial仓库不仅仅是我的项目。 I have a separate local copy and central copy. 我有一个单独的本地副本和中央副本。 The standard way of modifying the local copy is to modify the files directly in the repo, but I don't like that, because I can't relocate anything if need be. 修改本地副本的标准方法是直接在repo中修改文件,但我不喜欢这样,因为如果需要我不能重新定位任何东西。 Is there a way to check out my project to wherever I want? 有没有办法检查我的项目到我想要的地方? I don't like the edit-copy-paste-commit approach. 我不喜欢edit-copy-paste-commit方法。
Your problem is this: 你的问题是这样的:
The code for all the company's projects is in the local repo 公司所有项目的代码都在当地的仓库中
Quote from "What Mercurial can't do" in the Mercurial documentation: 在Mercurial文档中引用“Mercurial不能做什么” :
Many SVN/CVS users expect to host related projects together in one repository. 许多SVN / CVS用户希望在一个存储库中共同托管相关项目。 This is really not what Mercurial was made for, so you should try a different way of working. 这实际上不是Mercurial的用途,所以你应该尝试不同的工作方式。 In particular, this means that you cannot check out only one directory of a repository. 特别是,这意味着您无法仅检出存储库的一个目录。
If you absolutely need to host multiple projects in a kind of meta-repository though, you could try the Subrepositories feature that was introduced with Mercurial 1.3 or the older ForestExtension. 如果您绝对需要在某种元库中托管多个项目,则可以尝试使用Mercurial 1.3或旧版ForestExtension引入的子库存功能。
For a hands-on introduction to using Mercurial, see the Tutorial. 有关使用Mercurial的实际操作介绍,请参阅教程。
--> When you use a distributed version control system like Mercurial, you should try to create one repository per project. - >当您使用像Mercurial这样的分布式版本控制系统时,您应该尝试为每个项目创建一个存储库。
If you do it like this, your problem just goes away because if you need to modify Project X, you just clone Project X's complete repository to your machine, and that's it! 如果你这样做,你的问题就会消失,因为如果你需要修改Project X,你只需要将Project X的完整存储库克隆到你的机器上,就是这样!
Coming from Subversion, maybe you should read a tutorial that explains the difference between SVN and HG, for example one of these: 来自Subversion,也许您应该阅读一个解释SVN和HG之间差异的教程,例如其中一个:
你在寻找hg pull -u /path/to/central/repo
吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.