2012-02-20 132 views
6

我們的項目中有幾個遠程subrepos,他們的地址最近已從http://host/path移動到http://other_host/path。怎麼能回到上個月的修正版,比如說Mercurial認爲subrepo可以在http://host/path找到?更新到已遷移的subrepos的舊版Mercurial版本

$ hg -v up -d 1/20/2012 
Found revision 1091 from Fri Jan 20 10:22:29 2012 -0600 
resolving manifests 
abort: error: No connection could be made because the target machine actively refused it 


$ hg --debug up -d 1/20/2012 
Found revision 1091 from Fri Jan 20 10:22:29 2012 -0600 
resolving manifests 

<snip...> 

subrepo merge 0f0f2b807811+ 0908d5249a6f 0f0f2b807811 
    subrepo external/our_remote_repo: both sides changed, merge with https://old_host/external/our_remote_repo:c66cf52ce1f240193190cec392d889618c09f22b:hg 
using https://old_host/external/our_remote_repo 
sending capabilities command 
using auth.old_host.* for authentication 
abort: error: No connection could be made because the target machine actively refused it 

回答

6

根據documentation,您可以使用hgrc中的[subpaths]至remap such urls

這歸結爲限定重寫規則中的

<pattern> = <replacement> 

的形式,其中圖案是一正則表達式匹配的源和替換是用來重寫替換字符串subrepositories源位置。組可以在模式中匹配並在替換中引用。例如:

http://server/(.*)-hg/ = http://hg.server/\1/ 

重寫

http://server/foo-hg/ into http://hg.server/foo/. 
+0

真棒,謝謝 – moswald 2012-02-21 16:22:16

-5

你不能這樣做。 Mercurial返回狀態,它正好在本次修訂中(subrepo的URL,subrepo中的修訂版)

+2

@michel Sznajder的解決方案將工作得很好。 – 2012-02-21 01:41:30

相關問題