try:
repo = RpmGitRepository(workdir)
- if opts.commit:
- repo.rev_parse(opts.commit)
- is_clean, out = repo.is_clean()
- status = repo.status()
- untracked_files = status['??']
- uncommitted_files = []
- for stat in status:
- if stat == '??':
- continue
- uncommitted_files.extend(status[stat])
- if not is_clean and not opts.include_all:
- if untracked_files:
- msger.warning('the following untracked files would NOT be '\
- 'included:\n %s' % '\n '.join(untracked_files))
- if uncommitted_files:
- msger.warning('the following uncommitted changes would NOT be '\
- 'included:\n %s' % '\n '.join(uncommitted_files))
- msger.warning('you can specify \'--include-all\' option to '\
- 'include these uncommitted and untracked files.')
- if opts.include_all:
- if untracked_files:
- msger.info('the following untracked files would be included' \
- ':\n %s' % '\n '.join(untracked_files))
- if uncommitted_files:
- msger.info('the following uncommitted changes would be included'\
- ':\n %s' % '\n '.join(uncommitted_files))
except GitRepositoryError, err:
msger.error(str(err))
+ if not opts.incremental:
+ utils.gitStatusChecker(repo, opts)
workdir = repo.path
hostarch = get_hostarch()
try:
repo = RpmGitRepository(workdir)
- if opts.commit:
- repo.rev_parse(opts.commit)
- is_clean, out = repo.is_clean()
- status = repo.status()
- untracked_files = status['??']
- uncommitted_files = []
- for stat in status:
- if stat == '??':
- continue
- uncommitted_files.extend(status[stat])
- if not is_clean and not opts.include_all:
- if untracked_files:
- msger.warning('the following untracked files would NOT be '\
- 'included:\n %s' % '\n '.join(untracked_files))
- if uncommitted_files:
- msger.warning('the following uncommitted changes would NOT be '\
- 'included:\n %s' % '\n '.join(uncommitted_files))
- msger.warning('you can specify \'--include-all\' option to '\
- 'include these uncommitted and untracked files.')
- if opts.include_all:
- if untracked_files:
- msger.info('the following untracked files would be included' \
- ':\n %s' % '\n '.join(untracked_files))
- if uncommitted_files:
- msger.info('the following uncommitted changes would be included'\
- ':\n %s' % '\n '.join(uncommitted_files))
except GitRepositoryError, err:
msger.error(str(err))
+ utils.gitStatusChecker(repo, opts)
workdir = repo.path
if not os.path.exists("%s/packaging" % workdir):
import gbp.rpm
from gbp.scripts.buildpackage_rpm import main as gbp_build
-from gbp.git import repository, GitRepositoryError
+from gbp.rpm.git import GitRepositoryError, RpmGitRepository
from gbp.errors import GbpError
OSCRC_TEMPLATE = """[general]
'--include-all')
try:
- repo = repository.GitRepository(workdir)
- if opts.commit:
- repo.rev_parse(opts.commit)
- is_clean, out = repo.is_clean()
- status = repo.status()
- untracked_files = status['??']
- uncommitted_files = []
- for stat in status:
- if stat == '??':
- continue
- uncommitted_files.extend(status[stat])
- if not is_clean and not opts.include_all and not \
- (opts.buildlog or opts.status):
- if untracked_files:
- msger.warning('the following untracked files would NOT be '\
- 'included:\n %s' % '\n '.join(untracked_files))
- if uncommitted_files:
- msger.warning('the following uncommitted changes would NOT be '\
- 'included:\n %s' % '\n '.join(uncommitted_files))
- msger.warning('you can specify \'--include-all\' option to '\
- 'include these uncommitted and untracked files.')
- if opts.include_all and not (opts.buildlog or opts.status):
- if untracked_files:
- msger.info('the following untracked files would be included' \
- ':\n %s' % '\n '.join(untracked_files))
- if uncommitted_files:
- msger.info('the following uncommitted changes would be included'\
- ':\n %s' % '\n '.join(uncommitted_files))
- except repository.GitRepositoryError, err:
+ repo = RpmGitRepository(workdir)
+ except GitRepositoryError, err:
msger.error(str(err))
+ if not (opts.buildlog or opts.status):
+ utils.gitStatusChecker(repo, opts)
workdir = repo.path
tmpdir = os.path.join(workdir, 'packaging')
import errors
import msger
+from gbp.rpm.git import GitRepositoryError
+from gbp.errors import GbpError
class Workdir(object):
def __init__(self, path):
return self.repourls[arch] + self.localrepos
return None
+
+def gitStatusChecker(git, opts):
+ try:
+ if opts.commit:
+ git.rev_parse(opts.commit)
+ is_clean, out = git.is_clean()
+ status = git.status()
+ except (GbpError, GitRepositoryError), err:
+ msger.error(str(err))
+
+ untracked_files = status['??']
+ uncommitted_files = []
+ for stat in status:
+ if stat == '??':
+ continue
+ uncommitted_files.extend(status[stat])
+
+ if not is_clean and not opts.include_all:
+ if untracked_files:
+ msger.warning('the following untracked files would NOT be '\
+ 'included:\n %s' % '\n '.join(untracked_files))
+ if uncommitted_files:
+ msger.warning('the following uncommitted changes would NOT be '\
+ 'included:\n %s' % '\n '.join(uncommitted_files))
+ msger.warning('you can specify \'--include-all\' option to '\
+ 'include these uncommitted and untracked files.')
+ if not is_clean and opts.include_all:
+ if untracked_files:
+ msger.info('the following untracked files would be included' \
+ ':\n %s' % '\n '.join(untracked_files))
+ if uncommitted_files:
+ msger.info('the following uncommitted changes would be included'\
+ ':\n %s' % '\n '.join(uncommitted_files))