OSDN Git Service

build: Add "aospremote" command
authorSteve Kondik <shade@chemlab.org>
Mon, 17 Sep 2012 18:33:18 +0000 (11:33 -0700)
committerSteve Kondik <steve@cyngn.com>
Sun, 4 Sep 2016 04:47:36 +0000 (21:47 -0700)
 * Adds the git remote for the matching AOSP repository.

Change-Id: Iad03fb95874ff39a39083218aec0d834e82b4480

envsetup.sh

index 3efe972..62224c0 100644 (file)
@@ -24,6 +24,7 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y
 - godir:     Go to the directory containing a file.
 - cmremote:  Add git remote for CM Gerrit Review
 - cmgerrit:  A Git wrapper that fetches/pushes patch from/to CM Gerrit Review
+- aospremote: Add git remote for matching AOSP repository
 - cmrebase:  Rebase a Gerrit change and push it again
 - mka:       Builds using SCHED_BATCH on all processors
 - reposync:  Parallel repo sync using ionice and SCHED_BATCH
@@ -1698,6 +1699,23 @@ function cmremote()
 }
 export -f cmremote
 
+function aospremote()
+{
+    git remote rm aosp 2> /dev/null
+    if [ ! -d .git ]
+    then
+        echo .git directory not found. Please run this from the root directory of the Android repository you wish to set up.
+    fi
+    PROJECT=`pwd | sed s#$ANDROID_BUILD_TOP/##g`
+    if (echo $PROJECT | grep -qv "^device")
+    then
+        PFX="platform/"
+    fi
+    git remote add aosp https://android.googlesource.com/$PFX$PROJECT
+    echo "Remote 'aosp' created"
+}
+export -f aospremote
+
 function makerecipe() {
   if [ -z "$1" ]
   then