1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 09:56:13 +01:00

- fixed do_copypac()

- copy_pac: when doing a client side copy don't do a commit for each file
This commit is contained in:
Marcus Hüwe 2009-07-15 18:53:47 +00:00
parent 8fcd6e3371
commit 964d921d39
2 changed files with 11 additions and 6 deletions

View File

@ -1055,11 +1055,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
rev, dummy = parseRevisionOption(opts.revision)
if opts.message:
comment=opts.comment
else:
if not rev:
comment = opts.message
else:
if not rev:
rev = show_upstream_rev(src_apiurl, src_project, src_package);
comment='osc copypac from project:%s package:%s revision:%s' % ( src_project, src_package, rev )
comment = 'osc copypac from project:%s package:%s revision:%s' % ( src_project, src_package, rev )
r = copy_pac(src_apiurl, src_project, src_package,
dst_apiurl, dst_project, dst_package,

View File

@ -2809,13 +2809,18 @@ def copy_pac(src_apiurl, src_project, src_package,
tempdir = os.getenv('TEMP')
tmpdir = tempfile.mkdtemp(prefix='osc_copypac', dir = tempdir)
os.chdir(tmpdir)
query = {'rev': 'upload'}
for n in meta_get_filelist(src_apiurl, src_project, src_package, expand=expand):
print ' ', n
get_source_file(src_apiurl, src_project, src_package, n, targetfilename=n, revision=revision)
u = makeurl(dst_apiurl, ['source', dst_project, dst_package, pathname2url(n)])
u = makeurl(dst_apiurl, ['source', dst_project, dst_package, pathname2url(n)], query=query)
http_PUT(u, file = n)
os.unlink(n)
#FIXME: add comment when doing the final commit (and no commits for each file)
if comment:
query['comment'] = comment
query['cmd'] = 'commit'
u = makeurl(dst_apiurl, ['source', dst_project, dst_package], query=query)
http_POST(u)
os.rmdir(tmpdir)
return 'Done.'