mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-15 01:56:17 +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)
|
args = slash_split(args)
|
||||||
|
apiurl = conf.config['apiurl']
|
||||||
if not args or len(args) == 0:
|
if not args or len(args) == 0:
|
||||||
p = findpacs(os.curdir)[0]
|
p = findpacs(os.curdir)[0]
|
||||||
project = p.prjname
|
project = p.prjname
|
||||||
package = p.name
|
package = p.name
|
||||||
if p.islink() and project and package:
|
apiurl = p.apiurl
|
||||||
src_project = p.linkinfo.project
|
if not p.islink():
|
||||||
src_package = p.linkinfo.package
|
|
||||||
else:
|
|
||||||
sys.exit('Local directory is no checked out package, aborting')
|
sys.exit('Local directory is no checked out package, aborting')
|
||||||
elif len(args) == 2:
|
elif len(args) == 2:
|
||||||
project = args[0]
|
project = args[0]
|
||||||
@ -731,22 +729,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
+ self.get_cmd_help('setlinkrev'))
|
+ self.get_cmd_help('setlinkrev'))
|
||||||
|
|
||||||
rev, dummy = parseRevisionOption(opts.revision)
|
rev, dummy = parseRevisionOption(opts.revision)
|
||||||
|
set_link_rev(apiurl, project, package, rev)
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
@cmdln.option('-c', '--current', action='store_true',
|
@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') ]
|
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,
|
"""return a list of file names,
|
||||||
or a list File() instances if verbose=True"""
|
or a list File() instances if verbose=True"""
|
||||||
|
|
||||||
|
query = {}
|
||||||
if expand:
|
if expand:
|
||||||
expand = 'expand=1'
|
query['expand'] = 1
|
||||||
else:
|
if revision:
|
||||||
expand = ''
|
query['rev'] = revision
|
||||||
if revision and revision > 0:
|
|
||||||
revision = '?rev=%s' % revision
|
|
||||||
else:
|
|
||||||
revision = ''
|
|
||||||
|
|
||||||
u = makeurl(apiurl, ['source', prj, package, revision], query=expand)
|
u = makeurl(apiurl, ['source', prj, package], query=query)
|
||||||
f = http_GET(u)
|
f = http_GET(u)
|
||||||
root = ET.parse(f).getroot()
|
root = ET.parse(f).getroot()
|
||||||
|
|
||||||
@ -3197,7 +3194,7 @@ def search(apiurl, search_list, kind, search_term, verbose = False, exact_matche
|
|||||||
return None
|
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'])
|
url = makeurl(conf.config['apiurl'], ['source', project, package, '_link'])
|
||||||
try:
|
try:
|
||||||
f = http_GET(url)
|
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)
|
e.osc_msg = 'Unable to get _link file in package \'%s\' for project \'%s\'' % (package, project)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
if not revision or revision == 0:
|
if not revision:
|
||||||
src_project = root.attrib['project']
|
src_project = root.attrib['project']
|
||||||
src_package = root.attrib['package']
|
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
|
# set revision element
|
||||||
root.attrib['rev'] = revision
|
root.attrib['rev'] = revision
|
||||||
|
Loading…
Reference in New Issue
Block a user