1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 17:36:13 +01:00

Fix handling of meta command within local working directory

* Fix osc ignoring -A apiurl command option when arguments are
  less than 2 and executed within local working copy

* Enhance handling of meta command within local working copy.
  - meta prj: Try to use project and apiurl of local working copy
    if no arguments are passed
  - meta pkg: Try to use project and apiurl of local working copy
    if one argument is passed (single argument assumed to be package
    name), and try to use project, package and apiurl if no
    arguments are passed
This commit is contained in:
Scott Bahling 2014-01-10 13:04:45 +01:00 committed by Adrian Schröter
parent 7b3b9ebc0f
commit a33c40eb53

View File

@ -731,22 +731,30 @@ class Osc(cmdln.Cmdln):
raise oscerr.WrongArgs('Too many arguments.') raise oscerr.WrongArgs('Too many arguments.')
apiurl = self.get_api_url() apiurl = self.get_api_url()
if len(args) < 2:
apiurl = store_read_apiurl(os.curdir)
# specific arguments # Specific arguments
#
# If project or package arguments missing, assume to work
# with project and/or package in current local directory.
attributepath = [] attributepath = []
if cmd in ['pkg', 'prj', 'prjconf' ]: if cmd in ['prj', 'prjconf']:
if len(args) == 0: if len(args) < 1:
apiurl = store_read_apiurl(os.curdir)
project = store_read_project(os.curdir) project = store_read_project(os.curdir)
else: else:
project = args[0] project = args[0]
if cmd == 'pkg': elif cmd == 'pkg':
if len(args) < 2: if len(args) < 2:
apiurl = store_read_apiurl(os.curdir)
project = store_read_project(os.curdir)
if len(args) < 1:
package = store_read_package(os.curdir) package = store_read_package(os.curdir)
else: else:
package = args[1] package = args[0]
else:
project = args[0]
package = args[1]
elif cmd == 'attribute': elif cmd == 'attribute':
project = args[0] project = args[0]