Ejemplo n.º 1
0
 def revision_selected(self):
     """Update the revision field when a list item is selected"""
     revlist = self.current_revisions()
     widget = self.revisions
     revision = qtutils.selected_item(widget, revlist)
     if revision is not None:
         self.revision.setText(revision)
Ejemplo n.º 2
0
    def update_remotes(self, *rest):
        """Update the remote name when a remote from the list is selected"""
        widget = self.remotes
        remotes = self.model.remotes
        selection = qtutils.selected_item(widget, remotes)
        if not selection:
            self.selected_remotes = []
            return
        self.set_remote_name(selection)
        self.selected_remotes = qtutils.selected_items(self.remotes,
                                                       self.model.remotes)

        all_branches = gitcmds.branch_list(remote=True)
        branches = []
        patterns = []
        for remote in self.selected_remotes:
            pat = remote + '/*'
            patterns.append(pat)

        for branch in all_branches:
            for pat in patterns:
                if fnmatch.fnmatch(branch, pat):
                    branches.append(branch)
                    break
        if branches:
            self.set_remote_branches(branches)
        else:
            self.set_remote_branches(all_branches)
        self.set_remote_branch('')
Ejemplo n.º 3
0
 def revision_selected(self):
     """Update the revision field when a list item is selected"""
     revlist = self.current_revisions()
     widget = self.revisions
     revision = qtutils.selected_item(widget, revlist)
     if revision is not None:
         self.revision.setText(revision)
Ejemplo n.º 4
0
    def update_remotes(self, *rest):
        """Update the remote name when a remote from the list is selected"""
        widget = self.remotes
        remotes = self.model.remotes
        selection = qtutils.selected_item(widget, remotes)
        if not selection:
            self.selected_remotes = []
            return
        self.set_remote_name(selection)
        self.selected_remotes = qtutils.selected_items(self.remotes,
                                                       self.model.remotes)

        all_branches = gitcmds.branch_list(remote=True)
        branches = []
        patterns = []
        for remote in self.selected_remotes:
            pat = remote + '/*'
            patterns.append(pat)

        for branch in all_branches:
            for pat in patterns:
                if fnmatch.fnmatch(branch, pat):
                    branches.append(branch)
                    break
        if branches:
            self.set_remote_branches(branches)
        else:
            self.set_remote_branches(all_branches)
        self.set_remote_branch('')
Ejemplo n.º 5
0
 def update_remotes(self,*rest):
     """Update the remote name when a remote from the list is selected"""
     widget = self.view.remotes
     remotes = self.model.remotes
     selection = qtutils.selected_item(widget, remotes)
     if not selection:
         return
     self.model.set_remotename(selection)
     self.view.remotename.selectAll()
Ejemplo n.º 6
0
    def selection_changed(self):
        remote = qtutils.selected_item(self.remotes, self.remote_list)
        if remote is None:
            return
        self.info.hint.set_value(N_('Gathering info for "%s"...') % remote)
        self.info.hint.enable(True)

        self.info_thread.remote = remote
        self.info_thread.start()
Ejemplo n.º 7
0
    def selection_changed(self):
        remote = qtutils.selected_item(self.remotes, self.remote_list)
        if remote is None:
            return
        self.info.set_hint(N_('Gathering info for "%s"...') % remote)
        self.info.enable_hint(True)

        self.info_thread.remote = remote
        self.info_thread.start()
Ejemplo n.º 8
0
 def update_local_branches(self,*rest):
     """Update the local/remote branch names when a branch is selected"""
     branches = self.model.local_branches
     widget = self.local_branches
     selection = qtutils.selected_item(widget, branches)
     if not selection:
         return
     self.set_local_branch(selection)
     self.set_remote_branch(selection)
Ejemplo n.º 9
0
 def update_local_branches(self, *rest):
     """Update the local/remote branch names when a branch is selected"""
     branches = self.model.local_branches
     widget = self.local_branches
     selection = qtutils.selected_item(widget, branches)
     if not selection:
         return
     self.set_local_branch(selection)
     self.set_remote_branch(selection)
Ejemplo n.º 10
0
 def update_remote_branches(self, *rest):
     """Update the remote branch name when a branch is selected"""
     widget = self.remote_branches
     branches = self.filtered_remote_branches
     selection = qtutils.selected_item(widget, branches)
     if not selection:
         return
     branch = utils.strip_one(selection)
     if branch == 'HEAD':
         return
     self.set_remote_branch(branch)
Ejemplo n.º 11
0
 def update_remote_branches(self,*rest):
     """Update the remote branch name when a branch is selected"""
     widget = self.remote_branches
     branches = self.filtered_remote_branches
     selection = qtutils.selected_item(widget, branches)
     if not selection:
         return
     branch = utils.strip_one(selection)
     if branch == 'HEAD':
         return
     self.set_remote_branch(branch)
Ejemplo n.º 12
0
 def update_remote_branches(self,*rest):
     """Update the remote branch name when a branch is selected"""
     widget = self.view.remote_branches
     branches = self.model.remote_branches
     selection = qtutils.selected_item(widget,branches)
     if not selection:
         return
     branch = utils.basename(selection)
     if branch == 'HEAD':
         return
     self.model.set_remote_branch(branch)
     self.view.remote_branch.selectAll()
Ejemplo n.º 13
0
    def commit_sha1_selected(self):
        sha1  = qtutils.selected_item(self.commit_list, self.model.revisions)
        selected = (sha1 is not None)
        self.select_button.setEnabled(selected)
        if not selected:
            self.commit_text.setText('')
            self.revision.setText('')
            return
        self.revision.setText(sha1)
        self.revision.selectAll()

        # Display the sha1's commit
        commit_diff = gitcmds.commit_diff(sha1)
        self.commit_text.setText(commit_diff)
Ejemplo n.º 14
0
    def delete(self):
        remote = qtutils.selected_item(self.remotes, self.remote_list)
        if remote is None:
            return

        title = N_("Delete Remote")
        question = N_("Delete remote?")
        info = N_('Delete remote "%s"') % remote
        ok_btn = N_("Delete")
        if not qtutils.confirm(title, question, info, ok_btn):
            return

        status, out = git.remote("rm", remote, with_status=True, with_stderr=True)
        if status != 0:
            qtutils.critical(N_('Error deleting remote "%s"') % remote, out)
        cola.model().update_status()
        self.refresh()
Ejemplo n.º 15
0
    def delete(self):
        remote = qtutils.selected_item(self.remotes, self.remote_list)
        if remote is None:
            return

        title = N_('Delete Remote')
        question = N_('Delete remote?')
        info = N_('Delete remote "%s"') % remote
        ok_btn = N_('Delete')
        if not qtutils.confirm(title, question, info, ok_btn):
            return

        status, out, err = git.remote('rm', remote)
        if status != 0:
            qtutils.critical(
                N_('Error deleting remote "%s"') % remote, out + err)
        main.model().update_status()
        self.refresh()
Ejemplo n.º 16
0
    def delete(self):
        remote = qtutils.selected_item(self.remotes, self.remote_list)
        if remote is None:
            return

        title = N_('Delete Remote')
        question = N_('Delete remote?')
        info = N_('Delete remote "%s"') % remote
        ok_btn = N_('Delete')
        if not qtutils.confirm(title, question, info, ok_btn):
            return

        status, out, err = git.remote('rm', remote)
        if status != 0:
            qtutils.critical(N_('Error deleting remote "%s"') % remote,
                             out + err)
        main.model().update_status()
        self.refresh()
Ejemplo n.º 17
0
    def branch_item_changed(self, *rest):
        """This callback is called when the branch selection changes"""
        # When the branch selection changes then we should update
        # the "Revision Expression" accordingly.
        qlist = self.branch_list
        rev = qtutils.selected_item(qlist, self.branch_sources())
        if rev is None:
            return
        # Update the model with the selection
        self.revision.setText(rev)

        # Set the branch field if we're branching from a remote branch.
        if not self.remote_radio.isChecked():
            return
        branch = utils.basename(rev)
        if branch == 'HEAD':
            return
        # Signal that we've clicked on a remote branch
        self.branch_name.setText(branch)
Ejemplo n.º 18
0
    def delete(self):
        remote = qtutils.selected_item(self.remotes, self.remote_list)
        if remote is None:
            return

        title = 'Delete Remote'
        question = 'Delete remote?'
        info = unicode(self.tr('Delete remote "%s"')) % remote
        ok_btn = 'Delete'
        if not qtutils.confirm(title, question, info, ok_btn):
            return

        status, out = git.remote('rm',
                                 remote,
                                 with_status=True,
                                 with_stderr=True)
        if status != 0:
            qtutils.critical('Error deleting remote "%s"' % remote, out)
        cola.model().update_status()
        self.refresh()
Ejemplo n.º 19
0
    def update_remotes(self,*rest):
        """Update the remote name when a remote from the list is selected"""
        widget = self.view.remotes
        remotes = self.model.remotes
        selection = qtutils.selected_item(widget, remotes)
        if not selection:
            return
        self.model.set_remotename(selection)
        self.view.remotename.selectAll()

        if self.action != 'pull':
            pass
        all_branches = gitcmds.branch_list(remote=True)
        branches = []
        pat = selection + '/*'
        for branch in all_branches:
            if fnmatch.fnmatch(branch, pat):
                branches.append(branch)
        if branches:
            self.model.set_remote_branches(branches)
        else:
            self.model.set_remote_branches(all_branches)
        self.model.set_remote_branch('')
Ejemplo n.º 20
0
 def delete(self):
     remote = qtutils.selected_item(self.remotes, self.remote_list)
     if remote is None:
         return
     cmds.do(cmds.RemoteRemove, remote)
     self.refresh()
Ejemplo n.º 21
0
 def selected_name(self):
     list_widget = self.stash_list
     stash_list = self.names
     return qtutils.selected_item(list_widget, stash_list)
Ejemplo n.º 22
0
 def selected_stash(self):
     """Returns the stash name of the currently selected stash
     """
     list_widget = self.stash_list
     stash_list = self.revids
     return qtutils.selected_item(list_widget, stash_list)
Ejemplo n.º 23
0
 def selected_revision(self):
     result = qtutils.selected_item(self.commit_list, self.results)
     if result is None:
         return None
     else:
         return result[0]
Ejemplo n.º 24
0
 def selected_revision(self):
     result = qtutils.selected_item(self.commit_list, self.results)
     if result is None:
         return None
     else:
         return result[0]
Ejemplo n.º 25
0
 def selected_commit(self):
     return qtutils.selected_item(self.commit_list, self.model.revisions)
Ejemplo n.º 26
0
 def selected_stash(self):
     """Returns the stash name of the currently selected stash
     """
     list_widget = self.stash_list
     stash_list = self.revids
     return qtutils.selected_item(list_widget, stash_list)
Ejemplo n.º 27
0
 def selected_name(self):
     list_widget = self.stash_list
     stash_list = self.names
     return qtutils.selected_item(list_widget, stash_list)
Ejemplo n.º 28
0
 def selected_commit(self):
     return qtutils.selected_item(self.commit_list, self.model.revisions)
Ejemplo n.º 29
0
 def delete(self):
     remote = qtutils.selected_item(self.remotes, self.remote_list)
     if remote is None:
         return
     cmds.do(cmds.RemoteRemove, remote)
     self.refresh()