简体   繁体   中英

How to manage dependency when cloning repository?

I am using mercurial and I am wondering how to do the following. Here is my repository architecture :

./repo/utils/workers/[...]
./repo/utils/tools/[...]
./repo/proj1/file.py

Let's say that in proj1/file.py I need to import some code located in workers and tools. eg

from utils.workers import foo
from utils.tools import bar

What would be the best way/tool to check out proj1 with all the needed dependencies (eg, workers/ and tools/) without having to clone utils/workers and utils/tools inside of proj1.

Also - doing a sys.path.append(repo/utils/workers) is not a option.

== Edit 01/24/11 ==

Thanks for all the answers. I've been thinking of a way to really explain my problem differently, and it seams that we should make abstraction of hg for a better understanding. Let's say that in /utils/ there also are another few modules in there, that do not belong to my project, but that are actually needed. For example: http://code.google.com/p/python-gflags/ When checking out /repo/proj1/ I want all the dependencies, not matter which repository they're form, to be checked out too - but with read-only since.

So if I do hg clone /proj1/ I want this action to also clone all the needed modules from /utils/workers/ , /utils/tools/ , and python-gflags under /utils/python-gflags

I hope this helps a little bit to clarify what I am trying to do.

Cheers,

Martin

您应该查看子存储库 (也称为嵌套

The best solution I've found to to this, is by using buildout.

http://www.buildout.org

It is a really helpful solution to manage dependencies.

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