8000 git-repo/pager.py at master · lmachraf/git-repo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":".idea","path":".idea","contentType":"directory"},{"name":".settings","path":".settings","contentType":"directory"},{"name":"docs","path":"docs","contentType":"directory"},{"name":"editrights","path":"editrights","contentType":"directory"},{"name":"hooks","path":"hooks","contentType":"directory"},{"name":"subcmds","path":"subcmds","contentType":"directory"},{"name":"tests","path":"tests","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".project","path":".project","contentType":"file"},{"name":".pydevproject","path":".pydevproject","contentType":"file"},{"name":".pylintrc","path":".pylintrc","contentType":"file"},{"name":"COPYING","path":"COPYING","contentType":"file"},{"name":"NOTES.md","path":"NOTES.md","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"SUBMITTING_PATCHES","path":"SUBMITTING_PATCHES","contentType":"file"},{"name":"color.py","path":"color.py","contentType":"file"},{"name":"command.py","path":"command.py","contentType":"file"},{"name":"editor.py","path":"editor.py","contentType":"file"},{"name":"error.py","path":"error.py","contentType":"file"},{"name":"git_command.py","path":"git_command.py","contentType":"file"},{"name":"git_config.py","path":"git_config.py","contentType":"file"},{"name":"git_refs.py","path":"git_refs.py","contentType":"file"},{"name":"git_ssh","path":"git_ssh","contentType":"file"},{"name":"main.py","path":"main.py","contentType":"file"},{"name":"manifest_xml.py","path":"manifest_xml.py","contentType":"file"},{"name":"pager.py","path":"pager.py","contentType":"file"},{"name":"portable.py","path":"portable.py","contentType":"file"},{"name":"progress.py","path":"progress.py","contentType":"file"},{"name":"project.py","path":"project.py","contentType":"file"},{"name":"repo","path":"repo","contentType":"file"},{"name":"repo.cmd","path":"repo.cmd","contentType":"file"},{"name":"repo.iml","path":"repo.iml","contentType":"file"},{"name":"repo_trace.py","path":"repo_trace.py","contentType":"file"},{"name":"repoc","path":"repoc","contentType":"file"}],"totalCount":34}},"fileTreeProcessingTime":12.763747,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":48996882,"defaultBranch":"master","name":"git-repo","ownerLogin":"lmachraf","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2016-01-04T12:53:14.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/16455667?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1620162487.0612009","canEdit":false,"refType":"branch","currentOid":"397288358d2dde18e4450317db245a32126b1511"},"path":"pager.py","currentUser":null,"blob":{"rawLines":["#","# Copyright (C) 2008 The Android Open Source Project","#","# Licensed under the Apache License, Version 2.0 (the \"License\");","# you may not use this file except in compliance with the License.","# You may obtain a copy of the License at","#","# http://www.apache.org/licenses/LICENSE-2.0","#","# Unless required by applicable law or agreed to in writing, software","# distributed under the License is distributed on an \"AS IS\" BASIS,","# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.","# See the License for the specific language governing permissions and","# limitations under the License.","","","import os","import select","import sys","","active = False","","","def RunPager(globalConfig):"," global active",""," if not os.isatty(0) or not os.isatty(1):"," return"," pager = _SelectPager(globalConfig)"," if pager == '' or pager == 'cat':"," return",""," # This process turns into the pager; a child it forks will"," # do the real processing and output back to the pager. This"," # is necessary to keep the pager in control of the tty."," #"," try:"," r, w = os.pipe()"," pid = os.fork()"," if not pid:"," os.dup2(w, 1)"," os.dup2(w, 2)"," os.close(r)"," os.close(w)"," active = True"," return",""," os.dup2(r, 0)"," os.close(r)"," os.close(w)",""," _BecomePager(pager)"," except Exception:"," print(\"fatal: cannot start pager '%s'\" % pager, file=sys.stderr)"," sys.exit(255)","","","def _SelectPager(globalConfig):"," try:"," return os.environ['GIT_PAGER']"," except KeyError:"," pass",""," pager = globalConfig.GetString('core.pager')"," if pager:"," return pager",""," try:"," return os.environ['PAGER']"," except KeyError:"," pass",""," return 'less'","","","def _BecomePager(pager):"," # Delaying execution of the pager until we have output"," # ready works around a long-standing bug in popularly"," # available versions of 'less', a better 'more'."," #"," _a, _b, _c = select.select([0], [], [0])",""," os.environ['LESS'] = 'FRSX'",""," try:"," os.execvp(pager, [pager])"," except OSError:"," os.execv('/bin/sh', ['sh', '-c', pager])"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/lmachraf/git-repo/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"pager.py","displayUrl":"https://github.com/lmachraf/git-repo/blob/master/pager.py?raw=true","headerInfo":{"blobSize":"2.12 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"4dddfac","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Flmachraf%2Fgit-repo%2Fblob%2Fmaster%2Fpager.py","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"88","truncatedSloc":"70"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Python","languageID":303,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/lmachraf/git-repo/blob/master/pager.py","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/lmachraf/git-repo/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/lmachraf/git-repo/raw/refs/heads/master/pager.py","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"active","kind":"constant","ident_start":640,"ident_end":646,"extent_start":640,"extent_end":654,"fully_qualified_name":"active","ident_utf16":{"start":{"line_number":20,"utf16_col":0},"end":{"line_number":20,"utf16_col":6}},"extent_utf16":{"start":{"line_number":20,"utf16_col":0},"end":{"line_number":20,"utf16_col":14}}},{"name":"RunPager","kind":"function","ident_start":661,"ident_end":669,"extent_start":657,"extent_end":1481,"fully_qualified_name":"RunPager","ident_utf16":{"start":{"line_number":23,"utf16_col":4},"end":{"line_number":23,"utf16_col":12}},"extent_utf16":{"start":{"line_number":23,"utf16_col":0},"end":{"line_number":54,"utf16_col":21}}},{"name":"_SelectPager","kind":"function","ident_start":1488,"ident_end":1500,"extent_start":1484,"extent_end":1780,"fully_qualified_name":"_SelectPager","ident_utf16":{"start":{"line_number":57,"utf16_col":4},"end":{"line_number":57,"utf16_col":16}},"extent_utf16":{"start":{"line_number":57,"utf16_col":0},"end":{"line_number":72,"utf16_col":17}}},{"name":"_BecomePager","kind":"function","ident_start":1787,"ident_end":1799,"extent_start":1783,"extent_end":2174,"fully_qualified_name":"_BecomePager","ident_utf16":{"start":{"line_number":75,"utf16_col":4},"end":{"line_number":75,"utf16_col":16}},"extent_utf16":{"start":{"line_number":75,"utf16_col":0},"end":{"line_number":87,"utf16_col":48}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/lmachraf/git-repo/branches":{"post":"dqoH6xzNMM6zVlJRokK6n9QTkZxNVoesKtTay9KMQzHrkubD0RRC0BdnvNG_kue7rer_s3EAgNIIr0auhwwjxg"},"/repos/preferences":{"post":"4pKOp3btMPGU1_D8dWWB-hfdlbQAaQrH8boUVEhRX6yT36u2auCMknX1bQKeeqdpKLdE8vOpLOBqC4A3FI7DEA"}}},"title":"git-repo/pager.py at master · lmachraf/git-repo","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1ae9fa256942.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}
0