Ejemplo n.º 1
0
    def operationComplete(self):
        locks = self.refillModel()
        self._updateUi()

        op, wfile = self.operation[:2]
        if op == 'lock':
            if wfile in locks and locks[wfile][1]:
                self.showMessage.emit(_('Lock of %s successful') % wfile)
                qtlib.openlocalurl(self.operation[1])
            else:
                self.showMessage.emit(_('Lock of %s failed, retry') % wfile)
        elif op == 'unlock':
            if wfile in locks and locks[wfile][1]:
                self.showMessage.emit(_('Unlock of %s failed, retry') % wfile)
            else:
                self.showMessage.emit(_('Unlock of %s successful') % wfile)
        elif locks:
            self.showMessage.emit(_('Ready, double click to lock or unlock'))
        else:
            self.showMessage.emit(_('Ready'))
        self.operation = ['N/A', None]
Ejemplo n.º 2
0
 def explore(self):
     root = self.selitem.internalPointer().rootpath()
     qtlib.openlocalurl(root)
Ejemplo n.º 3
0
 def explore(self):
     root = self._repo.wjoin(hglib.fromunicode(self.path))
     if os.path.isdir(root):
         qtlib.openlocalurl(root)
Ejemplo n.º 4
0
 def explore(self):
     root = self.repo.wjoin(self.filelist.currentFile())
     if os.path.isdir(root):
         qtlib.openlocalurl(root)
Ejemplo n.º 5
0
 def explore(self, fds):
     for fd in fds:
         qtlib.openlocalurl(fd.absoluteFilePath())
Ejemplo n.º 6
0
 def explore(self):
     root = self.repo.wjoin(self._currentfile)
     if os.path.isdir(root):
         qtlib.openlocalurl(root)
Ejemplo n.º 7
0
 def exploreLocalFile(self, fds):
     for fd in fds:
         qtlib.openlocalurl(os.path.dirname(fd.absoluteFilePath()))
Ejemplo n.º 8
0
 def explore(self):
     w = self.repoTabsWidget.currentWidget()
     if w:
         qtlib.openlocalurl(w.repo.root)
Ejemplo n.º 9
0
 def explore(self):
     qtlib.openlocalurl(self._currentRepoRoot())
Ejemplo n.º 10
0
    def onReadme(self, *args):
        """Display the README file or URL for the current repo, or the global
        README if no repo is open"""
        readme = None
        def getCurrentReadme(repo):
            """
            Get the README file that is configured for the current repo.

            README files can be set in 3 ways, which are checked in the
            following order of decreasing priority:
            - From the tortoisehg.readme key on the current repo's configuration
              file
            - An existing "README" file found on the repository root
                * Valid README files are those called README and whose extension
                  is one of the following:
                    ['', '.txt', '.html', '.pdf', '.doc', '.docx', '.ppt', '.pptx',
                     '.markdown', '.textile', '.rdoc', '.org', '.creole',
                     '.mediawiki','.rst', '.asciidoc', '.pod']
                * Note that the match is CASE INSENSITIVE on ALL OSs.
            - From the tortoisehg.readme key on the user's global configuration file
            """
            readme = None
            if repo:
                # Try to get the README configured for the repo of the current tab
                readmeglobal = self.ui.config('tortoisehg', 'readme', None)
                if readmeglobal:
                    # Note that repo.ui.config() falls back to the self.ui.config()
                    # if the key is not set on the current repo's configuration file
                    readme = repo.ui.config('tortoisehg', 'readme', None)
                    if readmeglobal != readme:
                        # The readme is set on the current repo configuration file
                        return readme

                # Otherwise try to see if there is a file at the root of the
                # repository that matches any of the valid README file names
                # (in a non case-sensitive way)
                # Note that we try to match the valid README names in order
                validreadmes = ['readme.txt', 'read.me', 'readme.html',
                                'readme.pdf', 'readme.doc', 'readme.docx',
                                'readme.ppt', 'readme.pptx',
                                'readme.md', 'readme.markdown', 'readme.mkdn',
                                'readme.rst', 'readme.textile', 'readme.rdoc',
                                'readme.asciidoc', 'readme.org', 'readme.creole',
                                'readme.mediawiki', 'readme.pod', 'readme']

                readmefiles = [filename for filename in os.listdir(repo.root)
                               if filename.lower().startswith('read')]
                for validname in validreadmes:
                    for filename in readmefiles:
                        if filename.lower() == validname:
                            return repo.wjoin(filename)

            # Otherwise try use the global setting (or None if readme is just
            # not configured)
            return readmeglobal

        w = self._currentRepoWidget()
        if w:
            # Try to get the help doc from the current repo tap
            readme = getCurrentReadme(w.repo)

        if readme:
            qtlib.openlocalurl(os.path.expandvars(os.path.expandvars(readme)))
        else:
            qtlib.WarningMsgBox(_("README not configured"),
                _("A README file is not configured for the current repository.<p>"
                "To configure a README file for a repository, "
                "open the repository settings file, add a '<i>readme</i>' "
                "key to the '<i>tortoisehg</i>' section, and set it "
                "to the filename or URL of your repository's README file."))
Ejemplo n.º 11
0
 def explore(self):
     root = self.currentRepoRootPath()
     if root:
         qtlib.openlocalurl(hglib.fromunicode(root))