将Mercurial迁移到GitHub [英] Migrating Mercurial to GitHub
问题描述
我想从Google Code和Mercurial转移到Git和GitHub,同时保留所有分支机构和版本历史记录。
到目前为止,它好像是Hg-Git mercurial插件( http://hg-git.github.com/ )是我唯一的选择。我试图按照安装说明进行操作,但在我的脑海中有一点点。这里是我的位置:
[extensions]
hgext.bookmarks =
hggit =
现在当我运行时:
C :\Python27\Scripts> easy_install.exe hg-git
我得到以下结果:
寻找hg-git
最佳匹配:hg-git 0.3.3
处理hg_git-0.3.3-py2.7。 egg
hg-git 0.3.3已经是easy-install.pth中的活动版本
使用c:\\\\python27\lib\site-packages\hg_git-0.3。 3-py2.7.egg
处理hg-git的依赖关系
搜索dulwich> = 0.8.0
读取http://pypi.python.org/simple/dulwich/
阅读http://samba.org/~jelmer/dulwich
阅读http://launchpad.net/dulwich
最佳匹配:dulwich 0.8.5
下载http:// samba .org /〜jelmer / dulwich / dulwich-0.8.5.tar.gz
处理dulwich-0.8.5.tar.gz
运行dulwich-0.8.5 \setup.py -q bdist_egg - -dist-dir c:\users\lee\appdata\local\temp\easy_install-3qgeev\dulwich-0.8.5\egg-dist-tmp-ciyt_4
然后出现如下一些错误:
Traceback(大部分最近调用最后一次):
文件C:\Python27\Scripts\easy_install-script.py,第8行,位于< module>
load_entry_point('setuptools == 0.6c11','console_scripts','easy_install')()
文件C:\Python27\lib\site-packages\setuptools\command\\ \\ easy_install.py,第1712行,在主
with_ei_usage(lambda:
文件C:\Python27\\lib\site-packages\setuptools\command\easy_install.py ,第1700行,with_ei_usage
返回f()
文件C:\Python27\lib\site-packages\setuptools\command\easy_install.py,第1716行,在< lambda>
distclass = DistributionWithoutHelpCommands,** kw
在设置
dist中,文件C:\Python27\lib\distutils\core.py,行152。 run_commands()
run_commands中的文件C:\Python27\lib\distutils\dist.py,第953行
self.run_command(cmd)
文件C: \Python27\lib\distutils\dist.py,第972行,在run_command中
cmd_obj.run()
文件C:\Python27 \lib\site-packages\setuptools\command\easy_install.py,第211行,运行
self.easy_install(spec,not self.no_deps)
文件C:\\ \\ python27 \lib\site-packages\setuptools\command\easy_install.py,行446,在easy_install
中返回self.install_item(spec,dist.location,tmpdir,deps)
在install_item
self.process_distribution(spec,dists [0],deps)文件C:\Python27\lib\site-packages\setuptools\command\easy_install.py,第481行,Using)
文件C:\Python27\lib\site-packages\setuptools\command\easy_install.py,第519行,在process_distribution
[requirements]中, self.local_index,self.easy_install
文件C:\Python27\lib\site-packages\pkg_resources.py,第563行,解析
dist = best [req.key] = env.best_match(req,self,installer)
文件C:\Python27\lib\site-packages\pkg_r esource.py,第799行,在best_match
返回self.obtain(req,installer)#尝试并下载/安装
不知道接下来要尝试什么。我也尝试了使用hggit克隆github repo 的提示,但我错过了一些明显的东西。任何帮助将不胜感激。
只是草稿和一些笔记和想法:
- 为了使用TortoiseHG(在Windows上,XP SP3,如果有的话)Python不是强制性的 - 我在没有Python的情况下使用THG / setuptools / pip
- TortoiseHG( 32bit a>或 64位 )在BitTools中是自给自足的Mercurial
- 我手动添加hg-git扩展到我的TortoiseHG
- 从 bitbucket回购克隆hg-git到本地目录$ / $>
- 从 bitbucket回购克隆hg-git到本地目录$ / $>
\TortoiseHg\plugins> dir / B
hg-git
...
- 将hg-git扩展插入到全局mercurial.ini (Documents and Settings\Badger\mercurial.ini)
[extensions]
...
hggit = c:\ Program Files_Tools\TortoiseHg\plugins\hg-git\ hggit
...
-
书签扩展作为默认扩展,与THG捆绑在一起,在某些版本的GUI中启用,现在可以在
书签= 的mercurial.ini中找到,而在设置中没有相应的复选框 - 扩展 -
通过TortoiseHG中的功能hg-git(克隆,拉动,无错地推送某些Git-repo)尝试将外部Mercurial回购转换为外部Git回购
- 克隆CG Mercurial回购到本地(Mercurial)回购
- 在Github上创建新的空Git回购(验证authentificati on和其他可能的问题)
- 添加第二个远程回购(GUI - 同步选项卡,手工 - 新的字符串在
[paths]
部分在repo的.hg \ hgrc中),对于我来说只有git + ssh://git@github.com/username/reponame.git
URL(使用基于键通过PageAnt验证)是透明的解决方案 li>
屏幕截图仅仅是我在GitHub上的活动Git回购的示例,并尝试通过实时源解释我的话
I want to move from Google Code and Mercurial to Git and GitHub while keeping all branches and version history.
So far it seems like the Hg-Git mercurial plugin (http://hg-git.github.com/) is my only option. I tried to follow the install instructions but am in a little over my head. Here's where I am:
- I installed Microsoft Visual C++ 2008
- I installed Python 2.7.3
- I installed setuptools
- I added the following to my mercurial.ini in TortoiseHg:
[extensions] hgext.bookmarks = hggit =
Now when I run:
C:\Python27\Scripts>easy_install.exe hg-git
I get the following:
Searching for hg-git Best match: hg-git 0.3.3 Processing hg_git-0.3.3-py2.7.egg hg-git 0.3.3 is already the active version in easy-install.pth Using c:\python27\lib\site-packages\hg_git-0.3.3-py2.7.egg Processing dependencies for hg-git Searching for dulwich>=0.8.0 Reading http://pypi.python.org/simple/dulwich/ Reading http://samba.org/~jelmer/dulwich Reading http://launchpad.net/dulwich Best match: dulwich 0.8.5 Downloading http://samba.org/~jelmer/dulwich/dulwich-0.8.5.tar.gz Processing dulwich-0.8.5.tar.gz Running dulwich-0.8.5\setup.py -q bdist_egg --dist-dir c:\users\lee\appdata\local\temp\easy_install-3qgeev\dulwich-0.8.5\egg-dist-tmp-ciyt_4
And then a bunch of errors that look like this:
Traceback (most recent call last): File "C:\Python27\Scripts\easy_install-script.py", line 8, in <module> load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')() File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1712, in main with_ei_usage(lambda: File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1700, in with_ei_usage return f() File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1716, in <lambda> distclass=DistributionWithoutHelpCommands, **kw File "C:\Python27\lib\distutils\core.py", line 152, in setup dist.run_commands() File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "C:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 211, in run self.easy_install(spec, not self.no_deps) File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 446, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 481, in install_item self.process_distribution(spec, dists[0], deps, "Using") File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 519, in process_distribution [requirement], self.local_index, self.easy_install File "C:\Python27\lib\site-packages\pkg_resources.py", line 563, in resolve dist = best[req.key] = env.best_match(req, self, installer) File "C:\Python27\lib\site-packages\pkg_resources.py", line 799, in best_match return self.obtain(req, installer) # try and download/install
Not sure what to try next. I also tried following tips from Cloning github repo with hggit but I'm missing something obvious. Any help would be greatly appreciated.
解决方案Just draft and some notes&thoughts:
- In order to use TortoiseHG (on Windows, XP SP3 if it matter) Python is not mandatory - I work with THG without Python/setuptools/pip
- TortoiseHG (32bit or 64bit) from Bitbucket are self-sufficient Mercurial in Windows-world
- I added hg-git extension to my TortoiseHG by hand
- cloned hg-git from bitbucket repo into local dir
\TortoiseHg\plugins>dir /B
hg-git
...
- added hg-git extension to global mercurial.ini (Documents and Settings\Badger\mercurial.ini)
[extensions]
...
hggit = c:\Program Files_Tools\TortoiseHg\plugins\hg-git\hggit
...
bookmarks extension, as default extension, bundled with THG, was enabled in GUI some versions ago and can be found in mercurial.ini now as
bookmarks =
without corresponding checkbox in Settings-ExtensionsWith functional hg-git in TortoiseHG (clone, pull, push without errors for some Git-repo) you can try to convert external Mercurial repo to external Git repo
- clone CG Mercurial repo to local (Mercurial) repo
- create new empty Git repo on Github (verify authentification and other possible issues)
- add second remote repo (GUI - "Synchonize" tab, by hand - new string in
[paths]
section in repo's .hg\hgrc), for me onlygit+ssh://git@github.com/username/reponame.git
URL (with key-based authentification over PageAnt) is transparent solution - push local repo to github
- Have Fun
Screenshot is just example of my active Git repo on GitHub and attempt to illustrate my words by a live source
这篇关于将Mercurial迁移到GitHub的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!