汞栓剂

发布于 2024-12-13 20:00:13 字数 770 浏览 0 评论 0原文

我有一个关于栓剂的问题。我们的项目设置如下:

+ projectA
    + some files
    + dependencyA
        + some files

dependencyA 是一个子存储库。它是这样创建的:

  1. cd projectA
  2. mkdir dependencyA
  3. cd dependencyA
  4. hg init
  5. hg pull ssh://hg@somerandomiphere/dependencyA
  6. cd ..
  7. echo dependencyA = ssh://hg@somerandomiphere/dependencyA > .hgsub
  8. hg add
  9. hg commit
  10. hg push

如果我对suprepository进行更改,则从主项目提交并推送它们。由于递归,它们都会被推送到服务器。现在我的同事想从服务器中提取更改。但由于主项目没有任何改变,所以它不起作用。但是如果我更改主项目中的某些内容并将其推送到服务器。在 hg pull 后,他将获得最新的变更集,如果他执行 hg update,它也会更新子存储库。这是预期的行为。

现在我的问题是,是否有一种方法可以提取更改,但用于子存储库而不对其进行新的克隆,或者最好的方法是什么。

I have got a question regarding suprepositories. Our project is set up like this:

+ projectA
    + some files
    + dependencyA
        + some files

dependencyA is a subrepository. It was created this way:

  1. cd projectA
  2. mkdir dependencyA
  3. cd dependencyA
  4. hg init
  5. hg pull ssh://hg@somerandomiphere/dependencyA
  6. cd ..
  7. echo dependencyA = ssh://hg@somerandomiphere/dependencyA > .hgsub
  8. hg add
  9. hg commit
  10. hg push

If I make changes to the suprepository, then commit and push them from main project. Both of them will be pushed to the server since its recursive. Now my colleague wants to pull changes from the server. But since nothing was changed in the main project, it wont work. But if I change something in the main project and push it to server. Upon hg pull he will get the newest changeset and if he does hg update then, it will update the subrepository as well. This is expected behaviour.

Now my question would be, if there is a way to pull changes, but only for subrepository without making a new clone of it or what would be the best way to do it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

永言不败 2024-12-20 20:00:13

Mercurial wiki 中的子存储库,第 14 页2.5“拉动”

“pull”命令默认不是递归的。这是因为
Mercurial 在更新之前不会知道需要哪些子存储库
请求特定的变更集。更新将拉取请求的
按需子存储库和变更集。获取并更新
第一步,使用“pull --update”。

请注意,这与“拉”的工作方式完全匹配,无需
子存储库,考虑到子存储库存在于工作中
目录:

  • “hg pull”为您提供上游变更集,但不会影响您的工作目录。
  • “hg update”更新工作目录的内容(包括顶级存储库和所有子存储库)

如果有的话,总是使用 --update 可能是个好主意
子存储库。这通常可以确保更新不会错过
任何变更集和更新都不会导致任何拉取。如果
由于交叉分支,更新拉取失败,则必须“hg update”
用于获取所有子存储库更新。

Subrepository in Mercurial wiki, p. 2.5 "Pull"

The 'pull' command is by default not recursive. This is because
Mercurial won't know which subrepos are required until an update to a
specific changeset is requested. The update will pull the requested
subrepositories and changesets on demand. To get pull and update in
one step, use 'pull --update'.

Note that this matches exactly how 'pull' works without
subrepositories, considering that subrepositories lives in the working
directory:

  • 'hg pull' gives you the upstream changesets but doesn't affect your working directory.
  • 'hg update' updates the contents of your working directory (both in the top repo and in all subrepos)

It might be a good idea to always pull with --update if you have any
subrepositories. That will generally ensure that updates not will miss
any changesets and that update thus not will cause any pulls. If the
pull with update fails due to crossing branches then 'hg update' must
be used to get all the subrepository updates.

憧憬巴黎街头的黎明 2024-12-20 20:00:13

上面建议的效果就像我想象的那样。真正的问题是我创建子存储库的方式。

而不是:

  1. cd projectA
  2. mkdir
  3. dependencyA
  4. cd dependencyA
  5. hg init
  6. hg pull ssh://hg@somerandomiphere/dependencyA

它应该是一个简单的:

  1. hg clone ssh://hg@somerandomiphere/dependencyA dependencyA

正如我们所知 .hgsusbtate< /code> 将在提交后锁定特定修订版的子存储库。这就是发生的事情,但是(!)在子存储库中执行hg pull并以错误结束

paths cannot contain dot file components

所以这意味着我的子存储库被锁定在提交后更新的修订版上并且它不能 由于上面显示的错误,从其存储库中提取更改。为什么发生这种情况在这个 接受答案

解决方案:

克隆是出路

What was suggested above works like I thought it would. The real problem was my way of creating a subrepository.

Instead of:

  1. cd projectA
  2. mkdir
  3. dependencyA
  4. cd dependencyA
  5. hg init
  6. hg pull ssh://hg@somerandomiphere/dependencyA

It should have been a simple:

  1. hg clone ssh://hg@somerandomiphere/dependencyA dependencyA

As we know .hgsusbtate will lock the subrepo on specific revision after commit. This is what happened, but (!) doing hg pull in subrepository ended with an error

paths cannot contain dot file components

So this means my subrepo was locked on the revision it was updated after commit and it could not pull changes from its repository due to the error shown above. Why this happened is explained pretty well in this accepted answer.

Solution:

cloning is the way to go

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文