/[gentoo-x86]/eclass/git.eclass
Gentoo

Diff of /eclass/git.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.35 Revision 1.36
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/git.eclass,v 1.35 2010/01/13 20:04:19 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/git.eclass,v 1.36 2010/01/13 22:14:59 scarabeus Exp $
4 4
5# @ECLASS: git.eclass 5# @ECLASS: git.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Tomas Chvatal <scarabeus@gentoo.org> 7# Tomas Chvatal <scarabeus@gentoo.org>
8# Donnie Berkholz <dberkholz@gentoo.org> 8# Donnie Berkholz <dberkholz@gentoo.org>
150 git submodule init 150 git submodule init
151 debug-print "git submodule update" 151 debug-print "git submodule update"
152 git submodule update 152 git submodule update
153} 153}
154 154
155# @FUNCTION: git_branch
156# @DESCRIPTION:
157# Internal function that changes branch for the repo based on EGIT_TREE and
158# EGIT_BRANCH variables.
159git_branch() {
160 local branchname=branch-${EGIT_BRANCH} src=origin/${EGIT_BRANCH}
161 if [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]]; then
162 branchname=tree-${EGIT_COMMIT}
163 src=${EGIT_COMMIT}
164 fi
165 debug-print "git checkout -b ${branchname} ${src}"
166 git checkout -b ${branchname} ${src} &> /dev/null
167
168 unset branchname src
169}
170
155# @FUNCTION: git_fetch 171# @FUNCTION: git_fetch
156# @DESCRIPTION: 172# @DESCRIPTION:
157# Gets repository from EGIT_REPO_URI and store it in specified EGIT_STORE_DIR 173# Gets repository from EGIT_REPO_URI and store it in specified EGIT_STORE_DIR
158git_fetch() { 174git_fetch() {
159 debug-print-function ${FUNCNAME} "$@" 175 debug-print-function ${FUNCNAME} "$@"
236 252
237 pushd "${GIT_DIR}" &> /dev/null 253 pushd "${GIT_DIR}" &> /dev/null
238 cursha1=$(git rev-parse origin/${EGIT_BRANCH}) 254 cursha1=$(git rev-parse origin/${EGIT_BRANCH})
239 ${elogcmd} " at the commit: ${cursha1}" 255 ${elogcmd} " at the commit: ${cursha1}"
240 256
257 git_branch
241 git_sumbodules 258 git_sumbodules
242 popd &> /dev/null 259 popd &> /dev/null
243 elif [[ -n ${EGIT_OFFLINE} ]] ; then 260 elif [[ -n ${EGIT_OFFLINE} ]] ; then
244 pushd "${GIT_DIR}" &> /dev/null 261 pushd "${GIT_DIR}" &> /dev/null
245 cursha1=$(git rev-parse origin/${EGIT_BRANCH}) 262 cursha1=$(git rev-parse origin/${EGIT_BRANCH})
260 277
261 debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS}" 278 debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS}"
262 ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} \ 279 ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} \
263 || die "${EGIT}: can't update from ${EGIT_REPO_URI}." 280 || die "${EGIT}: can't update from ${EGIT_REPO_URI}."
264 281
282 git_branch
265 git_sumbodules 283 git_sumbodules
266 cursha1=$(git rev-parse origin/${EGIT_BRANCH}) 284 cursha1=$(git rev-parse origin/${EGIT_BRANCH})
267 285
268 # write out message based on the revisions 286 # write out message based on the revisions
269 if [[ ${oldsha1} != ${cursha1} ]]; then 287 if [[ ${oldsha1} != ${cursha1} ]]; then
301 ${elogcmd} " branch: ${EGIT_BRANCH}" 319 ${elogcmd} " branch: ${EGIT_BRANCH}"
302 ${elogcmd} " storage directory: \"${GIT_DIR}\"" 320 ${elogcmd} " storage directory: \"${GIT_DIR}\""
303 321
304 # unpack to the ${S} 322 # unpack to the ${S}
305 popd &> /dev/null 323 popd &> /dev/null
306 debug-print "git clone -l \"${GIT_DIR}\" \"${S}\"" 324 debug-print "git clone -l -s \"${GIT_DIR}\" \"${S}\""
307 git clone -l "${GIT_DIR}" "${S}" 325 git clone -l -s "${GIT_DIR}" "${S}"
308
309 # set correct branch and the tree ebuild specified
310 pushd "${S}" > /dev/null
311 local branchname=branch-${EGIT_BRANCH} src=origin/${EGIT_BRANCH}
312 if [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]]; then
313 branchname=tree-${EGIT_COMMIT}
314 src=${EGIT_COMMIT}
315 fi
316 debug-print "git checkout -b ${branchname} ${src}"
317 git checkout -b ${branchname} ${src} 2>&1 > /dev/null
318 git_sumbodules
319 popd > /dev/null
320
321 unset branchname src
322 326
323 echo ">>> Unpacked to ${S}" 327 echo ">>> Unpacked to ${S}"
324} 328}
325 329
326# @FUNCTION: git_bootstrap 330# @FUNCTION: git_bootstrap

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

  ViewVC Help
Powered by ViewVC 1.1.20