在 Mercurial / Hg 中查看文件

发布于 2024-12-22 20:24:12 字数 253 浏览 1 评论 0原文

我用 Subversion 学习了版本控制,现在我正在尝试使用 Mercurial。在 Subversion 中,我在存储库中拥有一个项目,我可以将其签入我的 Visual Studio 项目文件夹并在那里进行处理。现在,我不仅仅在我的项目中使用 Mercurial 存储库。我有一个单独的本地副本和中央副本。修改本地副本的标准方法是直接修改存储库中的文件,但我不喜欢那样,因为如果需要,我无法重新定位任何内容。有没有办法在我想要的任何地方查看我的项目?我不喜欢编辑-复制-粘贴-提交的方法。

I learned version control with Subversion, and now I am trying to use 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. Now I am using a Mercurial repo with more than just my project. 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. Is there a way to check out my project to wherever I want? I don't like the edit-copy-paste-commit approach.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

叹沉浮 2024-12-29 20:24:12

你的问题是这样的:

公司所有项目的代码都在本地仓库

"Mercurial 不能做什么“ 在 Mercurial 文档中:

许多 SVN/CVS 用户希望将相关项目集中在一起托管
存储库。这确实不是 Mercurial 的用途,所以你
应该尝试不同的工作方式。特别是,这意味着
您不能仅签出存储库的一个目录。

如果您绝对需要以某种方式托管多个项目
不过,元存储库,您可以尝试子存储库功能
是随 Mercurial 1.3 或更旧的 ForestExtension 一起引入的。

有关使用 Mercurial 的实践介绍,请参阅教程。

-->当您使用像 Mercurial 这样的分布式版本控制系统时,您应该尝试为每个项目创建一个存储库。
如果您这样做,您的问题就会消失,因为如果您需要修改 Project X,您只需将 Project X 的完整存储库克隆到您的计算机即可,仅此而已!

来自 Subversion,也许您应该阅读一个解释 SVN 和 HG 之间差异的教程,例如其中之一:

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:

Many SVN/CVS users expect to host related projects together in one
repository. This is really not what Mercurial was made for, so you
should try a different way of working. 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.

For a hands-on introduction to using Mercurial, see the Tutorial.

--> When you use a distributed version control system like Mercurial, you should try to create one repository per project.
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!

Coming from Subversion, maybe you should read a tutorial that explains the difference between SVN and HG, for example one of these:

奶气 2024-12-29 20:24:12

您是否在寻找 hg pull -u /path/to/central/repo

Are you looking for hg pull -u /path/to/central/repo ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文