使用 Mercurial 和 Eclipse 的项目功能子模块的最佳实践? [英] Best Practices for Project Feature Sub-Modules with Mercurial and Eclipse?

查看:20
本文介绍了使用 Mercurial 和 Eclipse 的项目功能子模块的最佳实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个不同客户的 ANT 项目;我的项目目录结构如下所示:

I have a couple of ANT projects for several different clients; the directory structure I have for my projects looks like this:

L___standard_workspace
    L___.hg
    L___validation_commons-sub-proj  <- JS Library/Module
    |   L___java
    |   |   L___jar
    |   L___old_stuff
    |   L___src
    |   |   L___css
    |   |   L___js
    |   |       L___validation_commons
    |   L___src-test
    |       L___js
    L___v_file_attachment-sub-proj  <- JS Library/Module
    |   L___java
    |   |   L___jar
    |   L___src
    |   |   L___css
    |   |   L___js
    |   L___src-test
    |       L___js
    L___z_business_logic-sub-proj  <- JS Library/Module
    |   L___java
    |   |   L___jar
    |   L___src
    |       L___css
    |       L___js
    L____master-proj               <- Master web-deployment module where js libraries are compiled to.
        L___docs
        L___java
        |   L___jar
        |   L___src
        |       L___AntTasks
        |           L___build
        |           |   L___classes
        |           |       L___com
        |           |           L___company
        |           L___dist
        |           L___nbproject
        |           |   L___private
        |           L___src
        |               L___com
        |                   L___company
        L___remoteConfig
        L___src
        |   L___css
        |   |   L___blueprint
        |   |   |   L___plugins
        |   |   |   |   L___buttons
        |   |   |   |   |   L___icons
        |   |   |   |   L___fancy-type
        |   |   |   |   L___link-icons
        |   |   |   |   |   L___icons
        |   |   |   |   L___rtl
        |   |   |   L___src
        |   |   L___jsmvc
        |   L___img
        |   |   L___background-shadows
        |   |   L___banners
        |   |   L___menu
        |   L___js
        |   |   L___approve
        |   |   L___cart
        |   |   L___confirm
        |   |   L___history
        |   |   L___jsmvc
        |   |   L___mixed
        |   |   L___office
        |   L___stylesheets
        |   L___swf
        L___src-standard

在工作副本中,模块将子项目编译成单个 Javascript 文件,该文件位于主项目的 Javascript 目录中.

Within the working copy the modules compile the sub-project into a single Javascript file that is placed in the Javascript directory of the master project.

例如,目录:

  • validation_commons-sub-proj
  • v_file_attachment-sub-proj
  • z_business_logic-sub-proj

...在 _master-proj/js 目录中,所有的都被组合并缩小(有点像编译)到一个不同的 Javascript 文件名中;最后一步编译 _master-proj 以部署到服务器.

...all are combined and minified (sort of like compiled) into a different Javascript filename in the _master-proj/js directory; and in the final step the _master-proj is compiled to be deployed to the server.

现在关于我想用 hg 设置它的方式,我希望能够做的是将主项目及其子项目从他们自己的基线存储库克隆到客户的工作副本,以便可以将模块添加(使用 hg)到特定客户的工作副本.

Now in regards to the way I'd like to set this up with hg, what I'd like to be able to do is clone the master project and its sub-projects from their own base-line repositories into a client's working-copy, so that modules can be added (using hg) to a particular customer's working copy.

此外,当我对一个客户的工作副本中的错误进行一些更改/修复时,我希望能够选择性地将更改/错误修复推送回主项目/子项目的基线存储库,目的是最终将更改/修复程序提取到其他客户的工作副本中,这些副本可能包含需要修复的相同错误.

Additionally however, when I do make some changes to/fix bugs in one customer's working copy, I would like to be able to optionally push the changes/bug fixes back to the master project/sub-project's base-line repository, for purposes of eventually pulling the changes/fixes into other customer's working copies that might contain the same bugs that need to be fixed.

通过这种方式,我将能够在不同的客户端上使用相同的错误修复.

In this way I will be able to utilize the same bug fixes across different clients.

但是……我不确定使用 hg 和 Eclipse 执行此操作的最佳方法.

However...I am uncertain of the best way to do this using hg and Eclipse.

在这里阅读 你可以使用 hg 的 Convert Extension 使用 --filemap 选项将子目录拆分为单独的项目.

I read here that you can use hg's Convert Extension to split a sub-directory into a separate project using the --filemap option.

但是,对于使用 Convert 是否更好,我仍然有点困惑扩展,或者最好将每个模块放在自己的存储库中,然后将它们检出到每个客户端的单个工作区中.

However, I'm still a little bit confused as to if it would be better to use the Convert Extension or if it would be better to just house each of the modules in their own repository and check them out into a single workspace for each client.

推荐答案

是的,它看起来像 subrepos 是您正在寻找的,但我认为这可能是错误问题的正确答案,我强烈怀疑您会遇到类似的 使用 svn:externals 时出现的问题

Yep, it looks like subrepos are what you are looking for, but I think maybe that is the right answer for the wrong question and I strongly suspect that you'll run into similar issues that occur when using svn:externals

相反,我建议您将合并和缩小的 JS 文件发布"到 artefact 存储库 和使用依赖管理器,例如 Ivy 将特定版本的人工制品拉入主项目.这种方法可让您更好地控制主项目使用的子项目版本.

Instead I would recommend that you "publish" your combined and minified JS files to an artefact repository and use a dependency manager such as Ivy to pull specific versions of your artefacts into your master project. This approach give you far greater control over the sub-project versions your master project uses.

如果您需要对特定客户端的子项目进行错误修复,您只需在该子项目的主线上进行修复,然后发布新版本(最好通过 自动构建管道)并更新他们的主项目以使用新版本.哦,你想在发布之前用他们的主项目测试新版本吗?在这种情况下,在推送修复之前,在本地合并和缩小子项目,将其发布到 本地存储库 并让客户的主项目选择该版本进行测试.

If you need to make bug fixes to a sub-project for a particular client, you can just make the fixes on the mainline for that sub-project, publish a new version (ideally via an automated build pipeline) and update their master project to use the new version. Oh, you wanted to test the new version with the their master project before publishing? In that case, before you push your fix, combine and minify your sub-project locally, publish it to a local repository and have the client's master project pick up that version for your testing.

这篇关于使用 Mercurial 和 Eclipse 的项目功能子模块的最佳实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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