Exemple #1
0
 def _do_rm_tag(self):
     # gather input data
     is_local = self._local_tag.get_active()
     name = self._tag_input.get_text()
     rev = self._rev_input.get_text()
     use_msg = self._use_msg.get_active()
     
     # verify input
     if name == "":
         error_dialog(self, "Tag name is empty", "Please select tag name to remove")
         self._tag_input.grab_focus()
         return False
         
     if use_msg:
         message = self._commit_message.get_text()
     else:
         message = ''
         
     try:
         self._rm_hg_tag(name, message, is_local)
         info_dialog(self, "Tagging completed", "Tag '%s' has been removed" % name)
         self._refresh()
     except util.Abort, inst:
         error_dialog(self, "Error in tagging", str(inst))
         return False
Exemple #2
0
def show_bzr_error(unbound):
    """Decorator that shows bazaar exceptions. """
    def convert(*args, **kwargs):
        try:
            unbound(*args, **kwargs)
        except errors.NotBranchError:
            error_dialog(_i18n('Directory is not a branch'),
                         _i18n('You can perform this action only in a branch.'))
        except errors.LocalRequiresBoundBranch:
            error_dialog(_i18n('Directory is not a checkout'),
                         _i18n('You can perform local commit only on checkouts.'))
        except errors.PointlessCommit:
            error_dialog(_i18n('No changes to commit'),
                         _i18n('Try force commit if you want to commit anyway.'))
        except errors.PointlessMerge:
            info_dialog(_i18n('No changes to merge'),
                         _i18n('Merge location is already fully merged in working tree.'))
        except errors.ConflictsInTree:
            error_dialog(_i18n('Conflicts in tree'),
                         _i18n('You need to resolve the conflicts before committing.'))
        except errors.StrictCommitFailed:
            error_dialog(_i18n('Strict commit failed'),
                         _i18n('There are unknown files in the working tree.\nPlease add or delete them.'))
        except errors.BoundBranchOutOfDate, errmsg:
            error_dialog(_i18n('Bound branch is out of date'),
                         # FIXME: Really ? Internationalizing %s ?? --vila080505
                         _i18n('%s') % errmsg)
        except errors.NotVersionedError:
            error_dialog(_i18n('File not versioned'),
                         _i18n('The selected file is not versioned.'))
Exemple #3
0
 def _on_checkout_clicked(self, button):
     """ Checkout button clicked handler. """
     location = self._combo.get_child().get_text()
     if location is '':
         error_dialog(_i18n('Missing branch location'),
                      _i18n('You must specify a branch location.'))
         return
     
     destination = self._filechooser.get_filename()
     try:
         revno = int(self._entry_revision.get_text())
     except:
         revno = None
     
     nick = self._entry_nick.get_text()
     if nick is '':
         nick = os.path.basename(location.rstrip("/\\"))
     
     br_from = Branch.open(location)
     
     revision_id = br_from.get_rev_id(revno)
     lightweight = self._check_lightweight.get_active()
     to_location = destination + os.sep + nick
     
     os.mkdir(to_location)
     
     br_from.create_checkout(to_location, revision_id, lightweight)
     
     self._history.add_entry(location)
     
     self.response(gtk.RESPONSE_OK)
Exemple #4
0
    def _exec_cmd(self, cmd):
        if self._cmd_running():
            error_dialog(self, "Can't run now",
                "Pleas try again after the previous command is completed")
            return

        self._stop_button.set_sensitive(True)

        proxy_host = ui.ui().config('http_proxy', 'host', '')
        use_proxy = self._use_proxy.get_active()
        text_entry = self._pathbox.get_child()
        remote_path = str(text_entry.get_text())
        
        cmdline = cmd[:]
        cmdline += ['--verbose', '--repository', self.root]
        if proxy_host and not use_proxy:
            cmdline += ["--config", "http_proxy.host="]
        cmdline += [remote_path]
        
        # show command to be executed
        self.write("", False)

        # execute command and show output on text widget
        gobject.timeout_add(10, self.process_queue)
        self.hgthread = HgThread(cmdline, parent=self)
        self.hgthread.start()
        self.stbar.begin()
        self.stbar.set_status_text('hg ' + ' '.join(cmd + [remote_path]))
        
        self._add_src_to_recent(remote_path)
Exemple #5
0
 def _do_hg_cmd(self, cmd, options):
     import os.path
               
     try:
         q = Queue.Queue()
         args = [cmd] + [os.path.join(self.root, x) for x in self.files]
         hglib.hgcmd_toq(self.root, q, *args, **{})
         out = ''
         while q.qsize(): out += q.get(0)
         self.hgout = out
     except util.Abort, inst:
         error_dialog(self, "Error in %s command" % cmd, "abort: %s" % inst)
         return False
Exemple #6
0
    def run(self, filename=None):
        open_display()
        from commit import CommitDialog

        wt = None
        br = None
        try:
            (wt, path) = workingtree.WorkingTree.open_containing(filename)
            br = wt.branch
        except NoWorkingTree, e:
            from dialog import error_dialog
            error_dialog(_i18n('Directory does not have a working tree'),
                         _i18n('Operation aborted.'))
            return 1 # should this be retval=3?
Exemple #7
0
    def _on_branch_clicked(self, button):
        """ Branch button clicked handler. """
        location = self._remote_branch.get_url()
        if location is '':
            error_dialog(_i18n('Missing branch location'),
                         _i18n('You must specify a branch location.'))
            return
        
        destination = self._filechooser.get_filename()
        try:
            revno = int(self._entry_revision.get_text())
        except:
            revno = None
        
        nick = self._entry_nick.get_text()
        if nick is '':
            nick = os.path.basename(location.rstrip("/\\"))
        
        br_from = Branch.open(location)
        
        br_from.lock_read()
        try:
            from bzrlib.transport import get_transport

            revision_id = br_from.get_rev_id(revno)

            basis_dir = None
            
            to_location = destination + os.sep + nick
            to_transport = get_transport(to_location)
            
            to_transport.mkdir('.')
            
            try:
                # preserve whatever source format we have.
                dir = br_from.bzrdir.sprout(to_transport.base,
                                            revision_id,
                                            basis_dir)
                branch = dir.open_branch()
                revs = branch.revno()
            except errors.NoSuchRevision:
                to_transport.delete_tree('.')
                raise
        finally:
            br_from.unlock()
                
        info_dialog(_i18n('Branching successful'),
                    _i18n('%d revision(s) branched.') % revs)
        
        self.response(gtk.RESPONSE_OK)
Exemple #8
0
 def run(self, merge_from_path=None):
     from bzrlib.plugins.gtk.dialog import error_dialog
     from bzrlib.plugins.gtk.merge import MergeDialog
     
     (wt, path) = workingtree.WorkingTree.open_containing('.')
     old_tree = wt.branch.repository.revision_tree(wt.branch.last_revision())
     delta = wt.changes_from(old_tree)
     if len(delta.added) or len(delta.removed) or len(delta.renamed) or len(delta.modified):
         error_dialog(_i18n('There are local changes in the branch'),
                      _i18n('Please commit or revert the changes before merging.'))
     else:
         parent_branch_path = wt.branch.get_parent()
         merge = MergeDialog(wt, path, parent_branch_path)
         response = merge.run()
         merge.destroy()
Exemple #9
0
 def _test_path(self, *args):
     if not self.root:
         error_dialog(self, 'No Repository Found', 
                 'Path testing cannot work without a repository')
         return
     testpath = self._pathpathedit.get_text()
     if not testpath:
         return
     if testpath[0] == '~':
         testpath = os.path.expanduser(testpath)
     cmdline = ['hg', 'incoming', '--repository', self.root, '--verbose', testpath]
     from hgcmd import CmdDialog
     dlg = CmdDialog(cmdline)
     dlg.run()
     dlg.hide()
Exemple #10
0
 def _on_add_clicked(self, widget):
     """ Add button clicked handler. """
     if len(self._entry_name.get_text()) == 0:
         error_dialog(_i18n("No tag name specified"),
                      _i18n("You have to specify the tag's desired name."))
         return
     
     if self._revid is None:
         if self._hbox_revid.get_revision_id() is None:
             self._revid = self._branch.last_revision()
         else:
             self._revid = self._hbox_revid.get_revision_id()
         
     self.tagname = self._entry_name.get_text()
     
     self.response(gtk.RESPONSE_OK)
Exemple #11
0
 def _on_diff3_clicked(self, widget):
     """ Launch external utility to resolve conflicts. """
     self._set_diff3(self._entry_diff3.get_text())
     selected = self._get_selected_file()
     if selected is None:
         error_dialog(_i18n('No file was selected'),
                      _i18n('Please select a file from the list.'))
         return
     elif self._get_selected_type() == 'text conflict':
         base = self.wt.abspath(selected) + '.BASE'
         this = self.wt.abspath(selected) + '.THIS'
         other = self.wt.abspath(selected) + '.OTHER'
         try:
             p = subprocess.Popen([ self._entry_diff3.get_text(), base, this, other ])
             p.wait()
         except OSError, e:
             warning_dialog(_i18n('Call to external utility failed'), str(e))
Exemple #12
0
    def _btn_clone_clicked(self, toolbutton, data=None):
        # gather input data
        src = self._src_input.get_text()
        dest = self._dest_input.get_text() or os.path.basename(src)
        remotecmd = self._remote_cmd.get_text()
        rev = self._rev_input.get_text()
        
        # verify input
        if src == "":
            error_dialog(self, "Source path is empty", "Please enter")
            self._src_input.grab_focus()
            return False
        
        # start cloning        
        try:            
            cmdline = ['hg', 'clone']
            if self._opt_update.get_active():
                cmdline.append('--noupdate')
            if self._opt_uncomp.get_active():
                cmdline.append('--uncompressed')
            if self._opt_pull.get_active():
                cmdline.append('--pull')
            if not (self._opt_proxy.get_active() and
                    ui.ui().config('http_proxy', 'host', '')):
                cmdline += ["--config", "http_proxy.host="]
            if remotecmd:   
                cmdline.append('--remotecmd')
                cmdline.append(remotecmd)
            if not self._opt_allrev.get_active() and rev:   
                cmdline.append('--rev')
                cmdline.append(rev)

            cmdline.append('--verbose')
            cmdline.append(src)
            if dest:
                cmdline.append(dest)

            print "cmdline: ", ' '.join(cmdline)
            from hgcmd import CmdDialog
            dlg = CmdDialog(cmdline)
            dlg.run()
            dlg.hide()
        except util.Abort, inst:
            error_dialog(self, "Clone aborted", str(inst))
            return False
Exemple #13
0
    def _exec_cmd(self, cmd, postfunc=None):
        if self._cmd_running():
            error_dialog(self, "Can't run now",
                "Pleas try again after the previous command is completed")
            return

        self._stop_button.set_sensitive(True)
        cmdline = cmd
        cmdline.append('--verbose')
        cmdline.append('--repository')
        cmdline.append(self.root)
        
        # show command to be executed
        self.write("", False)

        # execute command and show output on text widget
        gobject.timeout_add(10, self.process_queue)
        self.hgthread = HgThread(cmdline, postfunc)
        self.hgthread.start()
        self.stbar.begin()
        self.stbar.set_status_text('hg ' + ' '.join(cmdline))
Exemple #14
0
 def _do_add_tag(self):
     # gather input data
     is_local = self._local_tag.get_active()
     name = self._tag_input.get_text()
     rev = self._rev_input.get_text()
     force = self._replace_tag.get_active()
     use_msg = self._use_msg.get_active()
     message = self._commit_message.get_text()
     
     # verify input
     if name == "":
         error_dialog(self, "Tag input is empty", "Please enter tag name")
         self._tag_input.grab_focus()
         return False
     if use_msg and not message:
         error_dialog(self, "Custom commit message is empty",
                 "Please enter commit message")
         self._commit_message.grab_focus()
         return False
         
     # add tag to repo        
     try:
         self._add_hg_tag(name, rev, message, is_local, force=force)
         info_dialog(self, "Tagging completed", "Tag '%s' has been added" % name)
         self._refresh()
     except util.Abort, inst:
         error_dialog(self, "Error in tagging", str(inst))
         return False
Exemple #15
0
    def _start_server(self):
        # gather input data
        try:
            port = int(self._port_input.get_text())
        except:
            try: port = int(self.defport)
            except: port = 8000
            error_dialog(self, "Invalid port 2048..65535", "Defaulting to " +
                    self.defport)
        
        global gservice
        gservice = None

        args = [self._root, self._queue, 'serve', '--name', self.webname,
                '--port', str(port)]
        thread = threading.Thread(target=hglib.hgcmd_toq, args=args)
        thread.start()

        while not gservice or not hasattr(gservice, 'httpd'):
            time.sleep(0.1)
        self._url = 'http://%s:%d/' % (gservice.httpd.fqaddr, port)
        gobject.timeout_add(10, self.process_queue)
Exemple #16
0
    def _apply_clicked(self, *args):
        # Reload history, since it may have been modified externally
        self.history.read()

        # flush changes on paths page
        if len(self.pathlist):
            self._refresh_path(None)
            refreshlist = []
            for (name, path) in self.pathlist:
                cpath = '.'.join(['paths', name])
                self.record_new_value(cpath, path, False)
                refreshlist.append(name)
            if 'paths' not in list(self.ini):
                self.ini.new_namespace('paths')
            for name in list(self.ini.paths):
                if name not in refreshlist:
                    del self.ini['paths'][name]
        elif 'paths' in list(self.ini):
            for name in list(self.ini.paths):
                if name not in ('default', 'default-push'):
                    del self.ini['paths'][name]

        # Flush changes on all pages
        for vbox, info, widgets in self.pages:
            for w, (label, cpath, values, tip) in enumerate(info):
                newvalue = widgets[w].child.get_text()
                self.record_new_value(cpath, newvalue)

        self.history.write()
        self._refresh_vlist()
        
        try:
            f = open(self.fn, "w")
            f.write(str(self.ini))
            f.close()
        except IOError, e:
            error_dialog(self, 'Unable to write back configuration file', str(e))
Exemple #17
0
 def _on_init_clicked(self, widget):
     if self._radio_custom.get_active() and len(self._entry_custom.get_text()) == 0:
         error_dialog(_i18n("Directory name not specified"),
                      _i18n("You should specify a new directory name."))
         return
     
     if self._radio_current.get_active():
         location = self.path
     else:
         location = self.path + os.sep + self._entry_custom.get_text()
     
     format = bzrdir.format_registry.make_bzrdir('default')        
     to_transport = transport.get_transport(location)
     
     try:
         to_transport.mkdir('.')
     except errors.FileExists:
         pass
                 
     try:
         existing_bzrdir = bzrdir.BzrDir.open(location)
     except errors.NotBranchError:
         branch = bzrdir.BzrDir.create_branch_convenience(to_transport.base,
                                                          format=format)
     else:
         from bzrlib.transport.local import LocalTransport
         if existing_bzrdir.has_branch():
             if (isinstance(to_transport, LocalTransport)
                 and not existing_bzrdir.has_workingtree()):
                     raise errors.BranchExistsWithoutWorkingTree(location)
             raise errors.AlreadyBranchError(location)
         else:
             branch = existing_bzrdir.create_branch()
             existing_bzrdir.create_workingtree()
     
     self.response(gtk.RESPONSE_OK)
Exemple #18
0
    def _do_hg_cmd(self, cmd, options):
        import os.path
                  
        try:
            q = Queue.Queue()
            args = [cmd] + [os.path.join(self.root, x) for x in self.files]
            hglib.hgcmd_toq(self.root, q, *args, **{})
            out = ''
            while q.qsize(): out += q.get(0)
            self.hgout = out
        except util.Abort, inst:
            error_dialog(self, "Error in %s command" % cmd, "abort: %s" % inst)
            return False
        except:
            import traceback
            error_dialog(self, "Error in %s command" % cmd,
                    "Traceback:\n%s" % traceback.format_exc())
            return False
        return True

    def _on_goto_clicked(self, button, nav):
        if nav == 'tip':
            self.start_rev = 'tip'
        elif nav == 'first':
            self.start_rev = self.page_size -1
        elif nav == 'next':
            if self._is_first_revision(-1):
                return
            rev = self._get_revision_on_page(0)
            next_start = rev - self.page_size
            self.start_rev = next_start
        elif nav == 'prev':
Exemple #19
0
            cmdline.append('--verbose')
            cmdline.append(src)
            if dest:
                cmdline.append(dest)

            print "cmdline: ", ' '.join(cmdline)
            from hgcmd import CmdDialog
            dlg = CmdDialog(cmdline)
            dlg.run()
            dlg.hide()
        except util.Abort, inst:
            error_dialog(self, "Clone aborted", str(inst))
            return False
        except:
            import traceback
            error_dialog(self, "Clone error", traceback.format_exc())
            return False

        self._add_src_to_recent(src)
        self._add_dest_to_recent(dest)

def run(cwd='', files=[], **opts):
    dialog = CloneDialog(cwd, repos=files)
    dialog.show_all()
    gtk.gdk.threads_init()
    gtk.gdk.threads_enter()
    gtk.main()
    gtk.gdk.threads_leave()
    
if __name__ == "__main__":
    import sys
Exemple #20
0
                  _i18n('Merge location is already fully merged in working tree.'))
 except errors.ConflictsInTree:
     error_dialog(_i18n('Conflicts in tree'),
                  _i18n('You need to resolve the conflicts before committing.'))
 except errors.StrictCommitFailed:
     error_dialog(_i18n('Strict commit failed'),
                  _i18n('There are unknown files in the working tree.\nPlease add or delete them.'))
 except errors.BoundBranchOutOfDate, errmsg:
     error_dialog(_i18n('Bound branch is out of date'),
                  # FIXME: Really ? Internationalizing %s ?? --vila080505
                  _i18n('%s') % errmsg)
 except errors.NotVersionedError:
     error_dialog(_i18n('File not versioned'),
                  _i18n('The selected file is not versioned.'))
 except errors.DivergedBranches:
     error_dialog(_i18n('Branches have been diverged'),
                  _i18n('You cannot push if branches have diverged. Use the\noverwrite option if you want to push anyway.'))
 except errors.NoSuchFile:
     error_dialog(_i18n("No diff output"),
                  _i18n("The selected file hasn't changed."))
 except errors.NoSuchRevision:
         error_dialog(_i18n('No such revision'),
                      _i18n("The revision you specified doesn't exist."))
 except errors.FileExists:
         error_dialog(_i18n('Target already exists'),
                      _i18n("Target directory already exists. Please select another target."))
 except errors.AlreadyBranchError, errmsg:
     error_dialog(_i18n('Directory is already a branch'),
                  _i18n('The current directory (%s) is already a branch.\nYou can start using it, or initialize another directory.') % errmsg)
 except errors.BranchExistsWithoutWorkingTree, errmsg:
     error_dialog(_i18n('Branch without a working tree'),
                  _i18n('The current directory (%s)\nis a branch without a working tree.') % errmsg)
Exemple #21
0
 def _do_close(self):
     if self._cmd_running():
         error_dialog(self, "Can't close now", "command is running")
     else:
         self._save_settings()
         gtk.main_quit()
Exemple #22
0
 def _handle_error(self, e):
     error_dialog('Error', str(e))
Exemple #23
0
    def __init__(self, root='',
            configrepo=False,
            focusfield=None,
            newpath=None):
        """ Initialize the Dialog. """        
        gtk.Dialog.__init__(self, parent=None, flags=0,
                          buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))

        self.ui = ui.ui()
        try:
            repo = hg.repository(self.ui, path=root)
        except RepoError:
            repo = None
            if configrepo:
                error_dialog(self, 'No repository found', 'no repo at ' + root)
                self.response(gtk.RESPONSE_CANCEL)

        # Catch close events
        self.connect('delete-event', self._delete)
        self.connect('response', self._response)

        if configrepo:
            self.ui = repo.ui
            name = repo.ui.config('web', 'name') or os.path.basename(repo.root)
            self.rcpath = [os.sep.join([repo.root, '.hg', 'hgrc'])]
            self.set_title('TortoiseGit Configure Repository - ' + name)
            shlib.set_tortoise_icon(self, 'settings_repo.ico')
            self.root = repo.root
        else:
            self.rcpath = util.user_rcpath()
            self.set_title('TortoiseGit Configure User-Global Settings')
            shlib.set_tortoise_icon(self, 'settings_user.ico')
            self.root = None

        self.ini = self.load_config(self.rcpath)

        # Create a new notebook, place the position of the tabs
        self.notebook = notebook = gtk.Notebook()
        notebook.set_tab_pos(gtk.POS_TOP)
        self.vbox.pack_start(notebook)
        notebook.show()
        self.show_tabs = True
        self.show_border = True

        self._btn_apply = gtk.Button("Apply")
        self._btn_apply.connect('clicked', self._apply_clicked)
        self.action_area.pack_end(self._btn_apply)

        self.dirty = False
        self.pages = []
        self.tooltips = gtk.Tooltips()
        self.history = shlib.Settings('config_history')

        # create pages for each section of configuration file
        self._tortoise_info = (
                ('Commit Tool', 'tortoisehg.commit', ['qct', 'internal'],
                    'Select commit tool launched by TortoiseGit. Qct is'
                    ' not included, must be installed separately'),
                ('Visual Diff Tool', 'tortoisehg.vdiff', [],
                    'Specify the visual diff tool; must be extdiff command'),
                ('Visual Editor', 'tortoisehg.editor', [],
                    'Specify the visual editor used to view files, etc'),
                ('Author Coloring', 'tortoisehg.authorcolor', ['False', 'True'],
                    'Color changesets by author name.  If not enabled,'
                    ' the changes are colored green for merge, red for'
                    ' non-trivial parents, black for normal. Default: False'),
                ('Log Batch Size', 'tortoisehg.graphlimit', ['500'],
                    'The number of revisions to read and display in the'
                    ' changelog viewer in a single batch. Default: 500'),
                ('Copy Hash', 'tortoisehg.copyhash', ['False', 'True'],
                    'Allow the changelog viewer to copy hash of currently'
                    ' selected changeset into the clipboard. Default: False'),
                ('Overlay Icons', 'tortoisehg.overlayicons',
                    ['False', 'True', 'localdisks'],
                    'Display overlay icons in Explorer windows.'
                    ' Default: True'))
        self.tortoise_frame = self.add_page(notebook, 'TortoiseHG')
        self.fill_frame(self.tortoise_frame, self._tortoise_info)

        self._user_info = (
                ('Username', 'ui.username', [], 
                    'Name associated with commits'),
                ('3-way Merge Tool', 'ui.merge', [],
'Graphical merge program for resolving merge conflicts.  If left'
' unspecified, Mercurial will use the first applicable tool it finds'
' on your system or use its internal merge tool that leaves conflict'
' markers in place.'),
                ('Editor', 'ui.editor', [],
                    'The editor to use during a commit and other'
                    ' instances where Mercurial needs multiline input from'
                    ' the user.  Only required by CLI commands.'),
                ('Verbose', 'ui.verbose', ['False', 'True'],
                    'Increase the amount of output printed'),
                ('Debug', 'ui.debug', ['False', 'True'],
                    'Print debugging information'))
        self.user_frame = self.add_page(notebook, 'User')
        self.fill_frame(self.user_frame, self._user_info)

        self._paths_info = (
                ('default', 'paths.default', [],
'Directory or URL to use when pulling if no source is specified.'
' Default is set to repository from which the current repository was cloned.'),
                ('default-push', 'paths.default-push', [],
'Optional. Directory or URL to use when pushing if no'
' destination is specified.'''))
        self.paths_frame = self.add_page(notebook, 'Paths')
        vbox = self.fill_frame(self.paths_frame, self._paths_info)

        self.pathtree = gtk.TreeView()
        self.pathsel = self.pathtree.get_selection()
        self.pathsel.connect("changed", self._pathlist_rowchanged)
        column = gtk.TreeViewColumn('Peer Repository Paths',
                gtk.CellRendererText(), text=2)
        self.pathtree.append_column(column) 
        scrolledwindow = gtk.ScrolledWindow()
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scrolledwindow.add(self.pathtree)
        vbox.add(scrolledwindow)

        self.pathlist = []
        if 'paths' in list(self.ini):
            for name in self.ini['paths']:
                if name in ('default', 'default-push'): continue
                self.pathlist.append((name, self.ini['paths'][name]))
        self.curpathrow = 0

        buttonbox = gtk.HBox()
        self.addButton = gtk.Button("Add")
        self.addButton.connect('clicked', self._add_path)
        buttonbox.pack_start(self.addButton)

        self._delpathbutton = gtk.Button("Remove")
        self._delpathbutton.connect('clicked', self._remove_path)
        buttonbox.pack_start(self._delpathbutton)

        self._refreshpathbutton = gtk.Button("Refresh")
        self._refreshpathbutton.connect('clicked', self._refresh_path)
        buttonbox.pack_start(self._refreshpathbutton)

        self._testpathbutton = gtk.Button("Test")
        self._testpathbutton.connect('clicked', self._test_path)
        buttonbox.pack_start(self._testpathbutton)

        table = gtk.Table(2, 2, False)
        lbl = gtk.Label('Name:')
        lbl.set_alignment(1.0, 0.0)
        self._pathnameedit = gtk.Entry()
        self._pathnameedit.set_sensitive(False)
        table.attach(lbl, 0, 1, 0, 1, gtk.FILL, 0, 4, 3)
        table.attach(self._pathnameedit, 1, 2, 0, 1,
                gtk.FILL|gtk.EXPAND, 0, 4, 3)

        lbl = gtk.Label('Path:')
        lbl.set_alignment(1.0, 0.0)
        self._pathpathedit = gtk.Entry()
        self._pathpathedit.set_sensitive(False)
        table.attach(lbl, 0, 1, 1, 2, gtk.FILL, 0, 4, 3)
        table.attach(self._pathpathedit, 1, 2, 1, 2,
                gtk.FILL|gtk.EXPAND, 0, 4, 3)

        vbox.pack_start(table, False, False, 4)
        vbox.pack_start(buttonbox, False, False, 4)
        self.refresh_path_list()


        self._web_info = (
                ('Name', 'web.name', ['unknown'],
                    'Repository name to use in the web interface.  Default'
                    ' is the working directory.'),
                ('Description', 'web.description', ['unknown'],
                    'Textual description of the repository''s purpose or'
                    ' contents.'),
                ('Contact', 'web.contact', ['unknown'],
                    'Name or email address of the person in charge of the'
                    ' repository.'),
                ('Style', 'web.style', ['default', 'gitweb', 'coal', 'old'],
                    'Which template map style to use'),
                ('Archive Formats', 'web.allow_archive', ['bz2', 'gz', 'zip'],
                    'Comma separated list of archive formats allowed for'
                    ' downloading'),
                ('Port', 'web.port', ['8000'], 'Port to listen on'),
                ('Push Requires SSL', 'web.push_ssl', ['True', 'False'],
                    'Whether to require that inbound pushes be transported'
                    ' over SSL to prevent password sniffing.'),
                ('Stripes', 'web.stripes', ['1', '0'],
                    'How many lines a "zebra stripe" should span in multiline'
                    ' output. Default is 1; set to 0 to disable.'),
                ('Max Files', 'web.maxfiles', ['10'],
                    'Maximum number of files to list per changeset.'),
                ('Max Changes', 'web.maxfiles', ['10'],
                    'Maximum number of changes to list on the changelog.'),
                ('Allow Push', 'web.allow_push', ['*'],
'Whether to allow pushing to the repository. If empty or not'
' set, push is not allowed. If the special value "*", any remote'
' user can push, including unauthenticated users. Otherwise, the'
' remote user must have been authenticated, and the authenticated'
' user name must be present in this list (separated by whitespace'
' or ","). The contents of the allow_push list are examined after'
' the deny_push list.'),
                ('Deny Push', 'web.deny_push', ['*'],
'Whether to deny pushing to the repository. If empty or not set,'
' push is not denied. If the special value "*", all remote users'
' are denied push. Otherwise, unauthenticated users are all'
' denied, and any authenticated user name present in this list'
' (separated by whitespace or ",") is also denied. The contents'
' of the deny_push list are examined before the allow_push list.'),
                ('Encoding', 'web.encoding', ['UTF-8'],
                    'Character encoding name'))
        self.web_frame = self.add_page(notebook, 'Web')
        self.fill_frame(self.web_frame, self._web_info)

        self._proxy_info = (
                ('host', 'http_proxy.host', [],
                    'Host name and (optional) port of proxy server, for'
                    ' example "myproxy:8000"'),
                ('no', 'http_proxy.no', [],
                    'Optional. Comma-separated list of host names that'
                    ' should bypass the proxy'),
                ('passwd', 'http_proxy.passwd', [],
                    'Optional. Password to authenticate with at the'
                    ' proxy server'),
                ('user', 'http_proxy.user', [],
                    'Optional. User name to authenticate with at the'
                    ' proxy server'))
        self.proxy_frame = self.add_page(notebook, 'Proxy')
        self.fill_frame(self.proxy_frame, self._proxy_info)

        self._email_info = (
                ('From', 'email.from', [],
                    'Email address to use in "From" header and SMTP envelope'),
                ('To', 'email.to', [],
                    'Comma-separated list of recipient email addresses'),
                ('Cc', 'email.cc', [],
                    'Comma-separated list of carbon copy recipient email'
                    ' addresses'),
                ('Bcc', 'email.bcc', [],
                    'Comma-separated list of blind carbon copy recipient'
                    ' email addresses'),
                ('method', 'email.method', ['smtp'],
'Optional. Method to use to send email messages. If value is "smtp" (default),'
' use SMTP (configured below).  Otherwise, use as name of program to run that'
' acts like sendmail (takes "-f" option for sender, list of recipients on'
' command line, message on stdin). Normally, setting this to "sendmail" or'
' "/usr/sbin/sendmail" is enough to use sendmail to send messages.'),
                ('SMTP Host', 'smtp.host', [], 'Host name of mail server'),
                ('SMTP Port', 'smtp.port', ['25'],
                    'Port to connect to on mail server. Default: 25'),
                ('SMTP TLS', 'smtp.tls', ['False', 'True'],
                    'Connect to mail server using TLS.  Default: False'),
                ('SMTP Username', 'smtp.username', [],
                    'Username to authenticate to SMTP server with'),
                ('SMTP Password', 'smtp.password', [],
                    'Password to authenticate to SMTP server with'),
                ('Local Hostname', 'smtp.local_hostname', [],
                    'Hostname the sender can use to identify itself to MTA'))
        self.email_frame = self.add_page(notebook, 'Email')
        self.fill_frame(self.email_frame, self._email_info)

        self._diff_info = (
                ('Git Format', 'diff.git', ['False', 'True'],
                    'Use git extended diff format.'),
                ('No Dates', 'diff.nodates', ['False', 'True'],
                    'Do no include dates in diff headers.'),
                ('Show Function', 'diff.showfunc', ['False', 'True'],
                    'Show which function each change is in.'),
                ('Ignore White Space', 'diff.ignorews', ['False', 'True'],
                    'Ignore white space when comparing lines.'),
                ('Ignore WS Amount', 'diff.ignorewsamount', ['False', 'True'],
                    'Ignore changes in the amount of white space.'),
                ('Ignore Blank Lines', 'diff.ignoreblanklines',
                    ['False', 'True'],
                    'Ignore changes whose lines are all blank.'),
                )
        self.diff_frame = self.add_page(notebook, 'Diff')
        self.fill_frame(self.diff_frame, self._diff_info)

        # Force dialog into clean state in the beginning
        self._refresh_vlist()
        self._btn_apply.set_sensitive(False)
        self.dirty = False
Exemple #24
0
         error_dialog(self, "Custom commit message is empty",
                 "Please enter commit message")
         self._commit_message.grab_focus()
         return False
         
     # add tag to repo        
     try:
         self._add_hg_tag(name, rev, message, is_local, force=force)
         info_dialog(self, "Tagging completed", "Tag '%s' has been added" % name)
         self._refresh()
     except util.Abort, inst:
         error_dialog(self, "Error in tagging", str(inst))
         return False
     except:
         import traceback
         error_dialog(self, "Error in tagging", traceback.format_exc())
         return False
 
 def _do_rm_tag(self):
     # gather input data
     is_local = self._local_tag.get_active()
     name = self._tag_input.get_text()
     rev = self._rev_input.get_text()
     use_msg = self._use_msg.get_active()
     
     # verify input
     if name == "":
         error_dialog(self, "Tag name is empty", "Please select tag name to remove")
         self._tag_input.grab_focus()
         return False