Mercurial 嵌套回购问题
我不小心在另一个存储库的子目录中创建了一个存储库,
因为这样做,子存储库现在包含许多提交,
当我在原始(父?)存储库上尝试 hg st 时,我意识到我的错误,并且它抱怨文件被在嵌套存储库中
我想做的是以某种方式将子存储库历史记录移动到父存储库中,然后删除子存储库,这样我只有一个存储库
目录结构如下:
我的原始存储库:
core/
包含源代码的目录我正在尝试版本控制:
core/src/
core/test/
我的意外仓库位于:
core/src/
例如,我想推送这个?/合并?进入 core/
存储库,然后只需删除 core/src/
存储库(通过删除 .hg 目录)
我已经阅读了一些关于此的堆栈溢出讨论但他们似乎正在尝试解决更复杂的子回购场景。我希望可能存在一个简单的(我敢说很简单)解决方案吗?
我在 HG wiki 上也没有什么运气
I have accidentally created a repo in a sub directory of another repo
Since doing this the sub repo now contains a number of commits
I realised my mistake when I attempted an hg st on the original (parent?) repo and it complained of a file being inside a nested repo
What I would like to do is somehow move the sub repo history up into the parent then just delete the sub repo so I have just one repo
The dir structure is like this:
my original repo:
core/
my directories containing src code i'm trying to version control:
core/src/
core/test/
my accidental repo is in:
core/src/
e.g. its this one I want to push?/merge? up a level into the core/
repo, then just kill the core/src/
repo (by deleting the .hg dir)
I have read a few stack overflow discussions on this but they seem to be trying to solve more complicated sub repo scenarios. I'm hoping a straightforward (dare i say it simple) solution may exist?
I have not had much luck with the HG wiki on this either
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
保留历史记录
根据您使用的版本,您可以使用 移植 或 移植扩展以实现您的目标。
我从来没有这样做过,也没有时间事先测试它,但是类似以下步骤的操作应该有效:
core/src/
目录移动到其他地方,例如~/temp.subrepo/
.hgsub
文件中删除子存储转换子存储库,你可以使用这样的东西:
就像我说的,我不确定这是否会开箱即用,但它至少是一个线索。如果您有任何问题,请随时询问。
历史并不重要
或者也许最简单的解决方案就是删除子存储库中的 .hg 目录,删除主存储库的 .hgsub 文件中任何提及子存储库的内容存储库,只需添加并提交文件:
您将丢失子存储库的所有历史记录,但至少解决方案非常简单。
Preserving history
Depending on the version you're using, you can use the Transplant or Graft extension to achieve your goal.
I've never done that and don't have time to test it before hand, but something like the following steps should work :
core/src/
dir somewhere else, for example~/temp.subrepo/
.hgsub
fileTo convert the subrepo, you can use something like this :
Like I said, I'm not sure this will work out of the box, but it's at least a lead. If you have any problem, don't hesitate to ask.
History doesn't matter
Or maybe the simplest solution is just to remove the
.hg
directory in the subrepo, remove any mention of the subrepo in the.hgsub
file of the main repo, and just add and commit the files :You will lose all the history of the subrepo, but at least the solution is really simple.