repo = git.repo.Repo()
# reset local repository first
- logger.debug('Reset and clean repository to HEAD first.')
- gitcmd = git.Git('.')
- logger.debug('%s' %(gitcmd.reset('--hard','HEAD')))
- logger.debug('%s' %(gitcmd.clean('-fdx')))
-
- #if GIT_BRANCH_NAME != 'master':
localname = GIT_BRANCH_NAME
remotename = os.path.join('origin', GIT_BRANCH_NAME)
- if not git_helper.git_new_branch_from(localname,remotename):
- raise Exception('Checkout of %s was not successfull.' %( remotename ))
+ try:
+ logger.debug('Reset and clean repository first:')
+ gitcmd = git.Git('.')
+ logger.debug('%s' %(gitcmd.reset('--hard','HEAD')))
+ logger.debug('%s' %(gitcmd.clean('-fdx')))
+ logger.debug('%s' %(gitcmd.checkout('-b %s' %(localname),'%s' %(remotename))))
+ except Exception, exception:
+ raise Exception('Failure while managing Git clone:\n%s' %(exception))
else:
logger.debug('Status is now:\n%s' %( gitcmd.status() ))
+ ## #if GIT_BRANCH_NAME != 'master':
+ ## if not git_helper.git_new_branch_from(localname,remotename):
+ ## raise Exception('Checkout of %s was not successfull.' %( remotename ))
+
# we need to make sure our jenkins config is used, so let's delete any
# other config available in repository that might be prefered
#cleanup_files = ('.gbp.conf', 'debian/gbp.conf', '.git/gbp.conf')