-#!/usr/bin/python -tt
+/!/usr/bin/python -tt
# vim: ai ts=4 sts=4 et sw=4
#
# Copyright (c) 2012 Intel, Inc.
(pkgname, pkgversion) = upstream.guess_version() or ('', '')
try:
- import pdb;pdb.set_trace()
upstream.unpack(tardir)
except errors.UnpackError:
msger.error('Unpacking %s fail' % tarball)
msger.info('create tag named: %s' % tag)
repo.create_tag(tag, msg, commit)
+ if commit is None:
+ msger.info('dont need import, already in version %s' % tag)
+
repo.checkout_branch('master')
if commit and not opts.no_merge:
gitsts = self.status()
if 'M ' in gitsts or ' M' in gitsts or \
- 'A ' in gitsts or ' A ' in gitsts:
+ 'A ' in gitsts or ' A' in gitsts or \
+ 'D ' in gitsts or ' D' in gitsts:
return False
else:
return True
options = ['.', '-f']
self._exec_git("add", options)
- if self.is_clean():
- return None
-
- options = ['--quiet','-a', '-m %s' % msg,]
- self._exec_git("commit", options)
+ changed = not self.is_clean()
+ if changed:
+ options = ['--quiet','-a', '-m %s' % msg,]
+ self._exec_git("commit", options)
commit_id = self._exec_git('log', ['--oneline', '-1']).split()[0]
self._exec_git('reset', ['--hard', commit_id])
- return commit_id
+ return commit_id if changed else None
def find_tag(self, tag):
"""find the specify version from the repository"""
def merge(self, commit):
""" merge the git tree specified by commit to current branch"""
- if self.rev_parse(commit) is None or not self.find_tag(commit):
+ if self.rev_parse(commit) is None and not self.find_tag(commit):
raise errors.GitError('%s is invalid commit ID or tag' % commit)
options = [commit]