1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-27 08:38:54 +02:00

commit: use the documented commit method by default now

This commit is contained in:
Dr. Peter Poeml
2007-08-14 10:30:39 +00:00
parent 5cd1ace719
commit cdf91d7f39
4 changed files with 22 additions and 37 deletions

View File

@@ -865,22 +865,15 @@ class Osc(cmdln.Cmdln):
args = parseargs(args) args = parseargs(args)
pacs = findpacs(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: for p in pacs:
msg = '' msg = ''
if conf.config['do_commits']: if opts.message:
if opts.message: msg = opts.message
msg = opts.message elif opts.file:
elif opts.file: try:
try: msg = open(opts.file).read()
msg = open(opts.file).read() except:
except: sys.exit('could not open file \'%s\'.' % opts.file)
sys.exit('could not open file \'%s\'.' % opts.file)
p.commit(msg) p.commit(msg)

View File

@@ -56,11 +56,8 @@ DEFAULTS = { 'apisrv': 'https://api.opensuse.org/',
'http_debug': '0', 'http_debug': '0',
'cookiejar': '~/.osc_cookiejar', 'cookiejar': '~/.osc_cookiejar',
# switched off for now (testing)
'do_commits': '0',
} }
boolean_opts = ['http_debug', 'do_commits'] boolean_opts = ['http_debug']
new_conf_template = """ new_conf_template = """
[general] [general]

View File

@@ -288,9 +288,7 @@ class Package:
# escaping '+' in the URL path (note: not in the URL query string) is # escaping '+' in the URL path (note: not in the URL query string) is
# only a workaround for ruby on rails, which swallows it otherwise # only a workaround for ruby on rails, which swallows it otherwise
query = [] query = ['rev=upload']
if conf.config['do_commits']:
query.append('rev=upload')
u = makeurl(self.apiurl, ['source', self.prjname, self.name, pathname2url(n)], query=query) u = makeurl(self.apiurl, ['source', self.prjname, self.name, pathname2url(n)], query=query)
http_PUT(u, file = os.path.join(self.dir, n)) http_PUT(u, file = os.path.join(self.dir, n))
@@ -330,21 +328,18 @@ class Package:
sys.stdout.flush() sys.stdout.flush()
self.put_source_file(filename) self.put_source_file(filename)
# all source files are committed - now comes the log # all source files are committed - now comes the log
if conf.config['do_commits']: query = []
query = [] query.append('cmd=commit')
query.append('cmd=commit') query.append('rev=upload')
query.append('rev=upload') query.append('user=%s' % conf.config['user'])
query.append('user=%s' % conf.config['user']) query.append('comment=%s' % quote_plus(msg))
query.append('comment=%s' % quote_plus(msg)) u = makeurl(self.apiurl, ['source', self.prjname, self.name], query=query)
u = makeurl(self.apiurl, ['source', self.prjname, self.name], query=query) #print u
#print u f = http_POST(u)
f = http_POST(u) root = ET.parse(f).getroot()
root = ET.parse(f).getroot() self.rev = int(root.get('rev'))
self.rev = int(root.get('rev')) print
print print 'Committed revision %s.' % self.rev
print 'Committed revision %s.' % self.rev
else:
print
self.update_local_filesmeta() self.update_local_filesmeta()
self.write_deletelist() self.write_deletelist()

View File

@@ -400,8 +400,8 @@ Committed revision XX.
self.assertEqual(remove_revid(self.out), """Sending bar1 self.assertEqual(remove_revid(self.out), """Sending bar1
Deleting foo2 Deleting foo2
Transmitting file data . Transmitting file data .
Committed revision XX.
""") """)
#Committed revision XX.