Example #1
0
    def accept(self):
        if not self.isValid():
            return
        if not self.password and not self.passwordPrompt():
            return

        self.qui.progress_bar.show()
        self.qui.progress_label.setText("Posting Review...")
        self.qui.progress_label.show()

        def cmdargs(opts):
            args = []
            for k, v in opts.iteritems():
                if isinstance(v, bool):
                    if v:
                        args.append('--%s' % k.replace('_', '-'))
                else:
                    for e in isinstance(v, basestring) and [v] or v:
                        args += ['--%s' % k.replace('_', '-'), e]

            return args

        hglib.loadextension(self.ui, 'reviewboard')

        opts = self.postReviewOpts()

        revstr = str(self.selectedRevs.pop())

        self.qui.post_review_button.setEnabled(False)
        self.qui.close_button.setEnabled(False)

        self.cmd = cmdui.Runner(False, self)
        self.cmd.setTitle(_('Review Board'))
        self.cmd.commandFinished.connect(self.onCompletion)
        self.cmd.run(['postreview'] + cmdargs(opts) + [revstr])
Example #2
0
    def accept(self):
        if not self.isValid():
            return
        if not self.password and not self.passwordPrompt():
            return

        self.qui.progress_bar.show()
        self.qui.progress_label.setText("Posting Review...")
        self.qui.progress_label.show()

        def cmdargs(opts):
            args = []
            for k, v in opts.iteritems():
                if isinstance(v, bool):
                    if v:
                        args.append('--%s' % k.replace('_', '-'))
                else:
                    for e in isinstance(v, basestring) and [v] or v:
                        args += ['--%s' % k.replace('_', '-'), e]

            return args

        hglib.loadextension(self.ui, 'reviewboard')

        opts = self.postReviewOpts()

        revstr = str(self.selectedRevs.pop())

        self.qui.post_review_button.setEnabled(False)
        self.qui.close_button.setEnabled(False)

        self.cmd = cmdui.Runner(False, self)
        self.cmd.setTitle(_('Review Board'))
        self.cmd.commandFinished.connect(self.onCompletion)
        self.cmd.run(['postreview'] + cmdargs(opts) + [revstr])
Example #3
0
    def accept(self):
        # TODO: want to pass patchbombopts directly
        def cmdargs(opts):
            args = []
            for k, v in opts.iteritems():
                if isinstance(v, bool):
                    if v:
                        args.append('--%s' % k.replace('_', '-'))
                else:
                    for e in isinstance(v, basestring) and [v] or v:
                        args += ['--%s' % k.replace('_', '-'), e]

            return args

        hglib.loadextension(self._ui, 'patchbomb')

        opts = self._patchbombopts()
        try:
            cmd = cmdui.Dialog(['email'] + cmdargs(opts), parent=self)
            cmd.setWindowTitle(_('Sending Email'))
            cmd.setShowOutput(False)
            cmd.finished.connect(cmd.deleteLater)
            if cmd.exec_():
                self._writehistory()
        finally:
            if 'desc' in opts:
                os.unlink(opts['desc'])  # TODO: don't use tempfile
Example #4
0
    def accept(self):
        # TODO: want to pass patchbombopts directly
        def cmdargs(opts):
            args = []
            for k, v in opts.iteritems():
                if isinstance(v, bool):
                    if v:
                        args.append('--%s' % k.replace('_', '-'))
                else:
                    for e in isinstance(v, basestring) and [v] or v:
                        args += ['--%s' % k.replace('_', '-'), e]

            return args

        hglib.loadextension(self._ui, 'patchbomb')

        opts = self._patchbombopts()
        try:
            cmd = cmdui.Dialog(['email'] + cmdargs(opts), parent=self)
            cmd.setWindowTitle(_('Sending Email'))
            cmd.setShowOutput(False)
            cmd.finished.connect(cmd.deleteLater)
            if cmd.exec_():
                self._writehistory()
        finally:
            if 'desc' in opts:
                os.unlink(opts['desc'])  # TODO: don't use tempfile
Example #5
0
    def accept(self):
        hglib.loadextension(self._ui, "patchbomb")

        opts = self._patchbombopts()
        try:
            cmd = cmdui.Dialog(hglib.buildcmdargs("email", **opts), parent=self)
            cmd.setWindowTitle(_("Sending Email"))
            cmd.setShowOutput(False)
            cmd.finished.connect(cmd.deleteLater)
            if cmd.exec_():
                self._writehistory()
        finally:
            if "desc" in opts:
                os.unlink(opts["desc"])  # TODO: don't use tempfile
Example #6
0
    def accept(self):
        hglib.loadextension(self._ui, 'patchbomb')

        opts = self._patchbombopts()
        try:
            cmd = cmdui.Dialog(hglib.buildcmdargs('email', **opts),
                               parent=self)
            cmd.setWindowTitle(_('Sending Email'))
            cmd.setShowOutput(False)
            cmd.finished.connect(cmd.deleteLater)
            if cmd.exec_():
                self._writehistory()
        finally:
            if 'desc' in opts:
                os.unlink(opts['desc'])  # TODO: don't use tempfile
Example #7
0
 def pull_clicked(self, toolbutton, data=None):
     sel = self.ppullcombo.get_active_text()
     ppull = [name for (name, label) in self.ppulldata if sel == label][0]
     aopts = self.get_advanced_options()
     if ppull == 'fetch':
         cmd = ['fetch', '--message', 'merge']
         # load the fetch extension explicitly
         hglib.loadextension(self.ui, 'fetch')
     else:
         cmd = ['pull']
         cmd += aopts.get('force', [])
         cmd += aopts.get('remotecmd', [])
         if ppull == 'update':
             cmd.append('--update')
         elif ppull == 'rebase':
             cmd.append('--rebase')
             # load the rebase extension explicitly
             hglib.loadextension(self.ui, 'rebase')
     cmd += aopts.get('rev', [])
     self.exec_cmd(cmd)
Example #8
0
 def loadpatchbomb():
     hglib.loadextension(self._ui, 'patchbomb')
     return extensions.find('patchbomb')
Example #9
0
 def loadpatchbomb():
     hglib.loadextension(self._ui, 'patchbomb')
     return extensions.find('patchbomb')
Example #10
0
    def __init__(self, root='', revargs=[]):
        """ Initialize the Dialog """
        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)

        gtklib.set_tortoise_icon(self, 'hg.ico')
        gtklib.set_tortoise_keys(self)
        self.root = root
        self.revargs = revargs

        self.tbar = gtk.Toolbar()
        self.tips = gtklib.Tooltips()

        tbuttons = [
                self._toolbutton(gtk.STOCK_GOTO_LAST, _('Send'),
                                 self._on_send_clicked,
                                 _('Send emails')),
                self._toolbutton(gtk.STOCK_FIND, _('Test'),
                                 self._on_test_clicked,
                                 _('Show emails which would be sent')),
                gtk.SeparatorToolItem(),
                self._toolbutton(gtk.STOCK_PREFERENCES, _('Configure'),
                                 self._on_conf_clicked,
                                 _('Configure email settings'))
            ]
        for btn in tbuttons:
            self.tbar.insert(btn, -1)
        mainvbox = gtk.VBox()
        self.add(mainvbox)
        mainvbox.pack_start(self.tbar, False, False, 2)

        # set dialog title
        if revargs[0] in ('--outgoing', '-o'):
            self.set_title(_('Email outgoing changes'))
        elif revargs[0] in ('--rev', '-r'):
            self.set_title(_('Email revisions ') + ' '.join(revargs[1:]))
        else:
            self.set_title(_('Email Mercurial Patches'))
        self.set_default_size(650, 450)

        hbox = gtk.HBox()
        envframe = gtk.Frame(_('Envelope'))
        flagframe = gtk.Frame(_('Options'))
        hbox.pack_start(envframe, True, True, 4)
        hbox.pack_start(flagframe, False, False, 4)
        mainvbox.pack_start(hbox, False, True, 4)

        # Envelope settings
        table = gtklib.LayoutTable()
        envframe.add(table)

        ## To: combo box
        self._tolist = gtk.ListStore(str)
        self._tobox = gtk.ComboBoxEntry(self._tolist, 0)
        table.add_row(_('To:'), self._tobox, padding=False)

        ## Cc: combo box
        self._cclist = gtk.ListStore(str)
        self._ccbox = gtk.ComboBoxEntry(self._cclist, 0)
        table.add_row(_('Cc:'), self._ccbox, padding=False)

        ## From: combo box
        self._fromlist = gtk.ListStore(str)
        self._frombox = gtk.ComboBoxEntry(self._fromlist, 0)
        table.add_row(_('From:'), self._frombox, padding=False)

        ## In-Reply-To: entry
        self._replyto = gtk.Entry()
        table.add_row(_('In-Reply-To:'), self._replyto, padding=False)
        self.tips.set_tip(self._replyto,
            _('Message identifier to reply to, for threading'))

        # Options
        table = gtklib.LayoutTable()
        flagframe.add(table)

        self._normal = gtk.RadioButton(None, _('Send changesets as Hg patches'))
        table.add_row(self._normal)
        self.tips.set_tip(self._normal,
                _('Hg patches (as generated by export command) are compatible '
                  'with most patch programs.  They include a header which '
                  'contains the most important changeset metadata.'))

        self._git = gtk.RadioButton(self._normal,
                _('Use extended (git) patch format'))
        table.add_row(self._git)
        self.tips.set_tip(self._git,
                _('Git patches can describe binary files, copies, and '
                  'permission changes, but recipients may not be able to '
                  'use them if they are not using git or Mercurial.'))

        self._plain = gtk.RadioButton(self._normal,
                _('Plain, do not prepend Hg header'))
        table.add_row(self._plain)
        self.tips.set_tip(self._plain,
                _('Stripping Mercurial header removes username and parent '
                  'information.  Only useful if recipient is not using '
                  'Mercurial (and does not like to see the headers).'))

        self._bundle = gtk.RadioButton(self._normal,
                _('Send single binary bundle, not patches'))
        table.add_row(self._bundle)
        if revargs[0] in ('--outgoing', '-o'):
            self.tips.set_tip(self._bundle,
                _('Bundles store complete changesets in binary form. '
                  'Upstream users can pull from them. This is the safest '
                  'way to send changes to recipient Mercurial users.'))
        else:
            self._bundle.set_sensitive(False)
            self.tips.set_tip(self._bundle,
                _('This feature is only available when sending outgoing '
                  'changesets. It is not applicable with revision ranges.'))

        self._attach = gtk.CheckButton(_('attach'))
        self.tips.set_tip(self._attach,
                _('send patches as attachments'))
        self._inline = gtk.CheckButton(_('inline'))
        self.tips.set_tip(self._inline,
                _('send patches as inline attachments'))
        self._diffstat = gtk.CheckButton(_('diffstat'))
        self.tips.set_tip(self._diffstat,
                _('add diffstat output to messages'))
        table.add_row(self._attach, self._inline, self._diffstat, padding=False)

        # Subject combo
        vbox = gtk.VBox()
        hbox = gtk.HBox()
        self._subjlist = gtk.ListStore(str)
        self._subjbox = gtk.ComboBoxEntry(self._subjlist, 0)
        hbox.pack_start(gtk.Label(_('Subject:')), False, False, 4)
        hbox.pack_start(self._subjbox, True, True, 4)

        hglib.loadextension(ui.ui(), 'patchbomb')

        # --flags was added after hg 1.3
        hasflags = False
        for arg in extensions.find('patchbomb').emailopts:
            if arg[1] == 'flag':
                hasflags = True
                break
        self._flaglist = gtk.ListStore(str)
        self._flagbox = gtk.ComboBoxEntry(self._flaglist, 0)
        if hasflags:
            hbox.pack_start(gtk.Label(_('Flags:')), False, False, 4)
            hbox.pack_start(self._flagbox, False, False, 4)
        vbox.pack_start(hbox, False, False, 4)

        # Description TextView
        accelgroup = gtk.AccelGroup()
        self.add_accel_group(accelgroup)
        self.descview = textview.UndoableTextView(accelgroup=accelgroup)
        self.descview.set_editable(True)
        fontcomment = hglib.getfontconfig()['fontcomment']
        self.descview.modify_font(pango.FontDescription(fontcomment))
        self.descbuffer = self.descview.get_buffer()
        scrolledwindow = gtk.ScrolledWindow()
        scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scrolledwindow.add(self.descview)
        frame = gtk.Frame(_('Patch Series (Bundle) Description'))
        frame.set_border_width(4)
        vbox.pack_start(scrolledwindow, True, True, 4)
        vbox.set_border_width(4)
        eventbox = gtk.EventBox()
        eventbox.add(vbox)
        frame.add(eventbox)
        self._eventbox = eventbox
        mainvbox.pack_start(frame, True, True, 4)
        gtklib.idle_add_single_call(self._refresh, True)
Example #11
0
 def loadpatchbomb():
     hglib.loadextension(self._ui, "patchbomb")
     return extensions.find("patchbomb")