comparison sat_frontends/jp/cmd_merge_request.py @ 3568:04283582966f

core, frontends: fix invalid translatable strings. Some f-strings where used in translatable text, this has been fixed by using explicit `format()` call (using a script based on `tokenize`). As tokenize messes with spaces, a reformating tool (`black`) has been applied to some files afterwards.
author Goffi <goffi@goffi.org>
date Mon, 14 Jun 2021 18:35:12 +0200
parents be6d91572633
children 5f65f4e9f8cb
comparison
equal deleted inserted replaced
3567:a240748ed686 3568:04283582966f
28 28
29 __commands__ = ["MergeRequest"] 29 __commands__ = ["MergeRequest"]
30 30
31 31
32 class Set(base.CommandBase): 32 class Set(base.CommandBase):
33
34 def __init__(self, host): 33 def __init__(self, host):
35 base.CommandBase.__init__( 34 base.CommandBase.__init__(
36 self, 35 self,
37 host, 36 host,
38 "set", 37 "set",
72 async def start(self): 71 async def start(self):
73 self.repository = os.path.expanduser(os.path.abspath(self.args.repository)) 72 self.repository = os.path.expanduser(os.path.abspath(self.args.repository))
74 await common.fill_well_known_uri(self, self.repository, "merge requests") 73 await common.fill_well_known_uri(self, self.repository, "merge requests")
75 if not self.args.force: 74 if not self.args.force:
76 message = _( 75 message = _(
77 f"You are going to publish your changes to service " 76 "You are going to publish your changes to service "
78 f"[{self.args.service}], are you sure ?" 77 "[{service}], are you sure ?"
79 ) 78 ).format(service=self.args.service)
80 await self.host.confirmOrQuit( 79 await self.host.confirmOrQuit(
81 message, _("merge request publication cancelled")) 80 message, _("merge request publication cancelled")
81 )
82 82
83 extra = {"update": True} if self.args.item else {} 83 extra = {"update": True} if self.args.item else {}
84 values = {} 84 values = {}
85 if self.args.labels is not None: 85 if self.args.labels is not None:
86 values["labels"] = self.args.labels 86 values["labels"] = self.args.labels
99 except Exception as e: 99 except Exception as e:
100 self.disp(f"can't create merge requests: {e}", error=True) 100 self.disp(f"can't create merge requests: {e}", error=True)
101 self.host.quit(C.EXIT_BRIDGE_ERRBACK) 101 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
102 102
103 if published_id: 103 if published_id:
104 self.disp(_(f"Merge request published at {published_id}")) 104 self.disp(
105 _("Merge request published at {published_id}").format(
106 published_id=published_id
107 )
108 )
105 else: 109 else:
106 self.disp(_("Merge request published")) 110 self.disp(_("Merge request published"))
107 111
108 self.host.quit(C.EXIT_OK) 112 self.host.quit(C.EXIT_OK)
109 113
123 127
124 def add_parser_options(self): 128 def add_parser_options(self):
125 pass 129 pass
126 130
127 async def start(self): 131 async def start(self):
128 await common.fill_well_known_uri( 132 await common.fill_well_known_uri(self, os.getcwd(), "merge requests", meta_map={})
129 self, os.getcwd(), "merge requests", meta_map={})
130 extra = {} 133 extra = {}
131 try: 134 try:
132 requests_data = data_format.deserialise( 135 requests_data = data_format.deserialise(
133 await self.host.bridge.mergeRequestsGet( 136 await self.host.bridge.mergeRequestsGet(
134 self.args.service, 137 self.args.service,
146 149
147 if self.verbosity >= 1: 150 if self.verbosity >= 1:
148 whitelist = None 151 whitelist = None
149 else: 152 else:
150 whitelist = {"id", "title", "body"} 153 whitelist = {"id", "title", "body"}
151 for request_xmlui in requests_data['items']: 154 for request_xmlui in requests_data["items"]:
152 xmlui = xmlui_manager.create(self.host, request_xmlui, whitelist=whitelist) 155 xmlui = xmlui_manager.create(self.host, request_xmlui, whitelist=whitelist)
153 await xmlui.show(values_only=True) 156 await xmlui.show(values_only=True)
154 self.disp("") 157 self.disp("")
155 self.host.quit(C.EXIT_OK) 158 self.host.quit(C.EXIT_OK)
156 159
177 ) 180 )
178 181
179 async def start(self): 182 async def start(self):
180 self.repository = os.path.expanduser(os.path.abspath(self.args.repository)) 183 self.repository = os.path.expanduser(os.path.abspath(self.args.repository))
181 await common.fill_well_known_uri( 184 await common.fill_well_known_uri(
182 self, self.repository, "merge requests", meta_map={}) 185 self, self.repository, "merge requests", meta_map={}
186 )
183 extra = {} 187 extra = {}
184 try: 188 try:
185 await self.host.bridge.mergeRequestsImport( 189 await self.host.bridge.mergeRequestsImport(
186 self.repository, 190 self.repository,
187 self.args.item, 191 self.args.item,