示例#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)
示例#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('')
示例#3
0
文件: merge.py 项目: Plenoge/git-cola
 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)
示例#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('')
示例#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()
示例#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()
示例#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()
示例#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)
示例#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)
示例#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)
示例#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)
示例#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()
示例#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)
示例#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()
示例#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()
示例#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()
示例#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)
示例#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()
示例#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('')
示例#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()
示例#21
0
文件: stash.py 项目: jmdcal/git-cola
 def selected_name(self):
     list_widget = self.stash_list
     stash_list = self.names
     return qtutils.selected_item(list_widget, stash_list)
示例#22
0
文件: stash.py 项目: jmdcal/git-cola
 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)
示例#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]
示例#24
0
文件: search.py 项目: Jobava/git-cola
 def selected_revision(self):
     result = qtutils.selected_item(self.commit_list, self.results)
     if result is None:
         return None
     else:
         return result[0]
示例#25
0
 def selected_commit(self):
     return qtutils.selected_item(self.commit_list, self.model.revisions)
示例#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)
示例#27
0
 def selected_name(self):
     list_widget = self.stash_list
     stash_list = self.names
     return qtutils.selected_item(list_widget, stash_list)
示例#28
0
 def selected_commit(self):
     return qtutils.selected_item(self.commit_list, self.model.revisions)
示例#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()