# reset local repository first
localname = GIT_BRANCH_NAME
remotename = os.path.join('origin', GIT_BRANCH_NAME)
- try:
- logger.info('Reset and clean repository.')
- gitcmd = git.Git('.')
- logger.debug(
- 'git reset --hard HEAD:\n%s'
- %(gitcmd.reset('--hard','HEAD'))
- )
- logger.debug(
- 'git clean -fdx:\n%s'
- %(gitcmd.clean('-fdx'))
- )
- logger.debug(
- 'git branch -D %s\n%s'
- %(localname,gitcmd.branch('-D','%s' %(localname)))
- )
+ logger.info('Reset and clean repository.')
+ gitcmd = git.Git('.')
+ logger.debug(
+ 'git reset --hard HEAD:\n%s'
+ %(gitcmd.reset('--hard','HEAD'))
+ )
+ logger.debug(
+ 'git clean -fdx:\n%s'
+ %(gitcmd.clean('-fdx'))
+ )
+ logger.debug(
+ 'git branch -D %s\n%s'
+ %(localname,gitcmd.branch('-D','%s' %(localname)))
+ )
+
+ try:
logger.info('Checkout branch %s.' %(remotename))
logger.debug(
'git checkout -b %s %s:\n%s'
)
)
except Exception, exception:
- raise Exception('Failure while managing Git clone:\n%s' %(exception))
+ raise Exception('Failure while checking out Git clone:\n%s' %(exception))
else:
logger.debug('Status is now:\n%s' %( gitcmd.status() ))