2012-09-23 41 views
2

我想從Google Code和Mercurial遷移到Git和GitHub,同時保留所有分支機構和版本歷史記錄。將Mercurial遷移到GitHub

到目前爲止,它似乎是Hg-Git mercurial插件(http://hg-git.github.com/)是我唯一的選擇。我試圖按照安裝說明進行操作,但在我的腦海中有一點點。這裏就是我:

[extensions] 
hgext.bookmarks = 
hggit = 

現在我運行時:

C:\Python27\Scripts>easy_install.exe hg-git 

我得到如下:

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 

然後一堆看起來像這樣的錯誤:

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 

不知道下一個嘗試的東西。我也嘗試了以下來自Cloning github repo with hggit的提示,但我錯過了一些明顯的東西。任何幫助將不勝感激。

+1

你有看過:[在Windows上將Mercurial(hg)存儲庫轉換爲Git(7)](http://stackoverflow.com/questions/3267232/converting-a-mercurial-hg-repository-to -git式窗口-7)? –

+1

我記得我使用Tailor(http://progetti.metapensiero.it/tailor)進行了一些存儲庫轉換。 – liori

回答

2

就草案和一些注意事項&想法:

  • 爲了使用TortoiseHG(在Windows上,如果它的問題XP SP3)Python是不是強制性的 - 我有沒有的Python/setuptools的/ PIP THG工作
  • TortoiseHG(32bit64bit)從到位桶是自給自足的水銀在Windows世界
  • 我手寫的HG-git的擴展我的TortoiseHG

\ TortoiseHg \插件> DIR/B

HG-git的

...

  • 將hg-git擴展添加到全局mercurial.ini(Documents and Settings \ Badger \ mercurial.ini)

[擴展]

...

hggit = C:\ PROGRAM Files_Tools \ TortoiseHg \插件\ hggit \ hggit

...

  • 書籤擴展,默認的擴展,與THG捆綁,啓用在一些版本的GUI,可以在mercurial.ini中找到現在bookmarks =沒有相應的複選框在設置 - 擴展

  • 與功能hg-git在TortoiseHG(克隆,拉,膿不爲錯誤^ h一些Git的回購),你可以嘗試外部水銀回購

    • 克隆CG水銀回購轉換爲外部的Git回購本地​​(水銀)回購
    • 在Github上創建新的空混帳回購協議(驗證身份驗證和其他可能的問題)
    • 添加第二個遠程回購(GUI - 「同步」選項卡,手動 - 在[paths]部分回購的.hg \ hgrc中的新字符串),僅限於我git+ssh://[email protected]/username/reponame.git URL(通過基於密鑰的身份驗證PageAnt)是透明的解決方案
    • push local re PO到Github上
    • 樂趣

截圖是在GitHub上我積極的Git回購只是例子,試圖通過實時源

Fiver Repo

+0

感謝@Badger瞭解詳情。首先,通過mercurial.ini中的'hgsubversion',我假設你的意思是'hggit'。現在我還有一點點。當我在THG中輸入「%hg help hggit」時,我會得到「hggit擴展名 - 沒有可用的幫助文本」。所以我假設擴展是好的。但是當我嘗試從github克隆時,我得到了「No module named gitrepo」。有任何想法嗎? –

+1

@LeeRichardson - 1.是的,hgsubversion是我的拼寫錯誤 - 我從複製和粘貼塊中刪除了錯誤的行2. hggit **非常基本的**幫助可以通過(驚喜!!!)'hg help git'達到3.在github遊戲之前(而不是克隆,我總是使用* only pull | push * pair),檢查hg-git在另一個repo上的工作 –

+0

@Badger一直在爲此工作幾天,沒有運氣。我現在可以克隆並拉好(過時的THG導致問題)。雖然推動不起作用。當我嘗試推送到github('hg push git + ssh://[email protected]/lprichar/SirenOfShame.git')時,我得到「中止:句柄無效」。推到當地的git倉庫時,我會得到同樣的結果。我需要包含添加德威到THG莫名其妙嗎?我需要配置TortoiseHg以使用TortoisePlink.exe進行ssh嗎?非常感謝你的幫助。 –

0

我也掙扎來說明我的話與hg-git。我想出了一個奇怪的解決方案。

我進口hg回購https://import.github.com/new 這並不奇怪,一定是你要找的。


怪異和獎金部分低於:

  • 我創建了一個汞鏡子回購上http://bitbucket.org
  • 我的git倉庫內的本地汞庫。
  • 我加.hg/.gitignore
  • 添加.hg/.git/.gitignore文件 .git/ .hg/
  • 輸入本地回購的.hg目錄,並與

    $ LN -s符號連接您的.gitignore文件作爲.hgignore。 ./.gitignore .hgignore

  • 現在對您的所做的任何更改也被認爲是由hg

    $ git add。gitignore -am 'gitignore'

    $汞添加的.gitignore -AM '不要忘記符號鏈接的.gitignore爲.hgignore在.hg /文件夾'

    $汞柱推默認

    $混帳推起源掌握

結論:雖然看起來效率不高,問題就出在不損失汞回購和數據庫github上的優勢,並給出了機會,同時使用githg