作为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数据源问题“url”属性   网络化java多人游戏连接   Java当新字符串等于旧字符串时,为什么substring()不创建新对象?   一个实例到多个bean的java注入   JavaSpringMVC验证错误消息   java总结if语句,并从另一个对象(如字符串[])读取if条件(动态if)   需要多个输入的Java IF语句   jsf如何选择正确的bean范围?   java将数据库值加载到组合框JSP,Hibernate   一次活动中的java 3布局   团队和球员反对Java的困难   java ActionListener如何知道按下了哪个按钮?