简体   繁体   English

“Hg到Hg(Gateway)到SVN”与“Git to Git(Gateway)到SVN”相比

[英]“Hg to Hg (Gateway) to SVN” compared to “Git to Git (Gateway) to SVN”

Question is similar to this (unanswered) and this one (same problem not involving Git). 问题类似于 (未答复)和问题(同样的问题不涉及Git)。

The goal is to make Hg a front end for SVN for a period of time before transitioning fully to Hg. 我们的目标是使Hg为SVN前端一段时间完全过渡到汞之前。

The setup should probably look like the one depicted below (same as in the questions referenced above), however I'm not sure about the exact topology of intermediate Hg repositories. 设置可能看起来如下所示(与上面提到的问题相同),但是我不确定中间Hg存储库的确切拓扑。

Dev1 Hg --> Hg <--> SVN
Dev2 Hg -/

I know that the above setup works with git and git-svn as described in this comment : 我知道上面的设置适用于gitgit-svn ,如本评论中所述

Dev1 Git --> Git (bare) <--> Git (bridge) <--> SVN
Dev2 Git -/

Setup: 建立:

  1. Either git svn init , or git svn clone the SVN repo. 无论是git svn init ,还是git svn clone SVN repo。 This then becomes the “Git/SVN Bridge.” 然后它成为“Git / SVN Bridge”。

  2. Fix up any of the branches, tags, etc… here. 修复任何分支,标签等...这里。 The svn/* refs are considered remotes, so if you want tracking branches, check these remotes out and create appropriate local branches. svn/* refs被认为是遥控器,所以如果你想跟踪分支,请检查这些遥控器并创建适当的本地分支。 Also, check the tags out, and create actual tags. 另外,检查标签,并创建实际标签。 You MUST create local branches for any SVN branches that you wish to synchronize between Git and SVN. 您必须为要在Git和SVN之间同步的任何SVN分支创建本地分支。

  3. Now, create a new bare repository ( git init ) somewhere, and from the bridge, push all the branches to the bare repo ( git push –tags ). 现在,在某处创建一个新的裸存储库( git init ),并从桥中将所有分支git push –tags裸存储库( git push –tags )。

  4. All Git users now clone this bare repository. 所有Git用户现在克隆这个裸存储库。 The bridge will only be maintained by one (or a few) people that understand how to synchronize Git and SVN. 该桥只由一个(或几个)了解如何同步Git和SVN的人维护。

To update SVN trunk with changes on master, and vice-versa, from the bridge: 要通过网桥更改主服务器上的SVN中继,反之亦然:

  1. git svn fetch (get new SVN changes) git svn fetch (获取新的SVN更改)

  2. git checkout master

  3. git pull master (get Git changes from bare repo) git pull master (从裸仓库中获取Git更改)

  4. git checkout svn/trunk (checkout detached head) git checkout svn/trunk (checkout detached head)

  5. git merge –no-ff –log master (merge changes from master). git merge –no-ff –log master (从master更改合并)。 –no-ff insures an actual commit, –log copies individual log messages from each commit on master ( –log is optional). –no-ff确保实际提交, –log从master上的每个提交复制单个日志消息( –log是可选的)。 git commit –amend can then be run if you want to edit the commit message. 如果要编辑提交消息,则可以运行git commit -amend。

  6. git svn dcommit (This pushes your merge commit to SVN. Note that the commit was on a detached head, and is no longer accessible). git svn dcommit (这会将你的合并提交推送到SVN。请注意,提交是在一个独立的头上,并且不再可访问)。 All of your work on master (since the merge-base of master and svn/trunk ) gets committed as a single change, and is now available to SVN users. 您在master上的所有工作(因为master和svn/trunk的merge-base)都作为单个更改提交,现在可供SVN用户使用。

  7. git checkout master

  8. git merge svn/trunk (Gets the new updates from SVN – with the altered commit message – and merges to master) git merge svn/trunk (从SVN获取新的更新 - 使用更改的提交消息 - 并合并到master)

  9. git push barerepo (makes the SVN changes available to Git users) git push barerepo (使git push barerepo用户可以使用SVN更改)

What I don't know is if it's possible to somehow replicate the above on Hg. 我不知道的是,是否有可能以某种方式在Hg上复制上述内容。 As I see it (I'm an intermediate Git user and know basics of working with Hg), the obstacles in Hg are: 正如我所看到的(我是Git的中间用户并且了解使用Hg的基础知识),Hg的障碍是:

  • no remote-tracking branches (is this possible with bookmarks ? separate cloned repos?) 没有远程跟踪分支(这可能与书签有关吗?单独克隆的回购?)
  • impossible to push merge commits via hgsubversion (step n. 6 in the above list. What stops hgsubversion from doing what svn dcommit does?) 不可能通过hgsubversion推送合并提交(上面列表中的步骤hgsubversion 。什么阻止hgsubversionsvn dcommit做什么?)

Is it possible to make the Hg-SVN gateway work in the same fashion the Git-SVN gateway works? 是否有可能使Hg-SVN网关以与Git-SVN网关相同的方式工作? If no, why? 如果不是,为什么?

The short version is: nobody's yet convinced me what the reasonable expected behavior of pushing a merge to Subversion should be, and there are some slight modifications to hgsubversion advisable to make pushing result in merges rather than rebased revisions. 简短的版本是:没有人确信我推出合并到Subversion的合理预期行为是什么,并且对hgsubversion有一些轻微的修改,建议推动合并而不是重新修订。 None of it should be too hard, just takes someone motivated to do the implementation. 这些都不应该太难,只需要有人动机去实施。 If you're curious, this thread has a similar request where I responded with a fairly in-depth discussion of the basic approach that I've thought through with a couple of others. 如果你很好奇, 这个帖子有一个类似的请求,我回答了一个相当深入的讨论我和其他几个人一起思考的基本方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 合并:Hg / Git与SVN - Merging: Hg/Git vs. SVN SVN在Mercurial中是否具有“hg clone”或Git中的“git clone”? - Does SVN have an equivalent for “hg clone” in Mercurial or “git clone” in Git? 是否有批量上传包含 git、svn、hg 文件的文件夹的功能? - Is there a feature to batch upload folders with files in git, svn, hg? Starteam到X迁移? (其中X是以下之一:svn / git / hg / bzr ...) - Starteam to X migration? (where X is one of: svn/git/hg/bzr …) 你会从 cvs 迁移到 svn 还是直接迁移到 git 或 hg? - Would you migrate from cvs to svn or directly to git or hg? 如何在SVN,Hg或Git中标记一组更改/更改集 - How can I mark a group of changes/changesets in SVN, Hg, or Git svn相当于hg in - svn equivalent to hg in 使用Git或Hg,如果整个团队使用来自中央服务器的pull and push,它与SVN有什么不同? - Using Git or Hg, if the whole team is using pull and push from a central server, how is it different from SVN? 是否存在与大多数版本控制系统兼容的版本控制gui(git,svn,hg,cvs,也许是bzr) - Does there exist a version control gui that is compatible with most version control systems (git, svn, hg, cvs, perhaps bzr) 我可以使用一个服务器来存储/管理SVN / Git / Hg / etc的版本控制吗? - Is there a single server I can use to store/manage version control for SVN/Git/Hg/etc?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM