comparison frontends/src/jp/cmd_merge_request.py @ 2532:772447ec070f

jp: pubsub options refactoring: There is now only "use_pubsub", and specification are set using "pubsub_flags" argument when instantiating CommandBase. Options are more Python Zen compliant by using explicit arguments for item, draft, url instead of trying to guess with magic keyword and type detection. Pubsub node and item are now always using respecively "-n" and "-i" even when required, this way shell history can be used to change command more easily, and it's globally less confusing for user. if --pubsub-url is used, elements can be overwritten with individual option (e.g. change item id with --item). New "use_draft" argument in CommandBase, to re-use current draft or open a file path as draft. Item can now be specified when using a draft. If it already exists, its content will be added to current draft (with a separator), to avoid loosing data. common.BaseEdit.getItemPath could be simplified thanks to those changes. Pubsub URI handling has been moved to base.py.
author Goffi <goffi@goffi.org>
date Wed, 21 Mar 2018 19:13:22 +0100
parents 0046283a285d
children 100563768196
comparison
equal deleted inserted replaced
2531:1dfc5516dead 2532:772447ec070f
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 20
21 import base 21 import base
22 from sat.core.i18n import _ 22 from sat.core.i18n import _
23 from sat_frontends.jp import common
24 from sat_frontends.jp.constants import Const as C 23 from sat_frontends.jp.constants import Const as C
25 from functools import partial 24 from functools import partial
26 import os.path 25 import os.path
27 26
28 __commands__ = ["MergeRequest"] 27 __commands__ = ["MergeRequest"]
44 else: 43 else:
45 self.disp(u"Merge request published") 44 self.disp(u"Merge request published")
46 self.host.quit(C.EXIT_OK) 45 self.host.quit(C.EXIT_OK)
47 46
48 def start(self): 47 def start(self):
49 common.checkURI(self.args)
50 repository = os.path.expanduser(os.path.abspath(self.args.repository)) 48 repository = os.path.expanduser(os.path.abspath(self.args.repository))
51 extra = {'update': 'true'} if self.args.item else {} 49 extra = {'update': 'true'} if self.args.item else {}
52 self.host.bridge.mergeRequestSet( 50 self.host.bridge.mergeRequestSet(
53 self.args.service, 51 self.args.service,
54 self.args.node, 52 self.args.node,