mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
- small fixes for the last commit (r7055) (I hope it doesn't break anything..)
This commit is contained in:
parent
d547203c12
commit
7cad7f99c6
@ -713,15 +713,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
"""
|
||||
|
||||
args = slash_split(args)
|
||||
|
||||
apiurl = conf.config['apiurl']
|
||||
if not args or len(args) == 0:
|
||||
p = findpacs(os.curdir)[0]
|
||||
project = p.prjname
|
||||
package = p.name
|
||||
if p.islink() and project and package:
|
||||
src_project = p.linkinfo.project
|
||||
src_package = p.linkinfo.package
|
||||
else:
|
||||
apiurl = p.apiurl
|
||||
if not p.islink():
|
||||
sys.exit('Local directory is no checked out package, aborting')
|
||||
elif len(args) == 2:
|
||||
project = args[0]
|
||||
@ -731,22 +729,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
+ self.get_cmd_help('setlinkrev'))
|
||||
|
||||
rev, dummy = parseRevisionOption(opts.revision)
|
||||
|
||||
if not rev:
|
||||
if not args or len(args) == 0:
|
||||
revision = show_upstream_rev(conf.config['apiurl'], src_project, src_package);
|
||||
else:
|
||||
url = makeurl(conf.config['apiurl'], ['source', project, package, '_link'])
|
||||
try:
|
||||
f = http_GET(url)
|
||||
root = ET.parse(f).getroot()
|
||||
except urllib2.HTTPError, e:
|
||||
e.osc_msg = 'Unable to get _link file in package \'%s\' for project \'%s\'' % (package, project)
|
||||
raise
|
||||
|
||||
return set_link_rev(project, package)
|
||||
|
||||
set_link_rev(project, package, rev)
|
||||
set_link_rev(apiurl, project, package, rev)
|
||||
|
||||
|
||||
@cmdln.option('-c', '--current', action='store_true',
|
||||
|
21
osc/core.py
21
osc/core.py
@ -1585,20 +1585,17 @@ def meta_get_packagelist(apiurl, prj):
|
||||
return [ node.get('name') for node in root.findall('entry') ]
|
||||
|
||||
|
||||
def meta_get_filelist(apiurl, prj, package, verbose=False, expand=False, revision=0):
|
||||
def meta_get_filelist(apiurl, prj, package, verbose=False, expand=False, revision=None):
|
||||
"""return a list of file names,
|
||||
or a list File() instances if verbose=True"""
|
||||
|
||||
query = {}
|
||||
if expand:
|
||||
expand = 'expand=1'
|
||||
else:
|
||||
expand = ''
|
||||
if revision and revision > 0:
|
||||
revision = '?rev=%s' % revision
|
||||
else:
|
||||
revision = ''
|
||||
query['expand'] = 1
|
||||
if revision:
|
||||
query['rev'] = revision
|
||||
|
||||
u = makeurl(apiurl, ['source', prj, package, revision], query=expand)
|
||||
u = makeurl(apiurl, ['source', prj, package], query=query)
|
||||
f = http_GET(u)
|
||||
root = ET.parse(f).getroot()
|
||||
|
||||
@ -3197,7 +3194,7 @@ def search(apiurl, search_list, kind, search_term, verbose = False, exact_matche
|
||||
return None
|
||||
|
||||
|
||||
def set_link_rev(project, package, revision = 0):
|
||||
def set_link_rev(apiurl, project, package, revision = None):
|
||||
url = makeurl(conf.config['apiurl'], ['source', project, package, '_link'])
|
||||
try:
|
||||
f = http_GET(url)
|
||||
@ -3206,10 +3203,10 @@ def set_link_rev(project, package, revision = 0):
|
||||
e.osc_msg = 'Unable to get _link file in package \'%s\' for project \'%s\'' % (package, project)
|
||||
raise
|
||||
|
||||
if not revision or revision == 0:
|
||||
if not revision:
|
||||
src_project = root.attrib['project']
|
||||
src_package = root.attrib['package']
|
||||
revision = show_upstream_rev(conf.config['apiurl'], src_project, src_package);
|
||||
revision = show_upstream_rev(apiurl, src_project, src_package);
|
||||
|
||||
# set revision element
|
||||
root.attrib['rev'] = revision
|
||||
|
Loading…
Reference in New Issue
Block a user