mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
commit: use the documented commit method by default now
This commit is contained in:
parent
5cd1ace719
commit
cdf91d7f39
@ -865,22 +865,15 @@ class Osc(cmdln.Cmdln):
|
||||
args = parseargs(args)
|
||||
pacs = findpacs(args)
|
||||
|
||||
# this is experimental in that it enables a different way of uploading files
|
||||
# see osc.core.Package.put_source_file()
|
||||
# I assume that if -m is used, we want to commit this way.
|
||||
if opts.message or opts.file:
|
||||
conf.config['do_commits'] = True
|
||||
|
||||
for p in pacs:
|
||||
msg = ''
|
||||
if conf.config['do_commits']:
|
||||
if opts.message:
|
||||
msg = opts.message
|
||||
elif opts.file:
|
||||
try:
|
||||
msg = open(opts.file).read()
|
||||
except:
|
||||
sys.exit('could not open file \'%s\'.' % opts.file)
|
||||
if opts.message:
|
||||
msg = opts.message
|
||||
elif opts.file:
|
||||
try:
|
||||
msg = open(opts.file).read()
|
||||
except:
|
||||
sys.exit('could not open file \'%s\'.' % opts.file)
|
||||
p.commit(msg)
|
||||
|
||||
|
||||
|
@ -56,11 +56,8 @@ DEFAULTS = { 'apisrv': 'https://api.opensuse.org/',
|
||||
|
||||
'http_debug': '0',
|
||||
'cookiejar': '~/.osc_cookiejar',
|
||||
|
||||
# switched off for now (testing)
|
||||
'do_commits': '0',
|
||||
}
|
||||
boolean_opts = ['http_debug', 'do_commits']
|
||||
boolean_opts = ['http_debug']
|
||||
|
||||
new_conf_template = """
|
||||
[general]
|
||||
|
31
osc/core.py
31
osc/core.py
@ -288,9 +288,7 @@ class Package:
|
||||
|
||||
# escaping '+' in the URL path (note: not in the URL query string) is
|
||||
# only a workaround for ruby on rails, which swallows it otherwise
|
||||
query = []
|
||||
if conf.config['do_commits']:
|
||||
query.append('rev=upload')
|
||||
query = ['rev=upload']
|
||||
u = makeurl(self.apiurl, ['source', self.prjname, self.name, pathname2url(n)], query=query)
|
||||
http_PUT(u, file = os.path.join(self.dir, n))
|
||||
|
||||
@ -330,21 +328,18 @@ class Package:
|
||||
sys.stdout.flush()
|
||||
self.put_source_file(filename)
|
||||
# all source files are committed - now comes the log
|
||||
if conf.config['do_commits']:
|
||||
query = []
|
||||
query.append('cmd=commit')
|
||||
query.append('rev=upload')
|
||||
query.append('user=%s' % conf.config['user'])
|
||||
query.append('comment=%s' % quote_plus(msg))
|
||||
u = makeurl(self.apiurl, ['source', self.prjname, self.name], query=query)
|
||||
#print u
|
||||
f = http_POST(u)
|
||||
root = ET.parse(f).getroot()
|
||||
self.rev = int(root.get('rev'))
|
||||
print
|
||||
print 'Committed revision %s.' % self.rev
|
||||
else:
|
||||
print
|
||||
query = []
|
||||
query.append('cmd=commit')
|
||||
query.append('rev=upload')
|
||||
query.append('user=%s' % conf.config['user'])
|
||||
query.append('comment=%s' % quote_plus(msg))
|
||||
u = makeurl(self.apiurl, ['source', self.prjname, self.name], query=query)
|
||||
#print u
|
||||
f = http_POST(u)
|
||||
root = ET.parse(f).getroot()
|
||||
self.rev = int(root.get('rev'))
|
||||
print
|
||||
print 'Committed revision %s.' % self.rev
|
||||
|
||||
self.update_local_filesmeta()
|
||||
self.write_deletelist()
|
||||
|
Loading…
Reference in New Issue
Block a user