This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] gcc_update: support updating a git clone


contrib/ChangeLog:

2010-03-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

	* gcc_update: Support updating a git clone.

Ok for trunk?

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 contrib/gcc_update |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/contrib/gcc_update b/contrib/gcc_update
index 3e5a842..d0a7642 100755
--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -239,8 +239,13 @@ p
 
 esac
 
+is_git=0
 # Check whether this indeed looks like a local SVN tree.
-if [ ! -d .svn ]; then
+if [ -d .git ]; then
+  GCC_GIT=${GCC_GIT-${GIT-git}}
+  GCC_SVN="true -"
+  is_git=1
+elif [ ! -d .svn ]; then
     echo "This does not seem to be a GCC SVN tree!"
     exit
 fi
@@ -252,6 +257,7 @@ else
     set -- $UPDATE_OPTIONS ${1+"$@"}
 fi
 
+if [ $is_git -eq 0 ]; then
 chat "Updating SVN tree"
 
 $GCC_SVN ${silent+-q}  --non-interactive update ${1+"$@"}
@@ -277,4 +283,23 @@ p
 
 echo "[$branch revision $revision]" > gcc/REVISION
 
+else
+  chat "Updating GIT tree"
+  $GCC_GIT stash ${silent+-q}
+  $GCC_GIT pull ${silent+-q} --rebase ${1+"$@"}
+  $GCC_GIT stash ${silent+-q} pop
+  if [ $? -ne 0 ]; then
+      (touch_files_reexec)
+      echo "git pull of full tree failed." >&2
+      exit 1
+  fi
+  rm -f LAST_UPDATED gcc/REVISION
+  revision=`$GCC_GIT log -n1 --pretty=%p:%t:%H`
+  branch=`$GCC_GIT branch | sed '/^[^\*]/d;/^\*/s|[\*]*[[:space:]]*||'`
+  {
+    date
+    echo "`TZ=UTC date` (revision $revision)"
+  } > LAST_UPDATED
+  echo "[$branch revision $revision]" > gcc/REVISION
+fi
 touch_files_reexec
-- 
1.7.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]