• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python hglib.fromunicode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: onRemoveTag

    def onRemoveTag(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

        tagtype = self.repo.tagtype(tag)
        if local:
            if tagtype != "local":
                self.set_status(_("tag '%s' is not a local tag") % tagu, False)
                return
        else:
            if tagtype != "global":
                self.set_status(_("tag '%s' is not a global tag") % tagu, False)
                return
            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:
                msgset = keep._("Removed tag %s")
                message = (english and msgset["id"] or msgset["str"]) % tagu
            message = hglib.fromunicode(message)

        def finished():
            self.set_status(_("Tag '%s' has been removed") % tagu, True)

        cmd = ["tag", "--repository", self.repo.root, "--remove"]
        if local:
            cmd.append("--local")
        else:
            cmd.append("--message=%s" % message)
        cmd.append(tag)
        self.finishfunc = finished
        self.cmd.run(cmd)
开发者ID:velorientc,项目名称:git_test7,代码行数:48,代码来源:tag.py


示例17: interact_handler

 def interact_handler(self, wrapper):
     prompt, password, choices, default = wrapper.data
     prompt = hglib.tounicode(prompt)
     if choices:
         dlg = QMessageBox(QMessageBox.Question,
                     _('TortoiseHg Prompt'), prompt, parent=self.parent())
         dlg.setWindowFlags(Qt.Sheet)
         dlg.setWindowModality(Qt.WindowModal)
         for index, choice in enumerate(choices):
             button = dlg.addButton(hglib.tounicode(choice),
                                    QMessageBox.ActionRole)
             button.response = index
             if index == default:
                 dlg.setDefaultButton(button)
         dlg.exec_()
         button = dlg.clickedButton()
         if button is 0:
             self.responseq.put(None)
         else:
             self.responseq.put(button.response)
     else:
         mode = password and QLineEdit.Password \
                          or QLineEdit.Normal
         text, ok = qtlib.getTextInput(self.parent(),
                      _('TortoiseHg Prompt'),
                      prompt.title(),
                      mode=mode)
         if ok:
             text = hglib.fromunicode(text)
         else:
             text = None
         self.responseq.put(text)
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:32,代码来源:thread.py


示例18: validatePage

    def validatePage(self):

        if self.cmd.core.running():
            return False

        if len(self.repo.parents()) == 1:
            # commit succeeded, repositoryChanged() called wizard().next()
            if self.skiplast.isChecked():
                self.wizard().close()
            return True

        user = qtlib.getCurrentUsername(self, self.repo)
        if not user:
            return False

        self.setTitle(_('Committing...'))
        self.setSubTitle(_('Please wait while committing merged files.'))

        message = hglib.fromunicode(self.msgEntry.text())
        cmdline = ['commit', '--verbose', '--message', message,
                   '--repository', self.repo.root, '--user', user]
        commandlines = [cmdline]
        pushafter = self.repo.ui.config('tortoisehg', 'cipushafter')
        if pushafter:
            cmd = ['push', '--repository', self.repo.root, pushafter]
            commandlines.append(cmd)
        self.repo.incrementBusyCount()
        self.cmd.setShowOutput(True)
        self.cmd.run(*commandlines)
        return False
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:30,代码来源:merge.py


示例19: match

    def match(self):
        self.saveSettings()
        fieldmap = {
            'summary': self.summary_chk,
            'description': self.description_chk,
            'author': self.author_chk,
            'branch': self.branch_chk,
            'date': self.date_chk,
            'files': self.files_chk,
            'diff': self.diff_chk,
            'parents': self.parents_chk,
            'phase': self.phase_chk,
            'substate': self.substate_chk,
        }
        fields = []
        for (field, chk) in fieldmap.items():
            if chk.isChecked():
                fields.append(field)

        rev = hglib.fromunicode(self.rev_combo.currentText())
        if fields:
            self.revsetexpression = ("matching(%s, '%s')"
                                     % (rev, ' '.join(fields)))
        else:
            self.revsetexpression = "matching(%s)" % rev
        self.accept()
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:26,代码来源:matching.py


示例20: dropEvent

    def dropEvent(self, event):
        data = event.mimeData()
        index, group, row = self.dropLocation(event)

        if index:
            if event.source() is self:
                # Event is an internal move, so pass it to the model
                col = 0
                drop = self.model().dropMimeData(data, event.dropAction(), row,
                                                 col, group)
                if drop:
                    event.accept()
                    self.dropAccepted.emit()
            else:
                # Event is a drop of an external repo
                accept = False
                for u in data.urls():
                    root = paths.find_root(hglib.fromunicode(u.toLocalFile()))
                    if root and not self.model().getRepoItem(root):
                        self.model().addRepo(group, root, row)
                        accept = True
                if accept:
                    event.setDropAction(Qt.LinkAction)
                    event.accept()
                    self.dropAccepted.emit()
        self.setAutoScroll(False)
        self.setState(QAbstractItemView.NoState)
        self.viewport().update()
        self.setAutoScroll(True)
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:29,代码来源:reporegistry.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python hglib.tounicode函数代码示例发布时间:2022-05-27
下一篇:
Python thgrepo.repository函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap