comparison frontends/src/jp/cmd_merge_request.py @ 2545:2df1ca79cb30

jp (merge-request/import): added import command
author Goffi <goffi@goffi.org>
date Fri, 30 Mar 2018 17:53:57 +0200
parents 100563768196
children b27165bf160c
comparison
equal deleted inserted replaced
2544:a64887289931 2545:2df1ca79cb30
97 errback=partial(self.errback, 97 errback=partial(self.errback,
98 msg=_(u"can't get merge request: {}"), 98 msg=_(u"can't get merge request: {}"),
99 exit_code=C.EXIT_BRIDGE_ERRBACK)) 99 exit_code=C.EXIT_BRIDGE_ERRBACK))
100 100
101 101
102
103 class Import(base.CommandBase):
104
105 def __init__(self, host):
106 base.CommandBase.__init__(self, host, 'import', use_pubsub=True, pubsub_flags={C.SINGLE_ITEM}, help=_(u'import a merge request'))
107 self.need_loop=True
108
109 def add_parser_options(self):
110 self.parser.add_argument("-r", "--repository", metavar="PATH", type=base.unicode_decoder, default=u'.', help=_(u"path of the repository (DEFAULT: current directory)"))
111
112 def mergeRequestImportCb(self):
113 self.host.quit(C.EXIT_OK)
114
115 def start(self):
116 repository = os.path.expanduser(os.path.abspath(self.args.repository))
117 extra = {}
118 self.host.bridge.mergeRequestsImport(
119 repository,
120 self.args.item,
121 self.args.service,
122 self.args.node,
123 extra,
124 self.profile,
125 callback=self.mergeRequestImportCb,
126 errback=partial(self.errback,
127 msg=_(u"can't import merge request: {}"),
128 exit_code=C.EXIT_BRIDGE_ERRBACK))
129
130
102 class MergeRequest(base.CommandBase): 131 class MergeRequest(base.CommandBase):
103 subcommands = (Set, Get) 132 subcommands = (Set, Get, Import)
104 133
105 def __init__(self, host): 134 def __init__(self, host):
106 super(MergeRequest, self).__init__(host, 'merge-request', use_profile=False, help=_('merge-request management')) 135 super(MergeRequest, self).__init__(host, 'merge-request', use_profile=False, help=_('merge-request management'))