Patchwork [build] Fix gcc_update -r with mercurial

login
register
mail settings
Submitter Rainer Orth
Date Oct. 11, 2010, 7 p.m.
Message ID <yddmxqk1rmc.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/67473/
State New
Headers show

Comments

Rainer Orth - Oct. 11, 2010, 7 p.m.
When trying to update a mainline hg tree to an older revision to work
around a bootstrap failure, I noticed that gcc_update -rREV with
mercurial doesn't work.  Instead, one needs to separate the hg pull and
the hg update -rREV, which is exactly what this patch does.

Tested by running gcc_update with and without -r and observing that it
works as expected.

Ok for mainline?

	Rainer


2010-10-09  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* gcc_update: Run $GCC_HG pull and update separately.
	Check parents for SVN revision.
Paolo Bonzini - Oct. 12, 2010, 7:27 a.m.
On 10/11/2010 09:00 PM, Rainer Orth wrote:
> When trying to update a mainline hg tree to an older revision to work
> around a bootstrap failure, I noticed that gcc_update -rREV with
> mercurial doesn't work.  Instead, one needs to separate the hg pull and
> the hg update -rREV, which is exactly what this patch does.
>
> Tested by running gcc_update with and without -r and observing that it
> works as expected.
>
> Ok for mainline?

Ok.

Paolo

Patch

diff -r 250fd0cc5552 contrib/gcc_update
--- a/contrib/gcc_update	Sat Oct 09 17:24:40 2010 +0200
+++ b/contrib/gcc_update	Sat Oct 09 17:25:24 2010 +0200
@@ -311,17 +311,28 @@ 
 	# Update tree, but make sure to only pull the default branch.
 	# Otherwise all branches in the upstream repo are added, even if
 	# only a single one has been cloned.
-	$GCC_HG pull -u ${silent+-q} -r`$GCC_HG branch` ${1+"$@"}
+	$GCC_HG pull ${silent+-q} -r`$GCC_HG branch` ${1+"$@"}
 	if [ $? -ne 0 ]; then
             (touch_files_reexec)
             echo "hg pull of full tree failed." >&2
             exit 1
 	fi
 
-	# Extract SVN revision corresponding to tip, as stored by hg convert.
-	# Before hg 1.4.3, there's no template keyword corresponding to the
-	# extra: tag, so need to use hg log --debug to extract the info.
-	revision=`$GCC_HG log --debug -l1 | \
+	# Update tree.  Needs to be done separately from pull so
+	# gcc_update -rREV works.
+	$GCC_HG update ${silent+-q} ${1+"$@"}
+	if [ $? -ne 0 ]; then
+            (touch_files_reexec)
+            echo "hg update of full tree failed." >&2
+            exit 1
+	fi
+
+	# Extract SVN revision corresponding to parents, as stored by
+	# hg convert.  Before hg 1.4.3, there's no template keyword
+	# 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 | \
 	    sed -ne "/^extra:.*convert_revision=svn:/ {
 	        s%^.*@%%
 		p