mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 02:16:12 +01:00
- log: convert commit messages to preferred output locale
- commit: new option -F/--file to read commit message from file - commit: print committed revision number - Package.commit(): return the new revision number
This commit is contained in:
parent
fd199c66e9
commit
9d2863b257
@ -710,6 +710,8 @@ class Osc(cmdln.Cmdln):
|
||||
@cmdln.alias('checkin')
|
||||
@cmdln.option('-m', '--message', metavar='TEXT',
|
||||
help='specify log message TEXT')
|
||||
@cmdln.option('-F', '--file', metavar='FILE',
|
||||
help='read log message from FILE')
|
||||
def do_commit(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Upload content to the repository server
|
||||
|
||||
@ -730,6 +732,17 @@ class Osc(cmdln.Cmdln):
|
||||
|
||||
for p in pacs:
|
||||
|
||||
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)
|
||||
else:
|
||||
msg = ''
|
||||
|
||||
# commit only if the upstream revision is the same as the working copy's
|
||||
upstream_rev = show_upstream_rev(p.apiurl, p.prjname, p.name)
|
||||
if p.rev != upstream_rev:
|
||||
@ -762,12 +775,12 @@ class Osc(cmdln.Cmdln):
|
||||
p.delete_source_file(filename)
|
||||
p.to_be_deleted.remove(filename)
|
||||
if conf.config['do_commits']:
|
||||
print '[committing]'
|
||||
p.commit(msg=opts.message)
|
||||
p.rev = p.commit(msg=msg)
|
||||
print
|
||||
print 'Committed revision %s.' % p.rev
|
||||
|
||||
p.update_filesmeta()
|
||||
p.write_deletelist()
|
||||
print
|
||||
|
||||
|
||||
@cmdln.option('-r', '--revision', metavar='rev',
|
||||
|
@ -329,7 +329,9 @@ class Package:
|
||||
u = makeurl(self.apiurl, ['source', self.prjname, self.name], query=query)
|
||||
#print u
|
||||
f = http_POST(u)
|
||||
#print f.read()
|
||||
root = ET.parse(f).getroot()
|
||||
rev = int(root.get('rev'))
|
||||
return rev
|
||||
|
||||
def write_conflictlist(self):
|
||||
if len(self.in_conflict) == 0:
|
||||
@ -1502,7 +1504,7 @@ def get_buildhistory(apiurl, prj, package, platform, arch):
|
||||
|
||||
|
||||
def get_commitlog(apiurl, prj, package, revision):
|
||||
import time
|
||||
import time, locale
|
||||
u = makeurl(apiurl, ['source', prj, package, '_history'])
|
||||
f = http_GET(u)
|
||||
root = ET.parse(f).getroot()
|
||||
@ -1523,7 +1525,7 @@ def get_commitlog(apiurl, prj, package, revision):
|
||||
version = node.find('version').text
|
||||
user = node.find('user').text
|
||||
try:
|
||||
comment = node.find('comment').text
|
||||
comment = node.find('comment').text.encode(locale.getpreferredencoding(), 'replace')
|
||||
except:
|
||||
comment = '<no message>'
|
||||
t = time.localtime(int(node.find('time').text))
|
||||
|
Loading…
Reference in New Issue
Block a user