简体   繁体   中英

Check Out Files in Mercurial / Hg

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.

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:

你在寻找hg pull -u /path/to/central/repo吗?

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