# HG changeset patch # User Goffi # Date 1522514521 -7200 # Node ID 39b10475f56b37f4de8c95953bedaaee5b6179d5 # Parent 38e1e29c48e910321537130b0f840418d666e2f6 jp (merge-request): find URIs when --service and --node are not specified for get and import: local dir is used for get, as repository is not in options. diff -r 38e1e29c48e9 -r 39b10475f56b frontends/src/jp/cmd_merge_request.py --- a/frontends/src/jp/cmd_merge_request.py Sat Mar 31 18:40:54 2018 +0200 +++ b/frontends/src/jp/cmd_merge_request.py Sat Mar 31 18:42:01 2018 +0200 @@ -81,7 +81,10 @@ class Get(base.CommandBase): def __init__(self, host): - base.CommandBase.__init__(self, host, 'get', use_pubsub=True, pubsub_flags={C.MULTI_ITEMS}, use_verbose=True, help=_(u'get a merge request')) + base.CommandBase.__init__(self, host, 'get', use_verbose=True, + use_pubsub=True, pubsub_flags={C.MULTI_ITEMS}, + pubsub_defaults = {u'service': _(u'auto'), u'node': _(u'auto')}, + help=_(u'get a merge request')) self.need_loop=True def add_parser_options(self): @@ -95,9 +98,10 @@ for request_xmlui in requests_data[0]: xmlui = xmlui_manager.create(self.host, request_xmlui, whitelist=whitelist) xmlui.show(values_only=True) + self.disp(u'') self.host.quit(C.EXIT_OK) - def start(self): + def getRequests(self): extra = {} self.host.bridge.mergeRequestsGet( self.args.service, @@ -112,12 +116,17 @@ msg=_(u"can't get merge request: {}"), exit_code=C.EXIT_BRIDGE_ERRBACK)) + def start(self): + common.URIFinder(self, os.getcwd(), 'merge requests', self.getRequests) class Import(base.CommandBase): def __init__(self, host): - base.CommandBase.__init__(self, host, 'import', use_pubsub=True, pubsub_flags={C.SINGLE_ITEM}, help=_(u'import a merge request')) + base.CommandBase.__init__(self, host, 'import', + use_pubsub=True, pubsub_flags={C.SINGLE_ITEM, C.ITEM}, + pubsub_defaults = {u'service': _(u'auto'), u'node': _(u'auto')}, + help=_(u'import a merge request')) self.need_loop=True def add_parser_options(self): @@ -126,11 +135,10 @@ def mergeRequestImportCb(self): self.host.quit(C.EXIT_OK) - def start(self): - repository = os.path.expanduser(os.path.abspath(self.args.repository)) + def importRequest(self): extra = {} self.host.bridge.mergeRequestsImport( - repository, + self.repository, self.args.item, self.args.service, self.args.node, @@ -141,6 +149,10 @@ msg=_(u"can't import merge request: {}"), exit_code=C.EXIT_BRIDGE_ERRBACK)) + def start(self): + self.repository = os.path.expanduser(os.path.abspath(self.args.repository)) + common.URIFinder(self, self.repository, 'merge requests', self.importRequest) + class MergeRequest(base.CommandBase): subcommands = (Set, Get, Import)