适用于拥有多台机器的私人分支机构的 Mercurial 工作流程,为单个中央存储库提供服务
我有一个 svn 存储库,我想使用 Mercurial 作为它的前端。我一直在测试 hgsubversion,它看起来相当不错。
我通常必须在编写和测试代码时在机器之间切换,并且我希望能够以这样的方式检查我的东西(在分支上,mq,还不确定),以便我可以在其他机器上获取它,在那里编辑并推回等等,只有当我准备好时才将其推送到中央存储库。
在 git 中,我会使用临时私有分支来完成此操作,我会在计算机之间推送和拉取这些分支。然后我将重新定位回主分支并推送到中央存储库。但我仍在习惯 hg 完全不同的分支模型,并且我不知道众多选择中哪一个最有意义(克隆、命名分支 [它们是永久的?]、匿名分支、mq...
)给善变的新手的提示?
I have an svn repo, and I'd like to use Mercurial as a front-end to it. I've been testing hgsubversion and it seems pretty good.
I commonly have to switch between machines while writing and testing code, and I'd like to be able to check my stuff in (on a branch, mq, not sure yet) in such a way that I can get it on the other machines, edit there and push back and so on, and only when I'm ready push it to the central repo.
In git, I'd do this with temporary private branches that I'd push and pull between my machines. Then I'd rebase back onto the main branch and push to the central repo. But I'm still getting used to hg's quite different branching model and I don't see which of the many choices makes the most sense (clone, named branch [they're permanent?], anonymous branch, mq...)
Any hints for a mercurial newbie?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需对“中心”和“进行中”使用单独的存储库即可。让您的中央、有意义的存储库成为您推送准备与世界共享的更改的地方,并且在您准备好发布它们之前将它们推送到单独的“-devel”存储库。从你所有的机器上推动和拉动并升级 - 当你准备好时,通过“推动”进入正式状态。
如果您不希望生成的变更集必须与正在进行的变更集匹配,您可以在 devel 中使用一个本身版本控制的补丁队列 (mq),但我非常喜欢公开该过程结果,所以我不走那条路。
无论哪种方式,尽管推和拉是您所需要的,以保持正在进行的工作往返于 -devel 存储库(或版本化队列),然后在准备好时迁移到中央。
(对问题本身的评论中建议的 LocalBranch 扩展根本不是您想要的,因为它们根本不会在计算机之间迁移 - 因此它们的名字。)
Just use separate repos for "central" and "in progress". Have your central, meaningful repo be the place where you push changes you're ready to share with the world, and until you're ready to release them push them to a separate '-devel' repo. Push and pull to that from all your machines and promote -devel into formal with a 'push' when you're ready.
You can get fancier and use a patch queue (mq) in devel that is itself version controlled, if you don't want the resulting changesets to necessarily match your in-progress changesets, but I'm a fan of exposing the process as much as the result, so I don't go that route.
Either way though push and pull are all you need to keep in-progress work going to/from a -devel repo (or versioned queue) and then migrate up to central when you're ready.
(The LocalBranch extension suggested in a comment on the question itself isn't at all what you want as they don't migrate between machines at all -- hence their name.)
我通常做的是在 Mercurial 中使用书签或本地创建的命名分支。当本地命名分支被推送到 Subversion 时,它的名称将会丢失,并且书签无论如何都是暂时的。这可以让你避免大量的存储库并保持干净(呃)。
“在 svn 背后”推送和拉动有时可能会导致一组稍微令人困惑的修订,因为当您推送到 Subversion 时,哈希值必然会发生变化。
What I usually do is use bookmarks or locally-created nambed branches in Mercurial. The local named branch will lose its name when it gets pushed to Subversion, and the bookmark is transient anyway. That lets you avoid having tons of repositories laying around and keeps things clean(er).
Pushing and pulling "behind svn's back" can lead to a slightly confusing set of revisions from time to time, since hashes necessarily change when you push to Subversion.