Mercurial > libervia-backend
annotate sat_frontends/jp/cmd_merge_request.py @ 3039:a1bc34f90fa5
bridge (pb): implemented an asyncio compatible bridge:
`pb` bridge can now be used with asyncio by instantiating AIOBridge.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 25 Sep 2019 08:53:38 +0200 |
parents | ab2696e34d29 |
children | fee60f17ebac |
rev | line source |
---|---|
2450 | 1 #!/usr/bin/env python2 |
2 # -*- coding: utf-8 -*- | |
3 | |
4 # jp: a SàT command line tool | |
2771 | 5 # Copyright (C) 2009-2019 Jérôme Poisson (goffi@goffi.org) |
2450 | 6 |
7 # This program is free software: you can redistribute it and/or modify | |
8 # it under the terms of the GNU Affero General Public License as published by | |
9 # the Free Software Foundation, either version 3 of the License, or | |
10 # (at your option) any later version. | |
11 | |
12 # This program is distributed in the hope that it will be useful, | |
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 # GNU Affero General Public License for more details. | |
16 | |
17 # You should have received a copy of the GNU Affero General Public License | |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | |
20 | |
3028 | 21 from . import base |
2450 | 22 from sat.core.i18n import _ |
2959
989b622faff6
plugins schema, tickets, merge_requests: use serialised data for extra dict + some cosmetic changes
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
23 from sat.tools.common import data_format |
2450 | 24 from sat_frontends.jp.constants import Const as C |
2542
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
25 from sat_frontends.jp import xmlui_manager |
2551
b27165bf160c
jp (merge-request/set): if service and node are not specified, URIFinder is now used + ask confirmation before publishing
Goffi <goffi@goffi.org>
parents:
2545
diff
changeset
|
26 from sat_frontends.jp import common |
2450 | 27 from functools import partial |
28 import os.path | |
29 | |
30 __commands__ = ["MergeRequest"] | |
31 | |
32 | |
33 class Set(base.CommandBase): | |
34 def __init__(self, host): | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
35 base.CommandBase.__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
36 self, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
37 host, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
38 "set", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
39 use_pubsub=True, |
3028 | 40 pubsub_defaults={"service": _("auto"), "node": _("auto")}, |
41 help=_("publish or update a merge request"), | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
42 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
43 self.need_loop = True |
2450 | 44 |
45 def add_parser_options(self): | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
46 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
47 "-i", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
48 "--item", |
3028 | 49 default="", |
50 help=_("id or URL of the request to update, or nothing for a new one"), | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
51 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
52 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
53 "-r", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
54 "--repository", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
55 metavar="PATH", |
3028 | 56 default=".", |
57 help=_("path of the repository (DEFAULT: current directory)"), | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
58 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
59 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
60 "-f", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
61 "--force", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
62 action="store_true", |
3028 | 63 help=_("publish merge request without confirmation"), |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
64 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
65 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
66 "-l", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
67 "--label", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
68 dest="labels", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
69 action="append", |
3028 | 70 help=_("labels to categorize your request"), |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
71 ) |
2450 | 72 |
73 def mergeRequestSetCb(self, published_id): | |
74 if published_id: | |
3028 | 75 self.disp("Merge request published at {pub_id}".format(pub_id=published_id)) |
2450 | 76 else: |
3028 | 77 self.disp("Merge request published") |
2450 | 78 self.host.quit(C.EXIT_OK) |
79 | |
2551
b27165bf160c
jp (merge-request/set): if service and node are not specified, URIFinder is now used + ask confirmation before publishing
Goffi <goffi@goffi.org>
parents:
2545
diff
changeset
|
80 def sendRequest(self): |
2959
989b622faff6
plugins schema, tickets, merge_requests: use serialised data for extra dict + some cosmetic changes
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
81 extra = {"update": True} if self.args.item else {} |
2554
0062d3e79d12
plugin uri finder, jp (merge-request): labels handling:
Goffi <goffi@goffi.org>
parents:
2553
diff
changeset
|
82 values = {} |
0062d3e79d12
plugin uri finder, jp (merge-request): labels handling:
Goffi <goffi@goffi.org>
parents:
2553
diff
changeset
|
83 if self.args.labels is not None: |
3028 | 84 values["labels"] = self.args.labels |
2450 | 85 self.host.bridge.mergeRequestSet( |
86 self.args.service, | |
87 self.args.node, | |
2551
b27165bf160c
jp (merge-request/set): if service and node are not specified, URIFinder is now used + ask confirmation before publishing
Goffi <goffi@goffi.org>
parents:
2545
diff
changeset
|
88 self.repository, |
3028 | 89 "auto", |
2554
0062d3e79d12
plugin uri finder, jp (merge-request): labels handling:
Goffi <goffi@goffi.org>
parents:
2553
diff
changeset
|
90 values, |
3028 | 91 "", |
2450 | 92 self.args.item, |
2959
989b622faff6
plugins schema, tickets, merge_requests: use serialised data for extra dict + some cosmetic changes
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
93 data_format.serialise(extra), |
2450 | 94 self.profile, |
95 callback=self.mergeRequestSetCb, | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
96 errback=partial( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
97 self.errback, |
3028 | 98 msg=_("can't create merge request: {}"), |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
99 exit_code=C.EXIT_BRIDGE_ERRBACK, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
100 ), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
101 ) |
2450 | 102 |
2551
b27165bf160c
jp (merge-request/set): if service and node are not specified, URIFinder is now used + ask confirmation before publishing
Goffi <goffi@goffi.org>
parents:
2545
diff
changeset
|
103 def askConfirmation(self): |
b27165bf160c
jp (merge-request/set): if service and node are not specified, URIFinder is now used + ask confirmation before publishing
Goffi <goffi@goffi.org>
parents:
2545
diff
changeset
|
104 if not self.args.force: |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
105 message = _( |
3028 | 106 "You are going to publish your changes to service [{service}], are you sure ?" |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
107 ).format(service=self.args.service) |
3028 | 108 self.host.confirmOrQuit(message, _("merge request publication cancelled")) |
2551
b27165bf160c
jp (merge-request/set): if service and node are not specified, URIFinder is now used + ask confirmation before publishing
Goffi <goffi@goffi.org>
parents:
2545
diff
changeset
|
109 self.sendRequest() |
b27165bf160c
jp (merge-request/set): if service and node are not specified, URIFinder is now used + ask confirmation before publishing
Goffi <goffi@goffi.org>
parents:
2545
diff
changeset
|
110 |
b27165bf160c
jp (merge-request/set): if service and node are not specified, URIFinder is now used + ask confirmation before publishing
Goffi <goffi@goffi.org>
parents:
2545
diff
changeset
|
111 def start(self): |
b27165bf160c
jp (merge-request/set): if service and node are not specified, URIFinder is now used + ask confirmation before publishing
Goffi <goffi@goffi.org>
parents:
2545
diff
changeset
|
112 self.repository = os.path.expanduser(os.path.abspath(self.args.repository)) |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
113 common.URIFinder(self, self.repository, "merge requests", self.askConfirmation) |
2551
b27165bf160c
jp (merge-request/set): if service and node are not specified, URIFinder is now used + ask confirmation before publishing
Goffi <goffi@goffi.org>
parents:
2545
diff
changeset
|
114 |
2450 | 115 |
2542
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
116 class Get(base.CommandBase): |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
117 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
118 base.CommandBase.__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
119 self, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
120 host, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
121 "get", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
122 use_verbose=True, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
123 use_pubsub=True, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
124 pubsub_flags={C.MULTI_ITEMS}, |
3028 | 125 pubsub_defaults={"service": _("auto"), "node": _("auto")}, |
126 help=_("get a merge request"), | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
127 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
128 self.need_loop = True |
2542
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
129 |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
130 def add_parser_options(self): |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
131 pass |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
132 |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
133 def mergeRequestGetCb(self, requests_data): |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
134 if self.verbosity >= 1: |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
135 whitelist = None |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
136 else: |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
137 whitelist = {"id", "title", "body"} |
2542
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
138 for request_xmlui in requests_data[0]: |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
139 xmlui = xmlui_manager.create(self.host, request_xmlui, whitelist=whitelist) |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
140 xmlui.show(values_only=True) |
3028 | 141 self.disp("") |
2542
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
142 self.host.quit(C.EXIT_OK) |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
143 |
2553
39b10475f56b
jp (merge-request): find URIs when --service and --node are not specified for get and import:
Goffi <goffi@goffi.org>
parents:
2551
diff
changeset
|
144 def getRequests(self): |
2542
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
145 extra = {} |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
146 self.host.bridge.mergeRequestsGet( |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
147 self.args.service, |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
148 self.args.node, |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
149 self.args.max, |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
150 self.args.items, |
3028 | 151 "", |
2542
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
152 extra, |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
153 self.profile, |
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
154 callback=self.mergeRequestGetCb, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
155 errback=partial( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
156 self.errback, |
3028 | 157 msg=_("can't get merge request: {}"), |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
158 exit_code=C.EXIT_BRIDGE_ERRBACK, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
159 ), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
160 ) |
2542
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
161 |
2553
39b10475f56b
jp (merge-request): find URIs when --service and --node are not specified for get and import:
Goffi <goffi@goffi.org>
parents:
2551
diff
changeset
|
162 def start(self): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
163 common.URIFinder( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
164 self, os.getcwd(), "merge requests", self.getRequests, meta_map={} |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
165 ) |
2542
100563768196
jp (merge/get): "get" command first draft:
Goffi <goffi@goffi.org>
parents:
2532
diff
changeset
|
166 |
2545
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
167 |
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
168 class Import(base.CommandBase): |
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
169 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
170 base.CommandBase.__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
171 self, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
172 host, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
173 "import", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
174 use_pubsub=True, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
175 pubsub_flags={C.SINGLE_ITEM, C.ITEM}, |
3028 | 176 pubsub_defaults={"service": _("auto"), "node": _("auto")}, |
177 help=_("import a merge request"), | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
178 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
179 self.need_loop = True |
2545
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
180 |
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
181 def add_parser_options(self): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
182 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
183 "-r", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
184 "--repository", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
185 metavar="PATH", |
3028 | 186 default=".", |
187 help=_("path of the repository (DEFAULT: current directory)"), | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
188 ) |
2545
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
189 |
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
190 def mergeRequestImportCb(self): |
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
191 self.host.quit(C.EXIT_OK) |
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
192 |
2553
39b10475f56b
jp (merge-request): find URIs when --service and --node are not specified for get and import:
Goffi <goffi@goffi.org>
parents:
2551
diff
changeset
|
193 def importRequest(self): |
2545
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
194 extra = {} |
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
195 self.host.bridge.mergeRequestsImport( |
2553
39b10475f56b
jp (merge-request): find URIs when --service and --node are not specified for get and import:
Goffi <goffi@goffi.org>
parents:
2551
diff
changeset
|
196 self.repository, |
2545
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
197 self.args.item, |
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
198 self.args.service, |
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
199 self.args.node, |
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
200 extra, |
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
201 self.profile, |
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
202 callback=self.mergeRequestImportCb, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
203 errback=partial( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
204 self.errback, |
3028 | 205 msg=_("can't import merge request: {}"), |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
206 exit_code=C.EXIT_BRIDGE_ERRBACK, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
207 ), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
208 ) |
2545
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
209 |
2553
39b10475f56b
jp (merge-request): find URIs when --service and --node are not specified for get and import:
Goffi <goffi@goffi.org>
parents:
2551
diff
changeset
|
210 def start(self): |
39b10475f56b
jp (merge-request): find URIs when --service and --node are not specified for get and import:
Goffi <goffi@goffi.org>
parents:
2551
diff
changeset
|
211 self.repository = os.path.expanduser(os.path.abspath(self.args.repository)) |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
212 common.URIFinder( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
213 self, self.repository, "merge requests", self.importRequest, meta_map={} |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
214 ) |
2553
39b10475f56b
jp (merge-request): find URIs when --service and --node are not specified for get and import:
Goffi <goffi@goffi.org>
parents:
2551
diff
changeset
|
215 |
2545
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
216 |
2450 | 217 class MergeRequest(base.CommandBase): |
2545
2df1ca79cb30
jp (merge-request/import): added import command
Goffi <goffi@goffi.org>
parents:
2542
diff
changeset
|
218 subcommands = (Set, Get, Import) |
2450 | 219 |
220 def __init__(self, host): | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
221 super(MergeRequest, self).__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
222 host, "merge-request", use_profile=False, help=_("merge-request management") |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
223 ) |