expand --interactive to all permanent changes
authorSteve Fink <sfink@mozilla.com>
Sat, 21 Jan 2012 22:17:09 -0800
changeset 60 18481c032f83928fc814e80d793ebcda48afeef9
parent 59 7609f460ee8cca3d614b1b22b41f87d14089e65b
child 61 2731063a4c22840457f484b4afad15593d9b6fb9
push id33
push usersfink@mozilla.com
push dateWed, 01 Feb 2012 20:22:14 +0000
expand --interactive to all permanent changes
bzexport.py
--- a/bzexport.py
+++ b/bzexport.py
@@ -988,16 +988,21 @@ def bzexport(ui, repo, *args, **opts):
         if reviewers is None:
             raise util.Abort("Invalid reviewers")
 
     values = fill_values(values, ui, api_server, finalize = True)
 
     if opts["new"]:
         if bug is not None:
             raise util.Abort("Bug %s given but creation of new bug requested!" % bug)
+
+        if opts['interactive'] and ui.prompt(_("Create bug in %s/%s (y/n)?") % (values['PRODUCT'], values['COMPONENT'])) != 'y':
+            ui.write(_("Exiting without creating bug\n"))
+            return
+
         try:
             response = create_bug(ui, api_server, auth,
                                   product = values['PRODUCT'],
                                   component = values['COMPONENT'],
                                   version = values['PRODVERSION'],
                                   title = values['BUGTITLE'],
                                   description = values['BUGCOMMENT0'])
             result = json.load(response)
@@ -1009,16 +1014,20 @@ def bzexport(ui, repo, *args, **opts):
         if bug is None:
             raise util.Abort(_("No bug number specified and no bug number "
                                "listed in changeset message!"))
 
     if len(reviewers) > 0:
         for reviewer in reviewers:
             ui.write("Requesting review from " + reviewer + "\n")
 
+    if opts['interactive'] and ui.prompt(_("Attach patch? ")) != 'y':
+      ui.write(_("Exiting without creating attachment\n"))
+      return
+
     result_id = None
     attach = create_attachment(ui, api_server, auth,
                                bug, contents.getvalue(),
                                filename=values['ATTACHMENT_FILENAME'],
                                description=values['ATTACHMENT_DESCRIPTION'],
                                comment=values['ATTACHCOMMENT'],
                                reviewers=reviewers)
     result = json.load(attach)
@@ -1061,16 +1070,20 @@ def newbug(ui, repo, *args, **opts):
 
     fill_values(values, ui, api_server, finalize = False)
 
     if opts['edit']:
         values = edit_form(ui, repo, values, 'new_bug_template')
 
     fill_values(values, ui, api_server, finalize = True)
 
+    if opts['interactive'] and ui.prompt(_("Create bug in %s/%s (y/n)?") % (values['PRODUCT'], values['COMPONENT'])) != 'y':
+      ui.write(_("Exiting without creating bug\n"))
+      return
+
     response = create_bug(ui, api_server, auth,
                           product = values['PRODUCT'],
                           component = values['COMPONENT'],
                           version = values['PRODVERSION'],
                           title = values['BUGTITLE'],
                           description = values['BUGCOMMENT0'])
     result = json.load(response)
     bug = result['id']
@@ -1083,17 +1096,17 @@ cmdtable = {
           ('c', 'comment', '', 'Comment to add with the attachment'),
           ('e', 'edit', False,
            'Open a text editor to modify bug fields'),
           ('r', 'review', '',
            'List of users to request review from (comma-separated search strings), or "auto" to parse the reviewers out of the patch comment'),
           ('', 'new', False,
            'Create a new bug'),
           ('i', 'interactive', False,
-           'Interactive -- request confirmation before obsoleting patches'),
+           'Interactive -- request confirmation before any permanent action'),
           ('', 'title', '',
            'New bug title'),
           ('', 'product', '',
            'New bug product'),
           ('C', 'component', '',
            'New bug component'),
           ('', 'prodversion', '',
            'New bug product version'),
@@ -1103,16 +1116,18 @@ cmdtable = {
           ('w', 'ignore_all_space', False, 'Generate a diff that ignores whitespace changes')],
         _('hg bzexport [options] [REV] [BUG]')),
 
     'newbug':
         (newbug,
          [('c', 'comment', '', 'Comment to add with the bug'),
           ('e', 'edit', False,
            'Open a text editor to modify bug fields'),
+          ('i', 'interactive', False,
+           'Interactive -- request confirmation before any permanent action'),
           ('t', 'title', '',
            'New bug title'),
           ('', 'product', '',
            'New bug product'),
           ('C', 'component', '',
            'New bug component'),
           ('', 'prodversion', '',
            'New bug product version'),