作为git remotes访问hg存储库

git-remote-hg3的Python项目详细描述


你是一个git迷,但需要在mercurial repos中托管项目吗? 你是否太固执、懒惰或不适应学习另一个风投工具?我 知道我是。但不要害怕!这个脚本将允许您与mercurial交互 存储库就好像它们是普通的git遥控器一样。

git允许通过helper脚本插入远程存储库协议。如果你 有一个名为“git remote xxx”的脚本,然后git将使用它与 远程存储库的url格式为xxx::此处为一些url。所以你 可以想象一个名为git remote hg的脚本会做什么。

是的,此脚本提供了一个远程存储库实现,它可以 用水银。安装后,您可以执行以下操作:

$ git clone hg::https://hg.example.com/some-mercurial-repo
$ cd some-hg-repo
$ # hackety hackety hack
$ git commit -a
$ git push

塔达!您从git提交的内容将显示在远程mercurial repo中,并且 你的同事都不会比你聪明。

git和mercurial之间的所有互操作都是由 很棒的hg git模块。说出git远程助手的所有辛苦工作 协议是由git自己的http协议处理程序完成的。这个剧本很烂 他们一起工作,让一切都变得容易一点。

对于每个远程mercurial存储库,实际上可以获得2附加的 隐藏在本地git repo中的存储库:

  • .git/hgremotes/[URL]: a local hg clone of the remote repo
  • .git/hgremotes/[URL]/.hg/git: a bare git repo managed by hg-git

当您从本地git repo“git push”到远程mercurial repo时, 以下是git remote hg将为您提供的功能:

  • use git-remote-http to push into .git/hgremotes/[URL]/.hg/git
  • call “hg gimport” to import changes into .git/hgremotes/[URL]
  • call “hg push” to push them up to the remote repo

同样,当您从远程mercurial repo“git pull”到本地 Git Repo,下面是引擎盖下发生的事情:

  • call “hg pull” to pull changes from the remote repo
  • call “hg gexport” to export them into .git/hgremotes/[URL]/.hg/git
  • use git-remote-http to pull them into your local repo

丑?当然。黑?当然。但似乎效果非常好。

顺便说一下,显然有一个git remote hg的本机实现 开发中的命令:

https://plus.google.com/115991361267198418069/posts/Jpzi24bYU91

因为git远程助手协议非常简单,所以应该可以 在这个实现和这个实现之间来回切换 麻烦。

警告:

  • Pushing multiple branches into the remote is currently broken.

    hg-git seems to map git branches onto mercurial bookmarks, but I’m not sure of all the details. I don’t need it so I haven’t tried to make it work. Don’t do it.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
带有接口参数的java反射和构造函数   java Spring Thymeleaf如何通过Thymeleaf表单编辑(更新)用户选择的实体(对象)?   Java Tapestry中不同类之间的静态、非静态和调用   java如何使用dojo 1.9显示地理地图   安卓如何在java中简化这个代码片段?   尝试将java spring应用程序部署到Oracle weblogic群集java时出错。lang.ArrayIndexOutofBounds异常:52304   java如何在标头中包含SOAP身份验证详细信息?   java使用流删除一个列表中的元素(如果存在于另一个列表中)   java如何将包含UTC时间的字符串(如“193526”(19:35:26)转换为本地时区?   java部署Grailsgenerated WAR文件的最简单方法是什么?   java使用两种类型向通用列表添加对象   java如何在安卓应用程序中保存应用程序数据?   java有人能帮我弄清楚如何从“:”(不包括)读取我的文件直到行尾吗?   java在org上找不到javadoc。日食团队svn anywhere