コード例 #1
0
ファイル: checkout.py プロジェクト: edsrzf/dotfiles
 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)
コード例 #2
0
ファイル: errors.py プロジェクト: edsrzf/dotfiles
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.'))
コード例 #3
0
ファイル: push.py プロジェクト: edsrzf/dotfiles
def do_push(br_from, location, overwrite):
    """ Update a mirror of a branch.
    
    :param br_from: the source branch
    
    :param location: the location of the branch that you'd like to update
    
    :param overwrite: overwrite target location if it diverged
    
    :return: number of revisions pushed
    """
    from bzrlib.bzrdir import BzrDir
    from bzrlib.transport import get_transport
        
    transport = get_transport(location)
    location_url = transport.base

    old_rh = []

    try:
        dir_to = BzrDir.open(location_url)
        br_to = dir_to.open_branch()
    except errors.NotBranchError:
        # create a branch.
        transport = transport.clone('..')
        try:
            relurl = transport.relpath(location_url)
            transport.mkdir(relurl)
        except errors.NoSuchFile:
            response = question_dialog(_i18n('Non existing parent directory'),
                         _i18n("The parent directory (%s)\ndoesn't exist. Create?") % location)
            if response == gtk.RESPONSE_OK:
                transport.create_prefix()
            else:
                return
        dir_to = br_from.bzrdir.clone(location_url,
            revision_id=br_from.last_revision())
        br_to = dir_to.open_branch()
        count = len(br_to.revision_history())
    else:
        old_rh = br_to.revision_history()
        try:
            tree_to = dir_to.open_workingtree()
        except errors.NotLocalUrl:
            # FIXME - what to do here? how should we warn the user?
            count = br_to.pull(br_from, overwrite)
        except errors.NoWorkingTree:
            count = br_to.pull(br_from, overwrite)
        else:
            count = tree_to.pull(br_from, overwrite)

    return count
コード例 #4
0
ファイル: tags.py プロジェクト: edsrzf/dotfiles
 def __init__(self, tagname, parent):
     gtk.Dialog.__init__(self, title="Remove tag",
                               parent=parent,
                               flags=0,
                               buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
     
     # Get the arguments
     self.tag = tagname
     
     # Create the widgets
     self._hbox = gtk.HBox()
     self._vbox_question = gtk.VBox()
     self._image_question = gtk.image_new_from_stock(gtk.STOCK_DIALOG_QUESTION,
                                                     gtk.ICON_SIZE_DIALOG)
     self._label_title = gtk.Label()
     self._label_question = gtk.Label()
     self._button_remove = gtk.Button(_i18n("_Remove tag"), use_underline=True)
     
     # Set callbacks
     self._button_remove.connect('clicked', self._on_remove_clicked)
     
     # Set properties
     self._hbox.set_border_width(5)
     self._hbox.set_spacing(5)
     self._vbox_question.set_spacing(3)
     
     self._label_title.set_markup(_i18n("<b><big>Remove tag?</big></b>"))
     self._label_title.set_alignment(0.0, 0.5)
     self._label_question.set_markup(_i18n("Are you sure you want to remove the tag: <b>%s</b>?") % self.tag)
     self._label_question.set_alignment(0.0, 0.5)
     
     self._button_remove.set_image(gtk.image_new_from_stock(gtk.STOCK_REMOVE,
                                                            gtk.ICON_SIZE_BUTTON))
     self._button_remove.set_flags(gtk.CAN_DEFAULT)
     
     # Construct the dialog
     self._vbox_question.pack_start(self._label_title)
     self._vbox_question.pack_start(self._label_question)
     
     self._hbox.pack_start(self._image_question)
     self._hbox.pack_start(self._vbox_question)
     
     self.vbox.add(self._hbox)
     
     self.action_area.pack_end(self._button_remove)
     
     # Display dialog
     self.vbox.show_all()
     
     # Default to Commit button
     self._button_remove.grab_default()
コード例 #5
0
ファイル: branch.py プロジェクト: edsrzf/dotfiles
    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)
コード例 #6
0
ファイル: commands.py プロジェクト: edsrzf/dotfiles
    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?
コード例 #7
0
ファイル: commands.py プロジェクト: edsrzf/dotfiles
 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()
コード例 #8
0
ファイル: diff.py プロジェクト: edsrzf/dotfiles
 def _get_menu_bar(self):
     menubar = gtk.MenuBar()
     # View menu
     mb_view = gtk.MenuItem(_i18n("_View"))
     mb_view_menu = gtk.Menu()
     mb_view_wrapsource = gtk.CheckMenuItem(_i18n("Wrap _Long Lines"))
     mb_view_wrapsource.connect('activate', self.diff._on_wraplines_toggled)
     mb_view_wrapsource.show()
     mb_view_menu.append(mb_view_wrapsource)
     mb_view.show()
     mb_view.set_submenu(mb_view_menu)
     mb_view.show()
     menubar.append(mb_view)
     menubar.show()
     return menubar
コード例 #9
0
ファイル: loom.py プロジェクト: edsrzf/dotfiles
 def run(self):
     try:
         loom_branch.require_loom_branch(self.branch)
     except loom_branch.NotALoom:
         response = question_dialog(
             _i18n("Upgrade to Loom branch?"),
             _i18n("Branch is not a loom branch. Upgrade to Loom format?"),
             parent=self)
             # Doesn't set a parent for the dialog..
         if response == gtk.RESPONSE_NO:
             return
         assert self.branch.nick is not None
         loom_branch.loomify(self.branch)
     self._load_threads()
     return super(LoomDialog, self).run()
コード例 #10
0
ファイル: revbrowser.py プロジェクト: edsrzf/dotfiles
    def __init__(self, branch, parent=None):
        gtk.Dialog.__init__(self, title="Revision Browser - Olive",
                                  parent=parent,
                                  flags=gtk.DIALOG_MODAL,
                                  buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
    
        # Get arguments
        self.branch = branch
        
        # Create the widgets
        self._button_select = gtk.Button(_i18n("_Select"), use_underline=True)
        start_revs = [branch.last_revision(),]
        self.treeview = TreeView(branch, start_revs, None)
        
        # Set callbacks
        self._button_select.connect('clicked', self._on_select_clicked)
        self.treeview.connect('revision-activated',
                               self._on_treeview_revision_activated)
        
        # Set properties
        self.set_default_size(600, 400)
        self.vbox.set_spacing(3)
        self.treeview.set_property('graph-column-visible', False)
        self.treeview.set_property('date-column-visible', True)
        self.treeview.set_property('mainline-only', True)
        
        # Construct the dialog
        self.action_area.pack_end(self._button_select)
        
        self.vbox.pack_start(self.treeview, True, True)

        # Show the dialog
        self.show_all()
コード例 #11
0
ファイル: tags.py プロジェクト: edsrzf/dotfiles
 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)
コード例 #12
0
ファイル: conflicts.py プロジェクト: edsrzf/dotfiles
 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))
コード例 #13
0
ファイル: merge.py プロジェクト: edsrzf/dotfiles
    def _on_merge_clicked(self, widget):
        merge_source = self._combo_source.get_active()
        if merge_source == 0:
            branch = self._filechooser.get_filename()
        elif merge_source == 1:
            branch = self._custom_entry.get_text()
        if branch == "":
            error_dialog(_i18n('Branch not given'),
                         _i18n('Please specify a branch to merge from.'))
            return

        other_branch = Branch.open_containing(branch)[0]

        try:
            conflicts = self.wt.merge_from_branch(other_branch)
        except errors.BzrCommandError, errmsg:
            error_dialog(_i18n('Bazaar command error'), str(errmsg))
            return
コード例 #14
0
ファイル: tags.py プロジェクト: edsrzf/dotfiles
 def _load_tags(self):
     """ Load the tags into the TreeView. """
     tvcol_name = gtk.TreeViewColumn(_i18n("Tag Name"),
                                     gtk.CellRendererText(),
                                     text=0)
     tvcol_name.set_resizable(True)
     
     tvcol_revid = gtk.TreeViewColumn(_i18n("Revision ID"),
                                      gtk.CellRendererText(),
                                      text=1)
     tvcol_revid.set_resizable(True)
     
     self._treeview_tags.append_column(tvcol_name)
     self._treeview_tags.append_column(tvcol_revid)
     
     self._treeview_tags.set_search_column(0)
     
     self._refresh_tags()
コード例 #15
0
ファイル: tags.py プロジェクト: edsrzf/dotfiles
 def __init__(self, repository, revid=None, branch=None, parent=None):
     """ Initialize Add tag dialog. """
     gtk.Dialog.__init__(self, title="Add tag",
                               parent=parent,
                               flags=0,
                               buttons=(gtk.STOCK_CANCEL, 
                                        gtk.RESPONSE_CANCEL))
     
     # Get arguments
     self._repository = repository
     self._revid = revid
     self._branch = branch
     
     # Create the widgets
     self._button_add = gtk.Button(_i18n("_Add tag"), use_underline=True)
     self._table = gtk.Table(2, 2)
     self._label_name = gtk.Label(_i18n("Tag Name:"))
     self._label_revid = gtk.Label(_i18n("Revision ID:"))
     self._entry_name = gtk.Entry()
     if self._revid is not None:
         self._hbox_revid = gtk.Label(self._revid)
     else:
         self._hbox_revid = RevisionSelectionBox(self._branch)
     
     # Set callbacks
     self._button_add.connect('clicked', self._on_add_clicked)
     
     # Set properties
     self._label_name.set_alignment(0, 0.5)
     self._label_revid.set_alignment(0, 0.5)
     self._button_add.set_image(gtk.image_new_from_stock(gtk.STOCK_ADD,
                                                         gtk.ICON_SIZE_BUTTON))
     self._button_add.set_flags(gtk.CAN_DEFAULT)
     
     # Construct the dialog
     self._table.attach(self._label_name, 0, 1, 0, 1)
     self._table.attach(self._label_revid, 0, 1, 1, 2)
     self._table.attach(self._entry_name, 1, 2, 0, 1)
     self._table.attach(self._hbox_revid, 1, 2, 1, 2)
     self.vbox.add(self._table)
     self.action_area.pack_end(self._button_add)
     
     # Show the dialog
     self.vbox.show_all()
コード例 #16
0
ファイル: merge.py プロジェクト: edsrzf/dotfiles
 def __init__(self, wt, wtpath, default_branch_path=None, parent=None):
     """ Initialize the Merge dialog. """
     gtk.Dialog.__init__(self, title="Merge changes",
                               parent=parent,
                               flags=0,
                               buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
     self.set_icon_from_file(icon_path("bzr-icon-64.png"))
     # Get arguments
     self.wt = wt
     self.wtpath = wtpath
     self.default_branch_path = default_branch_path
     self.parent_window = parent
     
     # Create widgets
     self._hbox = gtk.HBox()
     self._source = gtk.HBox()
     self._label_merge_from = gtk.Label(_i18n("Merge from"))
     self._combo_source = gtk.combo_box_new_text()
     for entry in [_i18n("Folder"),_i18n("Custom Location")]:
         self._combo_source.append_text(entry)
     self._combo_source.connect("changed", self._on_combo_changed)
     self._button_merge = gtk.Button(_i18n("_Merge"))
     self._button_merge_icon = gtk.Image()
     self._button_merge_icon.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_BUTTON)
     self._button_merge.set_image(self._button_merge_icon)
     self._button_merge.connect('clicked', self._on_merge_clicked)
     
     # Add widgets to dialog
     self.vbox.pack_start(self._hbox, False, False, 0)
     self._hbox.add(self._label_merge_from)
     self._hbox.add(self._combo_source)
     self._hbox.set_spacing(5)
     self.action_area.pack_end(self._button_merge)
     
     if self.default_branch_path and os.path.isdir(
                         self.default_branch_path.partition('file://')[2]):
         self.directory = self.default_branch_path.partition('file://')[2]
         self._combo_source.set_active(0)
     elif self.default_branch_path:
         self._combo_source.set_active(1)
     else:
         # If no default_branch_path give, default to folder source with current folder
         self._combo_source.set_active(0)
     self.vbox.show_all()
コード例 #17
0
ファイル: checkout.py プロジェクト: edsrzf/dotfiles
 def _on_combo_changed(self, widget, event):
     """ We try to get the last revision if focus lost. """
     rev = self._get_last_revno()
     if rev is None:
         self._entry_revision.set_text(_i18n('N/A'))
         self._button_revision.set_sensitive(False)
     else:
         self._entry_revision.set_text(str(rev))
         self._button_revision.set_sensitive(True)
         if self._entry_nick.get_text() == '':
             self._entry_nick.set_text(os.path.basename(self._combo.get_child().get_text().rstrip("/\\")))
コード例 #18
0
ファイル: push.py プロジェクト: edsrzf/dotfiles
 def _on_push_clicked(self, widget):
     """ Push button clicked handler. """
     location = self._combo.get_child().get_text()
     revs = 0
     
     try:
         revs = do_push(self.branch, location=location, overwrite=False)
     except errors.DivergedBranches:
         response = question_dialog(_i18n('Branches have been diverged'),
                                    _i18n('You cannot push if branches have diverged.\nOverwrite?'))
         if response == gtk.RESPONSE_YES:
             revs = do_push(self.branch, location=location, overwrite=True)
     
     if self.branch is not None and self.branch.get_push_location() is None:
         self.branch.set_push_location(location)
     
     self._history.add_entry(location)
     info_dialog(_i18n('Push successful'),
                 _i18n("%d revision(s) pushed.") % revs)
     
     self.response(gtk.RESPONSE_OK)
コード例 #19
0
ファイル: search.py プロジェクト: edsrzf/dotfiles
    def __init__(self, index, parent=None):
        gtk.Dialog.__init__(self, title="Search Revisions",
                                  parent=parent,
                                  flags=gtk.DIALOG_MODAL,
                                  buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK,
                                           gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
        pixbuf = self.render_icon(gtk.STOCK_FIND, gtk.ICON_SIZE_MENU)
        self.set_icon(pixbuf)
        
        # Get arguments
        self.index = index

        self.searchbar = gtk.HBox()
        searchbar_label = gtk.Label(_i18n("Search for:"))
        self.searchbar.pack_start(searchbar_label, False, False, 0)
        self.searchentry = gtk.Entry()
        self.searchentry.connect('activate', self._searchentry_activate)
        # TODO: Completion using the bzr-search suggests functionality
        self.searchbar.add(self.searchentry)
        self.vbox.pack_start(self.searchbar, expand=False, fill=False)

        self.results_model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
        self.results_treeview = gtk.TreeView(self.results_model)
        self.results_treeview.connect("row-activated", self._searchresult_row_activated)

        documentname_column = gtk.TreeViewColumn(_i18n("Document"), gtk.CellRendererText(), text=0)
        self.results_treeview.append_column(documentname_column)

        summary_column = gtk.TreeViewColumn(_i18n("Summary"), gtk.CellRendererText(), text=1)
        self.results_treeview.append_column(summary_column)

        results_scrolledwindow = gtk.ScrolledWindow()
        results_scrolledwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        results_scrolledwindow.add(self.results_treeview)

        self.vbox.pack_start(results_scrolledwindow, expand=True, fill=True)

        self.set_default_size(600, 400)
        # Show the dialog
        self.show_all()
コード例 #20
0
ファイル: push.py プロジェクト: edsrzf/dotfiles
 def __init__(self, repository, revid, branch=None, parent=None):
     """ Initialize the Push dialog. """
     gtk.Dialog.__init__(self, title="Push - Olive",
                               parent=parent,
                               flags=0,
                               buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
     
     # Get arguments
     self.repository = repository
     self.revid = revid
     self.branch = branch
     
     # Create the widgets
     self._label_location = gtk.Label(_i18n("Location:"))
     self._combo = gtk.ComboBoxEntry()
     self._button_push = gtk.Button(_i18n("_Push"), use_underline=True)
     self._hbox_location = gtk.HBox()
     
     # Set callbacks
     self._button_push.connect('clicked', self._on_push_clicked)
     
     # Set properties
     self._label_location.set_alignment(0, 0.5)
     self._hbox_location.set_spacing(3)
     self.vbox.set_spacing(3)
     
     # Pack widgets
     self._hbox_location.pack_start(self._label_location, False, False)
     self._hbox_location.pack_start(self._combo, True, True)
     self.vbox.pack_start(self._hbox_location)
     self.action_area.pack_end(self._button_push)
     
     # Show the dialog
     self.vbox.show_all()
     
     # Build location history
     self._history = UrlHistory(self.branch.get_config(), 'push_history')
     self._build_history()
コード例 #21
0
ファイル: initialize.py プロジェクト: edsrzf/dotfiles
 def __init__(self, path, parent=None):
     """ Initialize the Initialize dialog. """
     gtk.Dialog.__init__(self, title="Initialize - Olive",
                               parent=parent,
                               flags=0,
                               buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
     
     # Get arguments
     self.path = path
     
     # Create the widgets
     self._button_init = gtk.Button(_i18n("_Initialize"), use_underline=True)
     self._label_question = gtk.Label(_i18n("Which directory do you want to initialize?"))
     self._radio_current = gtk.RadioButton(None, _i18n("Current directory"))
     self._radio_custom = gtk.RadioButton(self._radio_current, _i18n("Create a new directory with the name:"))
     self._entry_custom = gtk.Entry()
     self._hbox_custom = gtk.HBox()
     
     # Set callbacks
     self._button_init.connect('clicked', self._on_init_clicked)
     self._radio_custom.connect('toggled', self._on_custom_toggled)
     
     # Set properties
     self._entry_custom.set_sensitive(False)
     
     # Construct the dialog
     self.action_area.pack_end(self._button_init)
     
     self._hbox_custom.pack_start(self._radio_custom, False, False)
     self._hbox_custom.pack_start(self._entry_custom, True, True)
     
     self.vbox.pack_start(self._label_question)
     self.vbox.pack_start(self._radio_current)
     self.vbox.pack_start(self._hbox_custom)
     
     # Display the dialog
     self.vbox.show_all()
コード例 #22
0
ファイル: initialize.py プロジェクト: edsrzf/dotfiles
 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)
コード例 #23
0
ファイル: status.py プロジェクト: edsrzf/dotfiles
    def _generate_status(self):
        """ Generate 'bzr status' output. """
        self.model = gtk.TreeStore(str, str)
        self.treeview.set_headers_visible(False)
        self.treeview.set_model(self.model)
        self.treeview.connect("row-activated", self.row_diff)

        cell = gtk.CellRendererText()
        cell.set_property("width-chars", 20)
        column = gtk.TreeViewColumn()
        column.pack_start(cell, expand=True)
        column.add_attribute(cell, "text", 0)
        self.treeview.append_column(column)

        delta = self.wt.changes_from(self.old_tree)

        changes = False

        if len(delta.added):
            changes = True
            titer = self.model.append(None, [ _i18n('Added'), None ])
            for path, id, kind in delta.added:
                self.model.append(titer, [ path, path ])

        if len(delta.removed):
            changes = True
            titer = self.model.append(None, [ _i18n('Removed'), None ])
            for path, id, kind in delta.removed:
                self.model.append(titer, [ path, path ])

        if len(delta.renamed):
            changes = True
            titer = self.model.append(None, [ _i18n('Renamed'), None ])
            for oldpath, newpath, id, kind, text_modified, meta_modified \
                    in delta.renamed:
                self.model.append(titer, [ oldpath, newpath ])

        if len(delta.modified):
            changes = True
            titer = self.model.append(None, [ _i18n('Modified'), None ])
            for path, id, kind, text_modified, meta_modified in delta.modified:
                self.model.append(titer, [ path, path ])

        done_unknown = False
        for path in self.wt.unknowns():
            changes = True
            if not done_unknown:
                titer = self.model.append(None, [ _i18n('Unknown'), None ])
                done_unknown = True
            self.model.append(titer, [ path, path ])

        if not changes:
            self.model.append(None, [ _i18n('No changes.'), None ])

        self.treeview.expand_all()
コード例 #24
0
ファイル: conflicts.py プロジェクト: edsrzf/dotfiles
 def __init__(self, wt, parent=None):
     """ Initialize the Conflicts dialog. """
     gtk.Dialog.__init__(self, title="Conflicts - Olive",
                               parent=parent,
                               flags=0,
                               buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CANCEL))
     
     # Get arguments
     self.wt = wt
     
     # Create the widgets
     self._scrolledwindow = gtk.ScrolledWindow()
     self._treeview = gtk.TreeView()
     self._label_diff3 = gtk.Label(_i18n("External utility:"))
     self._entry_diff3 = gtk.Entry()
     self._image_diff3 = gtk.Image()
     self._button_diff3 = gtk.Button()
     self._hbox_diff3 = gtk.HBox()
     
     # Set callbacks
     self._button_diff3.connect('clicked', self._on_diff3_clicked)
     
     # Set properties
     self._scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC,
                                     gtk.POLICY_AUTOMATIC)
     self._image_diff3.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_BUTTON)
     self._button_diff3.set_image(self._image_diff3)
     self._entry_diff3.set_text(self._get_diff3())
     self._hbox_diff3.set_spacing(3)
     self.vbox.set_spacing(3)
     self.set_default_size(400, 300)
     
     # Construct dialog
     self._hbox_diff3.pack_start(self._label_diff3, False, False)
     self._hbox_diff3.pack_start(self._entry_diff3, True, True)
     self._hbox_diff3.pack_start(self._button_diff3, False, False)
     self._scrolledwindow.add(self._treeview)
     self.vbox.pack_start(self._scrolledwindow, True, True)
     self.vbox.pack_start(self._hbox_diff3, False, False)
     
     # Create the conflict list
     self._create_conflicts()
     
     # Show the dialog
     self.vbox.show_all()
コード例 #25
0
ファイル: tags.py プロジェクト: edsrzf/dotfiles
 def _tags_not_supported(self):
     """ Tags are not supported. """
     self._model.append([_i18n("Tags are not supported by this branch format. Please upgrade."), ""])
     self._button_add.set_sensitive(False)
     self._button_remove.set_sensitive(False)
コード例 #26
0
ファイル: diff.py プロジェクト: edsrzf/dotfiles
 def _conflicts(self):
     warning_dialog(_i18n('Conflicts encountered'),
                    _i18n('Please resolve the conflicts manually'
                          ' before committing.'))
コード例 #27
0
ファイル: diff.py プロジェクト: edsrzf/dotfiles
 def _merge_successful(self):
     # No conflicts found.
     info_dialog(_i18n('Merge successful'),
                 _i18n('All changes applied successfully.'))
コード例 #28
0
ファイル: tags.py プロジェクト: edsrzf/dotfiles
 def _no_tags_available(self):
     """ No tags in the branch. """
     self._model.append([_i18n("No tagged revisions in the branch."), ""])
     self._button_add.set_sensitive(True)
     self._button_remove.set_sensitive(False)
コード例 #29
0
ファイル: checkout.py プロジェクト: edsrzf/dotfiles
 def __init__(self, path=None, parent=None, remote_path=None):
     """ Initialize the Checkout dialog. """
     gtk.Dialog.__init__(self, title="Checkout - Olive",
                               parent=parent,
                               flags=0,
                               buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
     
     # Get arguments
     self.path = path
     
     # Create the widgets
     self._button_checkout = gtk.Button(_i18n("Check_out"), use_underline=True)
     self._button_revision = gtk.Button('')
     self._image_browse = gtk.Image()
     self._filechooser = gtk.FileChooserButton(_i18n("Please select a folder"))
     self._combo = gtk.ComboBoxEntry()
     self._label_location = gtk.Label(_i18n("Branch location:"))
     self._label_destination = gtk.Label(_i18n("Destination:"))
     self._label_nick = gtk.Label(_i18n("Branch nick:"))
     self._label_revision = gtk.Label(_i18n("Revision:"))
     self._hbox_revision = gtk.HBox()
     self._entry_revision = gtk.Entry()
     self._entry_nick = gtk.Entry()
     self._check_lightweight = gtk.CheckButton(_i18n("_Lightweight checkout"),
                                               use_underline=True)
     
     # Set callbacks
     self._button_checkout.connect('clicked', self._on_checkout_clicked)
     self._button_revision.connect('clicked', self._on_revision_clicked)
     self._combo.child.connect('focus-out-event', self._on_combo_changed)
     
     # Create the table and pack the widgets into it
     self._table = gtk.Table(rows=3, columns=2)
     self._table.attach(self._label_location, 0, 1, 0, 1)
     self._table.attach(self._label_destination, 0, 1, 1, 2)
     self._table.attach(self._label_nick, 0, 1, 2, 3)
     self._table.attach(self._label_revision, 0, 1, 3, 4)
     self._table.attach(self._combo, 1, 2, 0, 1)
     self._table.attach(self._filechooser, 1, 2, 1, 2)
     self._table.attach(self._entry_nick, 1, 2, 2, 3)
     self._table.attach(self._hbox_revision, 1, 2, 3, 4)
     self._table.attach(self._check_lightweight, 1, 2, 4, 5)
     
     # Set properties
     self._image_browse.set_from_stock(gtk.STOCK_OPEN, gtk.ICON_SIZE_BUTTON)
     self._button_revision.set_image(self._image_browse)
     self._button_revision.set_sensitive(False)
     self._filechooser.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
     self._label_location.set_alignment(0, 0.5)
     self._label_destination.set_alignment(0, 0.5)
     self._label_nick.set_alignment(0, 0.5)
     self._label_revision.set_alignment(0, 0.5)
     self._table.set_row_spacings(3)
     self._table.set_col_spacings(3)
     self.vbox.set_spacing(3)
     if self.path is not None:
         self._filechooser.set_filename(self.path)
     if remote_path is not None:
         self._combo.child.set_text(remote_path)
     
     # Pack some widgets
     self._hbox_revision.pack_start(self._entry_revision, True, True)
     self._hbox_revision.pack_start(self._button_revision, False, False)
     self.vbox.add(self._table)
     self.action_area.pack_end(self._button_checkout)
     
     # Show the dialog
     self.vbox.show_all()
     
     # Build checkout history
     self._history = UrlHistory(GlobalConfig(), 'branch_history')
     self._build_history()
コード例 #30
0
ファイル: tags.py プロジェクト: edsrzf/dotfiles
    def __init__(self, branch, parent=None):
        """ Initialize the Tags window. """
        Window.__init__(self, parent)

        # Get arguments
        self.branch = branch

        # Create the widgets
        self._button_add = gtk.Button(stock=gtk.STOCK_ADD)
        self._button_remove = gtk.Button(stock=gtk.STOCK_REMOVE)
        self._button_refresh = gtk.Button(stock=gtk.STOCK_REFRESH)
        self._button_close = gtk.Button(stock=gtk.STOCK_CLOSE)
        self._model = gtk.ListStore(str, str)
        self._treeview_tags = gtk.TreeView(self._model)
        self._scrolledwindow_tags = gtk.ScrolledWindow()
        self._revisionview = RevisionView()
        self._hbox = gtk.HBox()
        self._vbox_buttons = gtk.VBox()
        self._vbox_buttons_top = gtk.VBox()
        self._vbox_buttons_bottom = gtk.VBox()
        self._vpaned = gtk.VPaned()
        
        # Set callbacks
        self._button_add.connect('clicked', self._on_add_clicked)
        self._button_close.connect('clicked', self._on_close_clicked)
        self._button_refresh.connect('clicked', self._on_refresh_clicked)
        self._button_remove.connect('clicked', self._on_remove_clicked)
        self._treeview_tags.connect('cursor-changed', self._on_treeview_changed)
        
        # Set properties
        self.set_title(_i18n("Tags"))
        self.set_default_size(600, 400)
        
        self._scrolledwindow_tags.set_policy(gtk.POLICY_AUTOMATIC,
                                             gtk.POLICY_AUTOMATIC)
        
        self._hbox.set_border_width(5)
        self._hbox.set_spacing(5)
        self._vbox_buttons.set_size_request(100, -1)
        
        self._vbox_buttons_top.set_spacing(3)
        
        self._vpaned.set_position(200)
        
        # Construct the dialog
        self._scrolledwindow_tags.add(self._treeview_tags)
        
        self._vbox_buttons_top.pack_start(self._button_add, False, False)
        self._vbox_buttons_top.pack_start(self._button_remove, False, False)
        self._vbox_buttons_top.pack_start(self._button_refresh, False, False)
        self._vbox_buttons_bottom.pack_start(self._button_close, False, False)
        
        self._vbox_buttons.pack_start(self._vbox_buttons_top, True, True)
        self._vbox_buttons.pack_start(self._vbox_buttons_bottom, False, False)
        
        self._vpaned.add1(self._scrolledwindow_tags)
        self._vpaned.add2(self._revisionview)
        
        self._hbox.pack_start(self._vpaned, True, True)
        self._hbox.pack_start(self._vbox_buttons, False, True)
        
        self.add(self._hbox)
        
        # Default to no tags
        self._no_tags = True
        
        # Load the tags
        self._load_tags()
        
        # Display everything
        self._hbox.show_all()