当前位置: 首页>>代码示例>>Python>>正文


Python hglib.fromunicode函数代码示例

本文整理汇总了Python中tortoisehg.util.hglib.fromunicode函数的典型用法代码示例。如果您正苦于以下问题:Python fromunicode函数的具体用法?Python fromunicode怎么用?Python fromunicode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了fromunicode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setpathmap

 def setpathmap(self, path, localpath):
     """change path mapping at the specified index"""
     self._config.set('paths', hglib.fromunicode(path),
                      hglib.fromunicode(localpath))
     row = self._indexofpath(path)
     self.dataChanged.emit(self.index(row, 0),
                           self.index(row, self.columnCount()))
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:7,代码来源:webconf.py

示例2: editSelected

 def editSelected(self, path, rev, line):
     """Open editor to show the specified file"""
     path = hglib.fromunicode(path)
     base = visdiff.snapshot(self.repo, [path], self.repo[rev])[0]
     files = [os.path.join(base, path)]
     pattern = hglib.fromunicode(self._lastSearch[0])
     qtlib.editfiles(self.repo, files, line, pattern, self)
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:7,代码来源:fileview.py

示例3: launchtool

def launchtool(cmd, opts, replace, block):
    def quote(match):
        key = match.group()[1:]
        return util.shellquote(replace[key])
    if isinstance(cmd, unicode):
        cmd = hglib.fromunicode(cmd)
    lopts = []
    for opt in opts:
        if isinstance(opt, unicode):
            lopts.append(hglib.fromunicode(opt))
        else:
            lopts.append(opt)
    args = ' '.join(lopts)
    args = re.sub(_regex, quote, args)
    cmdline = util.shellquote(cmd) + ' ' + args
    cmdline = util.quotecommand(cmdline)
    try:
        proc = subprocess.Popen(cmdline, shell=True,
                                creationflags=qtlib.openflags,
                                stderr=subprocess.PIPE,
                                stdout=subprocess.PIPE,
                                stdin=subprocess.PIPE)
        if block:
            proc.communicate()
    except (OSError, EnvironmentError), e:
        QMessageBox.warning(None,
                _('Tool launch failure'),
                _('%s : %s') % (cmd, str(e)))
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:28,代码来源:visdiff.py

示例4: mqNewRefreshCommand

def mqNewRefreshCommand(repo, isnew, stwidget, pnwidget, message, opts, olist):
    if isnew:
        name = hglib.fromunicode(pnwidget.text())
        if not name:
            qtlib.ErrorMsgBox(_('Patch Name Required'),
                              _('You must enter a patch name'))
            pnwidget.setFocus()
            return
        cmdline = ['qnew', '--repository', repo.root, name]
    else:
        cmdline = ['qrefresh', '--repository', repo.root]
    if message:
        cmdline += ['--message=' + hglib.fromunicode(message)]
    cmdline += getUserOptions(opts, *olist)
    files = ['--'] + [repo.wjoin(x) for x in stwidget.getChecked()]
    addrem = [repo.wjoin(x) for x in stwidget.getChecked('!?')]
    if len(files) > 1:
        cmdline += files
    else:
        cmdline += ['--exclude', repo.root]
    if addrem:
        cmdlines = [ ['addremove', '-R', repo.root] + addrem, cmdline]
    else:
        cmdlines = [cmdline]
    return cmdlines
开发者ID:velorientc,项目名称:git_test7,代码行数:25,代码来源:mqutil.py

示例5: checkToggled

 def checkToggled(self, wfile, checked):
     'user has toggled a checkbox, update partial chunk selection status'
     wfile = hglib.fromunicode(wfile)
     if wfile in self.partials:
         del self.partials[wfile]
         if wfile == hglib.fromunicode(self.fileview.filePath()):
             self.onCurrentChange(self.tv.currentIndex())
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:7,代码来源:status.py

示例6: accept

 def accept(self):
     try:
         hglib.fromunicode(self.textValue())
         return super(_EncodingSafeInputDialog, self).accept()
     except UnicodeEncodeError:
         WarningMsgBox(_('Text Translation Failure'),
                       _('Unable to translate input to local encoding.'),
                       parent=self)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:8,代码来源:qtlib.py

示例7: onAddTag

    def onAddTag(self):
        if self.cmd.core.running():
            self.set_status(_("Repository command still running"), False)
            return

        tagu = self.tagCombo.currentText()
        tag = hglib.fromunicode(tagu)
        local = self.localCheckBox.isChecked()
        force = self.replaceCheckBox.isChecked()
        english = self.englishCheckBox.isChecked()
        if self.customCheckBox.isChecked():
            message = self.customTextLineEdit.text()
        else:
            message = None

        exists = tag in self.repo.tags()
        if exists and not force:
            self.set_status(_("Tag '%s' already exists") % tagu, False)
            return
        if not local:
            parents = self.repo.parents()
            if len(parents) > 1:
                self.set_status(_("uncommitted merge"), False)
                return
            p1 = parents[0]
            if not force and p1.node() not in self.repo._branchheads:
                self.set_status(_("not at a branch head (use force)"), False)
                return
            if not message:
                ctx = self.repo[self.rev]
                if exists:
                    origctx = self.repo[self.repo.tags()[tag]]
                    msgset = keep._("Moved tag %s to changeset %s" " (from changeset %s)")
                    message = (english and msgset["id"] or msgset["str"]) % (tagu, str(ctx), str(origctx))
                else:
                    msgset = keep._("Added tag %s for changeset %s")
                    message = (english and msgset["id"] or msgset["str"]) % (tagu, str(ctx))
            message = hglib.fromunicode(message)

        def finished():
            if exists:
                self.set_status(_("Tag '%s' has been moved") % tagu, True)
            else:
                self.set_status(_("Tag '%s' has been added") % tagu, True)

        user = qtlib.getCurrentUsername(self, self.repo)
        if not user:
            return
        cmd = ["tag", "--repository", self.repo.root, "--rev", str(self.rev), "--user", user]
        if local:
            cmd.append("--local")
        else:
            cmd.append("--message=%s" % message)
        if force:
            cmd.append("--force")
        cmd.append(tag)
        self.finishfunc = finished
        self.cmd.run(cmd)
开发者ID:velorientc,项目名称:git_test7,代码行数:58,代码来源:tag.py

示例8: addpathmap

 def addpathmap(self, path, localpath):
     """add path mapping to serve"""
     assert path not in self.paths
     self.beginInsertRows(QModelIndex(), self.rowCount(), self.rowCount())
     try:
         self._config.set('paths', hglib.fromunicode(path),
                          hglib.fromunicode(localpath))
     finally:
         self.endInsertRows()
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:9,代码来源:webconf.py

示例9: updateIniValue

 def updateIniValue(section, key, newvalue):
     section = hglib.fromunicode(section)
     key = hglib.fromunicode(key)
     try:
         del ini[section][key]
     except KeyError:
         pass
     if newvalue is not None:
         ini.set(section, key, newvalue)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:9,代码来源:customtools.py

示例10: getCmd

 def getCmd(self, cwd):
     cmd = ['pnew', '--cwd', cwd, hglib.fromunicode(self.patchname())]
     optList = [('patchtext','--text'),
                ('patchdate','--date'),
                ('patchuser','--user')]
     for v,o in optList:
         if getattr(self,v+'cb').isChecked():
             cmd.extend([o,hglib.fromunicode(getattr(self,v+'le').text())])
     return cmd
开发者ID:velorientc,项目名称:git_test7,代码行数:9,代码来源:pbranch.py

示例11: value

 def value(self):
     hooks = {}
     for r in range(self.hooktable.rowCount()):
         hooktype = hglib.fromunicode(self.hooktable.item(r, 0).text())
         hookname = hglib.fromunicode(self.hooktable.item(r, 1).text())
         command = hglib.fromunicode(self.hooktable.item(r, 2).text())
         if hooktype not in hooks:
             hooks[hooktype] = {}
         hooks[hooktype][hookname] = command
     return hooks
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:10,代码来源:customtools.py

示例12: findHooks

 def findHooks(self, hooktype=None, hookname=None, command=None):
     matchingrows = []
     for r in range(self.hooktable.rowCount()):
         currhooktype = hglib.fromunicode(self.hooktable.item(r, 0).text())
         currhookname = hglib.fromunicode(self.hooktable.item(r, 1).text())
         currcommand = hglib.fromunicode(self.hooktable.item(r, 2).text())
         matchinghooktype = hooktype is None or hooktype == currhooktype
         matchinghookname = hookname is None or hookname == currhookname
         matchingcommand = command is None or command == currcommand
         if matchinghooktype and matchinghookname and matchingcommand:
             matchingrows.append(r)
     return matchingrows
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:12,代码来源:customtools.py

示例13: setData

 def setData(self, column, value):
     if column == 0:
         shortname = hglib.fromunicode(value.toString())
         abshgrcpath = os.path.join(hglib.fromunicode(self.rootpath()),
                                    '.hg', 'hgrc')
         if not hgrcutil.setConfigValue(abshgrcpath, 'web.name', shortname):
             qtlib.WarningMsgBox(_('Unable to update repository name'),
                 _('An error occurred while updating the repository hgrc '
                   'file (%s)') % hglib.tounicode(abshgrcpath))
             return False
         self.setShortName(value.toString())
         return True
     return False
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:13,代码来源:repotreeitem.py

示例14: qqueueRename

 def qqueueRename(self):
     uq = self.ql.item(self.ql.currentRow()).text()
     q = hglib.fromunicode(uq)
     if q == 'patches':
         return
     title = _('TortoiseHg Prompt')
     # this is the only way I found to make that dialog wide enough :(
     label = (_("Rename patch queue '%s' to") % uq) + (u' ' * 30)
     newqname, ok = qtlib.getTextInput(self, title, label)
     if newqname:
         newqname = hglib.fromunicode(newqname)
     if newqname and ok:
         opts = ['--rename', newqname]
         self.qqueueCommand(opts)
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:14,代码来源:qqueue.py

示例15: appendSubrepos

    def appendSubrepos(self, repo=None):
        self._sharedpath = ''
        invalidRepoList = []
        try:
            sri = None
            if repo is None:
                if not os.path.exists(self._root):
                    self._valid = False
                    return [hglib.fromunicode(self._root)]
                elif (not os.path.exists(os.path.join(self._root, '.hgsub'))
                      and not os.path.exists(
                          os.path.join(self._root, '.hg', 'sharedpath'))):
                    return []  # skip repo creation, which is expensive
                repo = hg.repository(ui.ui(), hglib.fromunicode(self._root))
            if repo.sharedpath != repo.path:
                self._sharedpath = hglib.tounicode(repo.sharedpath)
            wctx = repo['.']
            sortkey = lambda x: os.path.basename(util.normpath(repo.wjoin(x)))
            for subpath in sorted(wctx.substate, key=sortkey):
                sri = None
                abssubpath = repo.wjoin(subpath)
                subtype = wctx.substate[subpath][2]
                sriIsValid = os.path.isdir(abssubpath)
                sri = _newSubrepoItem(hglib.tounicode(abssubpath),
                                      repotype=subtype)
                sri._valid = sriIsValid
                self.appendChild(sri)

                if not sriIsValid:
                    self._valid = False
                    sri._valid = False
                    invalidRepoList.append(repo.wjoin(subpath))
                    return invalidRepoList

                if subtype == 'hg':
                    # Only recurse into mercurial subrepos
                    sctx = wctx.sub(subpath)
                    invalidSubrepoList = sri.appendSubrepos(sctx._repo)
                    if invalidSubrepoList:
                        self._valid = False
                        invalidRepoList += invalidSubrepoList

        except (EnvironmentError, error.RepoError, util.Abort), e:
            # Add the repo to the list of repos/subrepos
            # that could not be open
            self._valid = False
            if sri:
                sri._valid = False
                invalidRepoList.append(abssubpath)
            invalidRepoList.append(hglib.fromunicode(self._root))
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:50,代码来源:repotreeitem.py


注:本文中的tortoisehg.util.hglib.fromunicode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。