Mercurial:我可以忽略推/拉文件但仍然提交吗? (.hgsub)
我有一个存储库,其中设置了两个子存储库,如下所示:
project/
|-- folder1
|-- folder2
|-- www [subrepo]
|-- dev [subrepo]
在机器 A 上,我检查了项目、www 和 dev,并修改了 .hgsub。 我必须提交此操作,以便 hg 能够识别 www 和 dev 子存储库(commit -S 等)。
然而,机器 B 仅使用项目的 www 功能,因此它看起来像这样:
project/
|-- folder1
|-- folder2
|-- www [subrepo]
同样,机器 B 中的 .hgsub 只有 www 的条目,我必须提交此条目以使 hg 将其识别为子存储库。
我想做的是推拉到我的中央存储库,但不推/拉 .hgsub。 否则,如果我从机器 A 提交并推送 .hgsub,然后从机器 B 拉取,我会自动获取我不想要的 dev 子存储库以及 www 子存储库。
所以我在机器B上再次修改.hgsub,使其只有www并提交以使其生效。 我在机器 B 上的 www 子存储库中做了一些工作,并希望将其推回到中央存储库,但它也会将更改推送到 .hgsub。现在,当我拉上机器 A 时,我的“dev”子存储库消失了,我必须再次将其添加回 .hgsub,我像这样来回移动,直到我沮丧地拔掉头发。
有什么办法可以解决这个问题吗? .hgsub 必须在每台计算机上本地提交,以便子存储库正常工作,但我不希望它们被推送或拉取。 是否有用于推/拉的 .hgignore?
干杯。
I have a repo with two sub-repos set up like this:
project/
|-- folder1
|-- folder2
|-- www [subrepo]
|-- dev [subrepo]
On Machine A, I have checked out project, www, and dev, and modified .hgsub as such.
I have to commit this in order for the www and dev subrepositories to be recognised by hg (commit -S, etc).
However Machine B only uses the www functionality of the project, so it looks like this:
project/
|-- folder1
|-- folder2
|-- www [subrepo]
Again, the .hgsub in Machine B only has an entry for www, and I have to commit this for hg to recognise it as a subrepo.
What I'd like to do is do push and pull to my central repo but NOT push/pull the .hgsub.
Otherwise, if I commit and push .hgsub from Machine A say, and then pull from Machine B, I automatically get the dev subrepo as well as the www subrepo that I don't want.
So I modify .hgsub again on Machine B to only have www and commit it for it to take effect.
I do some work in the www subrepo on Machine B and want to push back out to the central repo, but it will also push out the change to .hgsub. Now when I pull on Machine A, my 'dev' subrepo is gone and I have to add it back to .hgsub again, and I go back and forth like this until I pull my hair out in frustration.
Is there any way to get around this? .hgsub must be locally committed on each machine in order for the subrepos to work, but I don't want them to be pushed or pulled.
Is there a .hgignore for push/pull?
cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
推/拉不对文件进行操作,而是对变更集进行操作。
因此,无法推/拉部分变更集,要么推/拉它,要么不推/拉它。
如果您不希望存储库始终包含该文件/子存储库,那么您不应该这样组织您的项目。相反,您可能想考虑设置一个辅助项目,其中仅包含其他站点所需的子存储库。
换句话说,您可能会考虑拥有 2 个项目,一个包含所有子存储库,另一个仅包含几个子存储库。
A push/pull doesn't operate on files, it operates on changesets.
As such, there is no way to push/pull a partial changeset, either you push/pull it, or you don't.
If you don't want the repository to always contain that file/sub-repository, you shouldn't organize your projects like that. Instead you might want to look into setting up a secondary project with just the sub-repositories you need for that other site.
In other words, you might look into having 2 projects, one with all the sub-repos, the other with just a few.