Until very recently, I've been using the bundled hg convert extension to
convert an rsynced copy of the full gcc repo to mercurial. This has two
major disadvantages:
* The process is very slow, i.e. it can take more than half an hour even
for only a few revs.
* It's a one-way thing, so I have to apply maintained using mq
(mercurial queues) to an svn checkout manually, which before
subversion 1.7 that can deal with git-style patches is extremely
tedious and error-prone for patches with lots of renames, adds and and
remove like the libgcc ones.
I've therefore switched to the (yet external) hgsubversion extension,
which provides a two-way gateway to svn. Unfortunately, one thing goes
wrong (or actually has changed from the previous process): while hg
convert used hg branches to map branches in the svn repo, with
hgsubversion you usually only check out the branches you're interested
in, where hg branch always returns `default'. The code in gcc_update
assumed the old model, so had to change:
With both ways, the output of hg log --debug looks like this:
extra: branch=gcc-4_6-branch
extra:
convert_revision=svn:138bc75d-0d04-0410-961f-82ee72b054a4/branches/gcc-4_6-branch@177861
extra: branch=default
extra:
convert_revision=svn:138bc75d-0d04-0410-961f-82ee72b054a4/trunk@177984
I'm now ignoring hg branch and extract both branch and svn revision from
this. The patch below has been tested by running gcc_update on both
trunk and 4.6 branch checkouts.
Ok for mainline?
Rainer
2011-08-23 Rainer Orth <[email protected]>
* gcc_update: Determine svn branch from hg convert_revision.
# HG changeset patch
# Parent 0e159d056c346e038491cc1d9aa2adaa8f7411ea
Don't assume hg convert in gcc_update
diff --git a/contrib/gcc_update b/contrib/gcc_update
--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -340,14 +340,13 @@ case $vcs_type in
# corresponding to the extra: tag, so need to use hg log --debug
# to extract the info.
parents=`$GCC_HG parents --template '{rev}'`
- revision=`$GCC_HG log --debug -r$parents | \
+ convert_revision=`$GCC_HG log --debug -r$parents | \
sed -ne "/^extra:.*convert_revision=svn:/ {
- s%^.*@%%
+ s%^[^/]*/%%
p
}"`
- branch=`$GCC_HG branch`
- # trunk in SVN parlance shows up as default branch in hg.
- [ x$branch = x"default" ] && branch="trunk"
+ revision=`echo $convert_revision | sed -e 's/.*@//'`
+ branch=`echo $convert_revision | sed -e 's%branches/%%' -e 's/@.*//'`
;;
svn)
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University