使用Mercurial/TortoiseHg处理嵌套的汞储存库的正确方法是什么? [英] What is the correct way to handle nested Hg repositories with Mercurial/TortoiseHg?

查看:131
本文介绍了使用Mercurial/TortoiseHg处理嵌套的汞储存库的正确方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力使用TortoiseHg正确跟踪嵌套存储库.

I'm struggling on how to correctly track nested repositories using TortoiseHg.

我有一个主要的存储库,可以跟踪我的整个项目.该项目包含几个存储在plugins/子目录中的小插件.

I have a main repository that tracks my whole project. This project contains several little plugins that are stored inside a plugins/ subdirectory.

我很想独立地跟踪每个插件(为每个插件提交并推送到BitBucket),同时仍然能够对我的项目进行整体"提交,包括对插件所做的更改并将其推送到其他位置(不是BitBucket).

I would love to track each plugin independently (committing and pushing to BitBucket for each one of them) while still being able to make a "whole" commit of my project, including the changes made to the plugins and pushing it to an other location (not BitBucket).

到目前为止,我为每个插件创建了一个新的仓库.我可以提交并轻松地将它们推送到BitBucket.但是当我提交主"存储库时,TortoiseHg显示一条错误消息,提示abort: path 'mainrepo\\plugins\\plugin1\\plugin1.php' is inside repo 'mainrepo\\plugins\\plugin1'.

What I've done so far is creating a new repo for each of my plugins. I can commit and push them to BitBucket easily. But when I went to commit my "main" repository, TortoiseHg displays an error message saying that abort: path 'mainrepo\\plugins\\plugin1\\plugin1.php' is inside repo 'mainrepo\\plugins\\plugin1'.

我可以看到我做错了什么,但我不知道该怎么办.

I can see that I'm doing something wrong, but I can't tell what.

我在WinXP上每晚使用Mercurial和TortoiseHg(ToirtoiseHg版本0.9.3 + 237-ea50f793bbe4和Mercurial-1.4.3 + 225-70dea42c9406).我读到subrepos处理已添加到此TortoiseHg版本中,但是,我什至不确定subrepos是否是我应该在此处使用的功能.

I'm using a nightly of both Mercurial and TortoiseHg (ToirtoiseHg version 0.9.3+237-ea50f793bbe4 and Mercurial-1.4.3+225-70dea42c9406) on WinXP. I read that subrepos handling was added to this TortoiseHg build, but, well, I'm not even sure subrepos is the feature I'm supposed to use here.

更新
我已经取得了一些进展,但仍然无法按照我想要的方式来工作.
这是我的结构:

Update
I've made some progress, but still can't get it to work the way I'd like.
Here is my structure :

-- .hg
-- core
-- app
    -- file.php
    -- file.css
    -- plugins
        -- plugin1
            -- file1.php
        -- plugin2
            -- file2.php

我去了app/plugins,并在这里从BitBucket克隆了一个插件(名为plugin3).然后,我在根目录下创建了一个.hgsub文件,并在其中添加了app/plugins/plugin3 = app/plugins/plugin3. 这样便可以提交整个目录.

I went to app/plugins, and cloned a plugin (named plugin3) from BitBucket here. I then created a .hgsub file at the root and added app/plugins/plugin3 = app/plugins/plugin3 to it. I was then able to commit my whole directory.

但是随后,我尝试从BitBucket中获取最新版本的plugin1,因此我转到了app/plugins,删除了plugin1/文件夹,并从BitBucket中克隆了plugin1.然后,我在.hgsub中添加了app/plugins/plugin1 = app/plugins/plugin1,但是当我尝试提交它时,我受到了abort: path 'app/plugins/plugin1/file1.php' is inside repo 'app\\plugins\\plugin1'

But then I tried to grab the latest version of plugin1 from BitBucket, so I went to app/plugins, deleted the plugin1/ folder and cloned the plugin1 from BitBucket. I then added app/plugins/plugin1 = app/plugins/plugin1 to .hgsub but when I tried to commit it I was greeted with abort: path 'app/plugins/plugin1/file1.php' is inside repo 'app\\plugins\\plugin1'

当我的子仓库拥有与Hg在plugins/目录中已跟踪的目录相同的名称时,问题似乎会触发.

The problem seems to fire when my subrepo holds the same name as a directory already tracked by Hg in the plugins/ directory.

我做错了什么?我应该在插件的.hg中添加/编辑一些特别的东西吗?

What am I doing wrong ? Should I add/edit something special in the .hg of my plugins ?

更新
我终于设法使其按我想要的方式工作.
我必须手动"告诉Mercurial删除plugins/plugin1,plugins/plugin2目录,提交更改,然后从BitBucket克隆回plugin1和plugin2,将app/plugins/plugin1 = app/plugins/plugin1添加到.hgsub并全部提交.奏效了.
重要的步骤是在删除plugin1/plugin2文件夹后提交.

Update
I've finally managed to get it to work the way I want.
I had to "manually" tell Mercurial to remove the plugins/plugin1, plugins/plugin2 directories, commit the change, then clone back the plugin1 and plugin2 from BitBucket, add app/plugins/plugin1 = app/plugins/plugin1 to .hgsub and commit all. It worked.
The important step was committing after having deleted the plugin1/plugin2 folders.

推荐答案

我终于设法使其按我喜欢的方式工作.我在winXP上使用TortoiseHg,所以无法告诉您内部进行了哪些hg调用,但我认为这里没有花哨的东西.

I've finally managed to make it work the way I'd love. I'm using TortoiseHg on winXP, so I won't be able to tell you what hg calls were internally made, but I don't think anything fancy is used here.

我从一个现有的仓库开始,在其中有一个plugins/目录,其中装有plugin1/plugin/2目录(不是存储库,只是简单的目录). 我还在线托管了这些插件,这些插件托管在BitBucket上.

I started with an existing repo, inside which I had a plugins/ directory filled with plugin1/, plugin/2 directories (not repositories, just simple directories). I also had those plugins online, hosted on BitBucket.

  • 我首先进入plugins/目录,右键单击plugin1/TortoiseHg => Remove Files.
  • 我回到仓库的根目录,右键单击并Hg Commit
  • 然后我回到我的plugins/目录,右键单击TortoiseHg => Clone...,我在位存储桶(http://bitbucket.org/username/plugin1/上选择了插件的http地址,然后单击了Done
  • 再次回到主仓库的根.我创建了一个.hgsub文件(如果文件已经存在,则进行了编辑),并在其中添加了plugins/plugin1 = plugins/plugin1行.
  • 然后我可以独立地提交主root存储库或plugin1存储库
  • I first went to my plugins/ directory, right click on plugin1/, TortoiseHg => Remove Files.
  • I get back to the root of my repo, right click and Hg Commit
  • Then I went back to my plugins/ directory, right click, TortoiseHg => Clone..., I selected the http address of the plugin on bit bucket (http://bitbucket.org/username/plugin1/ and clicked Done
  • The back again to the root of the main repo. I created (or edited if the file already existed) a .hgsub file and add the plugins/plugin1 = plugins/plugin1 line inside it.
  • I was then able to either commit the main root repo, or the plugin1 repo independently

请注意,仅当新克隆的仓库与已跟踪目录的名称相同时,才需要执行额外的removecommit步骤.

Note that the extra remove and commit steps are only required if the newly cloned repo has the same name of an already tracked directory.

这篇关于使用Mercurial/TortoiseHg处理嵌套的汞储存库的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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