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 _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 #3
0
 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)
Exemple #4
0
 def _email_clicked(self, toolbutton, data=None):
     path = self._pathtext.get_text()
     if not path:
         info_dialog(self, 'No repository selected',
                 'Select a peer repository to compare with')
         self._pathbox.grab_focus()
         return
     from hgemail import EmailDialog
     dlg = EmailDialog(self.root, ['--outgoing', path])
     dlg.set_transient_for(self)
     dlg.show_all()
     dlg.present()
     dlg.set_transient_for(None)
Exemple #5
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 #6
0
 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)
Exemple #7
0
 def _merge_successful(self):
     # No conflicts found.
     info_dialog(_i18n('Merge successful'),
                 _i18n('All changes applied successfully.'))