mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-22 21:16:16 +01:00
allow force commit
useful to workaround https://github.com/openSUSE/open-build-service/issues/913
This commit is contained in:
parent
ab111f4204
commit
826808d7cf
@ -4315,7 +4315,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
@cmdln.option('-F', '--file', metavar='FILE',
|
||||
help='read log message from FILE, \'-\' denotes standard input.')
|
||||
@cmdln.option('-f', '--force', default=False, action="store_true",
|
||||
help='ignored')
|
||||
help='force commit, even if there were no changes')
|
||||
@cmdln.option('--skip-validation', default=False, action="store_true",
|
||||
help='deprecated, don\'t use it')
|
||||
@cmdln.option('-v', '--verbose', default=False, action="store_true",
|
||||
@ -4414,13 +4414,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if repl in('y', 'Y'):
|
||||
can_branch = True
|
||||
|
||||
prj.commit(packages, msg=msg, files=files, skip_local_service_run=skip_local_service_run, verbose=opts.verbose, can_branch=can_branch)
|
||||
prj.commit(packages, msg=msg, files=files, skip_local_service_run=skip_local_service_run, verbose=opts.verbose, can_branch=can_branch, force=opts.force)
|
||||
store_unlink_file(prj.absdir, '_commit_msg')
|
||||
for pac in single_paths:
|
||||
p = Package(pac)
|
||||
if not msg and not opts.no_message:
|
||||
msg = get_commit_msg(p.absdir, [p])
|
||||
p.commit(msg, skip_local_service_run=skip_local_service_run, verbose=opts.verbose)
|
||||
p.commit(msg, skip_local_service_run=skip_local_service_run, verbose=opts.verbose, force=opts.force)
|
||||
store_unlink_file(p.absdir, '_commit_msg')
|
||||
else:
|
||||
for p in pacs:
|
||||
@ -4429,7 +4429,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
p.todo.sort()
|
||||
if not msg and not opts.no_message:
|
||||
msg = get_commit_msg(p.absdir, [p])
|
||||
p.commit(msg, skip_local_service_run=skip_local_service_run, verbose=opts.verbose)
|
||||
p.commit(msg, skip_local_service_run=skip_local_service_run, verbose=opts.verbose, force=opts.force)
|
||||
store_unlink_file(p.absdir, '_commit_msg')
|
||||
|
||||
@cmdln.option('-r', '--revision', metavar='REV',
|
||||
|
@ -912,7 +912,7 @@ class Project:
|
||||
finally:
|
||||
self.write_packages()
|
||||
|
||||
def commit(self, pacs = (), msg = '', files = {}, verbose = False, skip_local_service_run = False, can_branch=False):
|
||||
def commit(self, pacs = (), msg = '', files = {}, verbose = False, skip_local_service_run = False, can_branch=False, force=False):
|
||||
if len(pacs):
|
||||
try:
|
||||
for pac in pacs:
|
||||
@ -931,7 +931,7 @@ class Project:
|
||||
else:
|
||||
p = Package(os.path.join(self.dir, pac))
|
||||
p.todo = todo
|
||||
p.commit(msg, verbose=verbose, skip_local_service_run=skip_local_service_run, can_branch=can_branch)
|
||||
p.commit(msg, verbose=verbose, skip_local_service_run=skip_local_service_run, can_branch=can_branch, force=force)
|
||||
elif pac in self.pacs_unvers and not is_package_dir(os.path.join(self.dir, pac)):
|
||||
print('osc: \'%s\' is not under version control' % pac)
|
||||
elif pac in self.pacs_broken:
|
||||
@ -1349,7 +1349,7 @@ class Package:
|
||||
todo.append(n.get('name'))
|
||||
return todo
|
||||
|
||||
def commit(self, msg='', verbose=False, skip_local_service_run=False, can_branch=False):
|
||||
def commit(self, msg='', verbose=False, skip_local_service_run=False, can_branch=False, force=False):
|
||||
# commit only if the upstream revision is the same as the working copy's
|
||||
upstream_rev = self.latest_rev()
|
||||
if self.rev != upstream_rev:
|
||||
@ -1421,7 +1421,7 @@ class Package:
|
||||
% (filename, st))
|
||||
todo_send[filename] = f.md5
|
||||
|
||||
if not real_send and not todo_delete and not self.islinkrepair() and not self.ispulled():
|
||||
if not force and not real_send and not todo_delete and not self.islinkrepair() and not self.ispulled():
|
||||
print('nothing to do for package %s' % self.name)
|
||||
return 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user