自动导入Mercurial存储库(例如SVN外部) [英] Importing a Mercurial repository automatically (e.g. SVN Externals)

查看:76
本文介绍了自动导入Mercurial存储库(例如SVN外部)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于CodeIgniter开发的项目.该项目的主要部分是我正在创建的私有系统,但是我想将其添加到源代码管理中,以获得所有相关的东西.现在我正在使用Mercurial,所以我做了整个hg init的工作,所以我已经建立了存储库.

I have a project that I am developing built off CodeIgniter. The main part of the project is a private system I am creating, but I want to add it to source control, to gain all the associated goodies. Now I'm using Mercurial, so I did the whole hg init bit, so I've got the repository set up.

现在,我要做的一件事情就是为CodeIgniter创建一个库,我将在此项目中使用该库.现在,我想打开该库,因此我需要一个单独的存储库.

Now, one of the things I've done is to make a library for CodeIgniter, which I use in this project. Now I want to make this library open, so I need a separate repo for that.

对于不熟悉CodeIgniter库开发的任何人,请参考:

For anyone unfamiliar with CodeIgniter library development, here's a reference:

application
  /config <- configuration files
  /libraries <- library logic in here

现在我可能会在该项目的过程中开发更多的库,所以我不能不将所有库都聚集在一起而直接将其存储在应用程序文件夹中.

Now I will probably develop a few more libraries in the course of this project, so I can't just dump a repo in the application folder without clumping them all together.

我所做的是这样:

dev/ci/library <- library here
dev/project <- project here

现在在这两个文件夹中,我都建立了一个存储库.我想要做的是使项目存储库自动引用库存储库,因此,如我前面所述,我可以拥有私有存储库和公共存储库.

Now in both of those folders, I have made a repository. What I want to do is make the project repository automatically reference the library repository, so I can have a private and a public repository, as I explained earlier.

我已经读到,实现此目的的主要方法是使用子存储库,但是我只能在嵌套存储库上找到示例(无论如何我都不清楚).我如何使其引用诸如svn:externals之类的另一个存储库?

The main way to do this, I have read, is to use subrepositories, but I can only find examples on nested ones (which are unclear anyway, I find). How do I make it reference another repository like svn:externals?

推荐答案

您是正确的,Mercurial(或Git中的子模块)中的子存储库基于嵌套的组织.
但是在您的特定情况下,您需要:

You are correct, subrepos in Mercurial (or submodules in Git) are based on a nested organization.
But in your specific case you need:

  • 两个单独的存储库,
  • 不嵌套

调和这两个组织(您的组织和嵌套的"subrepo")的一种方法是拥有三个仓库

A way to reconcile both organizations (yours and the nested "subrepo") would be to have three repos

  • 父级存储库(私有存储库,可以将其推送到私有存储库)
  • 项目(私有项目,可以将其推送到私有仓库中)
  • 图书馆(公共图书馆,可以将其推送到公共仓库)

这将给出以下内容:

/dev
  .hg (private repo)
  .hgsubs (declare the two nested repos 'project' and 'ci/library')
  project
    .hg (private repo for your project)
    config
    .hgignore (for ignoring anyhting from libraries)
    libraries (private directory, not version)
      (symlink to /dev/ci/library)
  ci
    library
      .hg (public repo 

那样,您保持:

  • 您的两个存储库可以根据需要分开
  • 两者之间的链接,以便能够以您留下的确切引用取回这两个存储库(即,您上次推送了每个存储库).

这篇关于自动导入Mercurial存储库(例如SVN外部)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆