Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating to old Mercurial revisions with subrepos that have moved

Our project has a couple of remote subrepos in it, and their addresses have recently moved from http://host/path to http://other_host/path. How can one go back to a revision from, say, last month, where Mercurial thinks the subrepo can be found at http://host/path?

$ 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
like image 368
moswald Avatar asked Feb 20 '12 17:02

moswald


1 Answers

According to documentation you can use [subpaths] in hgrc to remap such urls.

This boils down to defining subrepositories source locations rewriting rules in the form of

<pattern> = <replacement>

where pattern is a regular expression matching the source and replacement is the replacement string used to rewrite it. Groups can be matched in pattern and referenced in replacements. For instance:

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

rewrites

http://server/foo-hg/ into http://hg.server/foo/.
like image 50
Michal Sznajder Avatar answered Nov 08 '22 00:11

Michal Sznajder