--commit can't be specified together with --include-uncommited.
give warning if no --include-uncommited specified and current git
tree is not clean, and print changed and untracked files.
if len(args) == 1:
workdir = os.path.abspath(args[0])
+ if opts.commit and opts.include_uncommited:
+ raise errors.Usage('--commit can\'t be specified together with '\
+ '--include-uncommited')
+
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_uncommited:
+ if untracked_files:
+ msger.warning('the following untracked files would be not be '\
+ 'included:\n %s' % '\n '.join(untracked_files))
+ if uncommitted_files:
+ msger.warning('the following uncommited changes would not be '\
+ 'included:\n %s' % '\n '.join(uncommitted_files))
+ msger.warning('you can specify \'--include-uncommited\' option to '\
+ 'include these uncommited and untracked files.')
+ if opts.include_uncommited:
+ 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 uncommited changes would be included'\
+ ':\n %s' % '\n '.join(uncommitted_files))
except GitRepositoryError, err:
msger.error(str(err))
if opts.commit:
commit = opts.commit
elif opts.include_uncommited:
- commit = 'WC.TRACKED'
- elif opts.include_untracked:
commit = 'WC.UNTRACKED'
else:
commit = 'HEAD'
if len(args) == 1:
workdir = os.path.abspath(args[0])
+ if opts.commit and opts.include_uncommited:
+ raise errors.Usage('--commit can\'t be specified together with '\
+ '--include-uncommited')
+
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_uncommited:
+ if untracked_files:
+ msger.warning('the following untracked files would be not be '\
+ 'included:\n %s' % '\n '.join(untracked_files))
+ if uncommitted_files:
+ msger.warning('the following uncommited changes would not be '\
+ 'included:\n %s' % '\n '.join(uncommitted_files))
+ msger.warning('you can specify \'--include-uncommited\' option to '\
+ 'include these uncommited and untracked files.')
+ if opts.include_uncommited:
+ 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 uncommited changes would be included'\
+ ':\n %s' % '\n '.join(uncommitted_files))
except GitRepositoryError, err:
msger.error(str(err))
if opts.commit:
commit = opts.commit
elif opts.include_uncommited:
- commit = 'WC.TRACKED'
- elif opts.include_untracked:
commit = 'WC.UNTRACKED'
else:
commit = 'HEAD'
msger.error('empty user is not allowed for remotebuild, '\
'please add user/passwd to gbs conf, and try again')
+ if opts.commit and opts.include_uncommited:
+ raise errors.Usage('--commit can\'t be specified together with '\
+ '--include-uncommited')
+
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_uncommited and not \
+ (opts.buildlog or opts.status):
+ if untracked_files:
+ msger.warning('the following untracked files would be not be '\
+ 'included:\n %s' % '\n '.join(untracked_files))
+ if uncommitted_files:
+ msger.warning('the following uncommited changes would not be '\
+ 'included:\n %s' % '\n '.join(uncommitted_files))
+ msger.warning('you can specify \'--include-uncommited\' option to '\
+ 'include these uncommited and untracked files.')
+ if opts.include_uncommited 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 uncommited changes would be included'\
+ ':\n %s' % '\n '.join(uncommitted_files))
except repository.GitRepositoryError, err:
msger.error(str(err))
if opts.commit:
commit = opts.commit
elif opts.include_uncommited:
- commit = 'WC.TRACKED'
- elif opts.include_untracked:
commit = 'WC.UNTRACKED'
else:
commit = 'HEAD'
dest='include_uncommited',
help='uncommited changes would be included while '\
'generating tar ball')
- @cmdln.option('--include-untracked',
- action='store_true',
- default=False,
- dest='include_untracked',
- help='untracked files would be included while '\
- 'generating tar ball')
def do_export(self, _subcmd, opts, *args):
"""${cmd_name}: export files and prepare for build
dest='include_uncommited',
help='uncommited changes would be included while '\
'generating tar ball')
- @cmdln.option('--include-untracked',
- action='store_true',
- default=False,
- dest='include_untracked',
- help='untracked files would be included while '\
- 'generating tar ball')
@cmdln.option('--debuginfo',
action='store_true',
default=False,
dest='include_uncommited',
help='uncommited changes would be included while '\
'generating tar ball')
- @cmdln.option('--include-untracked',
- action='store_true',
- default=False,
- dest='include_untracked',
- help='untracked files would be included while '\
- 'generating tar ball')
def do_remotebuild(self, subcmd, opts, *args):
"""${cmd_name}: remote build package