[llvm-commits] [llvm-top] r62840 - in /llvm-top/trunk: info library.sh update

Duncan Sands baldrick at free.fr
Fri Jan 23 00:14:54 PST 2009


Author: baldrick
Date: Fri Jan 23 02:14:54 2009
New Revision: 62840

URL: http://llvm.org/viewvc/llvm-project?rev=62840&view=rev
Log:
Add support for projects held in a git repository.
Patch by Michael Schuerig.

Modified:
    llvm-top/trunk/info
    llvm-top/trunk/library.sh
    llvm-top/trunk/update

Modified: llvm-top/trunk/info
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/info?rev=62840&r1=62839&r2=62840&view=diff

==============================================================================
--- llvm-top/trunk/info (original)
+++ llvm-top/trunk/info Fri Jan 23 02:14:54 2009
@@ -36,8 +36,8 @@
 for mod in $MODULE_DEPENDENCIES ; do
   msg 0 "Information for module '$mod'"
   if test "$VERBOSE" -gt 0 ; then
-    svn info $mod
+    vcs_info $mod
   else
-    svn info $mod | sed -e '/^Repository/d' -e '/^Node/d' -e '/^Sched/d'
+    vcs_info $mod | sed -e '/^Repository/d' -e '/^Node/d' -e '/^Sched/d'
   fi
 done

Modified: llvm-top/trunk/library.sh
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/library.sh?rev=62840&r1=62839&r2=62840&view=diff

==============================================================================
--- llvm-top/trunk/library.sh (original)
+++ llvm-top/trunk/library.sh Fri Jan 23 02:14:54 2009
@@ -46,10 +46,20 @@
 
 # Define where subversion is. We assume by default its in the path.
 SVN=`which svn`
+GIT=`which git`
+
+vcs_info() {
+  local module="$1"
+  if test -d "$module/.svn" ; then
+    $SVN info "$module"
+  elif test -d "$module/.git" ; then
+    (cd "$module" && $GIT svn info)
+  fi
+}
 
 # A command to figure out the root of the SVN repository by asking for it from
 # the 'svn info' command. To use, execute it in a script with something like
-SVNROOT=`$SVN info . | grep 'Repository Root:' |sed -e 's/^Repository Root: //'`
+SVNROOT=`vcs_info . | grep 'Repository Root:' |sed -e 's/^Repository Root: //'`
 
 # Generate an informative message to the user based on the verbosity level
 msg() {
@@ -80,7 +90,7 @@
       --*)        OPTIONS_DASH_DASH="$OPTIONS_DASH_DASH $arg" ;;
        -*)        OPTIONS_DASH="$OPTIONS_DASH $arg" ;;
       *=*)        OPTIONS_ASSIGN="$OPTIONS_ASSIGN $arg" ;;
-      all)        MODULES=`svn list $SVNROOT | grep '/$' | sed -e 's#/##'` ;;
+      all)        MODULES=`$SVN list $SVNROOT | grep '/$' | sed -e 's#/##'` ;;
       [a-zA-Z]*)  MODULES="$MODULES $arg" ;;
         *)        die 1 "Unrecognized option: $arg" ;;
     esac
@@ -116,7 +126,7 @@
     quiet="-q"
   fi
   msg 3 "Running svn checkout for '$module'"
-  $SVN checkout $quiet $SVNROOT/$module/trunk $module || \
+  vcs_checkout $quiet $SVNROOT/$module/trunk $module || \
     die $? "Checkout of module '$module' failed."
   return 0
 }
@@ -225,3 +235,19 @@
   cd "$LLVM_TOP"
 }
 
+vcs_update() {
+  local module="${1:-.}"
+  if test -d "$module/.svn" ; then
+    $SVN update "$module"
+  elif test -d "$module/.git" ; then
+    (cd "$module" && $GIT svn rebase)
+  fi
+}
+
+vcs_checkout() {
+  if test -d ".svn" ; then
+    $SVN checkout $@
+  elif test -d ".git" ; then
+    $GIT svn clone $@
+  fi
+}

Modified: llvm-top/trunk/update
URL: http://llvm.org/viewvc/llvm-project/llvm-top/trunk/update?rev=62840&r1=62839&r2=62840&view=diff

==============================================================================
--- llvm-top/trunk/update (original)
+++ llvm-top/trunk/update Fri Jan 23 02:14:54 2009
@@ -35,7 +35,7 @@
 for mod in $MODULE_DEPENDENCIES ; do
   msg 1 "Updating module '$mod'"
   cd $mod
-  svn update
+  vcs_update
   cd $LLVM_TOP
 done
 





More information about the llvm-commits mailing list