本文整理汇总了Python中mercurial.util.popen函数的典型用法代码示例。如果您正苦于以下问题:Python popen函数的具体用法?Python popen怎么用?Python popen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了popen函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: notify
def notify(self, ids, committer):
'''tell bugzilla to send mail.'''
self.ui.status(_('telling bugzilla to send mail:\n'))
(user, userid) = self.get_bugzilla_user(committer)
for id in ids:
self.ui.status(_(' bug %s\n') % id)
cmdfmt = self.ui.config('bugzilla', 'notify', self.default_notify)
bzdir = self.ui.config('bugzilla', 'bzdir', '/var/www/html/bugzilla')
try:
# Backwards-compatible with old notify string, which
# took one string. This will throw with a new format
# string.
cmd = cmdfmt % id
except TypeError:
cmd = cmdfmt % {'bzdir': bzdir, 'id': id, 'user': user}
self.ui.note(_('running notify command %s\n') % cmd)
fp = util.popen('(%s) 2>&1' % cmd)
out = fp.read()
ret = fp.close()
if ret:
self.ui.warn(out)
raise util.Abort(_('bugzilla notify command %s') %
util.explain_exit(ret)[0])
self.ui.status(_('done\n'))
开发者ID:Nurb432,项目名称:plan9front,代码行数:25,代码来源:bugzilla.py
示例2: _runpager
def _runpager(p):
if not hasattr(os, "fork"):
sys.stdout = util.popen(p, "wb")
if sys.stderr.isatty():
sys.stderr = sys.stdout
return
fdin, fdout = os.pipe()
pid = os.fork()
if pid == 0:
os.close(fdin)
os.dup2(fdout, sys.stdout.fileno())
if sys.stderr.isatty():
os.dup2(fdout, sys.stderr.fileno())
os.close(fdout)
return
os.dup2(fdin, sys.stdin.fileno())
os.close(fdin)
os.close(fdout)
try:
os.execvp("/bin/sh", ["/bin/sh", "-c", p])
except OSError, e:
if e.errno == errno.ENOENT:
# no /bin/sh, try executing the pager directly
args = shlex.split(p)
os.execvp(args[0], args)
else:
raise
开发者ID:vvergu,项目名称:mercurial,代码行数:27,代码来源:pager.py
示例3: _pagerfork
def _pagerfork(ui, p):
if not util.safehasattr(os, 'fork'):
sys.stdout = util.popen(p, 'wb')
if ui._isatty(sys.stderr):
sys.stderr = sys.stdout
return
fdin, fdout = os.pipe()
pid = os.fork()
if pid == 0:
os.close(fdin)
os.dup2(fdout, sys.stdout.fileno())
if ui._isatty(sys.stderr):
os.dup2(fdout, sys.stderr.fileno())
os.close(fdout)
return
os.dup2(fdin, sys.stdin.fileno())
os.close(fdin)
os.close(fdout)
try:
os.execvp('/bin/sh', ['/bin/sh', '-c', p])
except OSError, e:
if e.errno == errno.ENOENT:
# no /bin/sh, try executing the pager directly
args = shlex.split(p)
os.execvp(args[0], args)
else:
raise
开发者ID:spraints,项目名称:for-example,代码行数:27,代码来源:pager.py
示例4: _run
def _run(self, cmd, *args, **kwargs):
cmdline = self._cmdline(cmd, *args, **kwargs)
self.prerun()
try:
return util.popen(cmdline)
finally:
self.postrun()
开发者ID:carlgao,项目名称:lenga,代码行数:7,代码来源:common.py
示例5: helper
def helper():
stdout = util.popen(cmd, mode='rb')
for each in loaditer(stdout):
client_name = each.get('client', None)
if client_name is not None and client_name == client:
return True
return False
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:7,代码来源:p4.py
示例6: get_filelogs_at_cl
def get_filelogs_at_cl(client, clnum):
cmd = 'p4 --client %s -G fstat -T ' \
'"depotFile,headAction,headType,headRev" ' \
'"//%s/..."@%d' % (
util.shellquote(client),
util.shellquote(client),
clnum
)
stdout = util.popen(cmd, mode='rb')
try:
result = []
for d in loaditer(stdout):
if d.get('depotFile'):
headaction = d['headAction']
if headaction in ACTION_ARCHIVE or headaction in ACTION_DELETE:
continue
depotfile = d['depotFile']
filelog = {}
filelog[clnum] = {
'action': d['headAction'],
'type': d['headType'],
}
result.append(P4Filelog(depotfile, filelog))
return result
except Exception:
raise P4Exception(stdout)
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:26,代码来源:p4.py
示例7: content
def content(self, rev):
text = None
if os.path.isfile(self.rcspath):
cmd = 'co -kk -q -p1.%d %s' % (rev, util.shellquote(self.rcspath))
with util.popen(cmd, mode='rb') as fp:
text = fp.read()
return text
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:7,代码来源:importer.py
示例8: _run
def _run(self, cmd, *args, **kwargs):
cmdline = self._cmdline(cmd, *args, **kwargs)
self.ui.debug(_('running: %s\n') % (cmdline,))
self.prerun()
try:
return util.popen(cmdline)
finally:
self.postrun()
开发者ID:Nurb432,项目名称:plan9front,代码行数:8,代码来源:common.py
示例9: gitopen
def gitopen(self, s, err=None):
if err == subprocess.PIPE:
(sin, so, se) = util.popen3('GIT_DIR=%s %s' % (self.path, s))
return so
elif err == subprocess.STDOUT:
return self.popen_with_stderr(s)
else:
return util.popen('GIT_DIR=%s %s' % (self.path, s), 'rb')
开发者ID:RayFerr000,项目名称:PLTL,代码行数:8,代码来源:git.py
示例10: _parse_view
def _parse_view(self, path):
"Read changes affecting the path"
cmd = 'p4 -G changes -s submitted %s' % util.shellquote(path)
stdout = util.popen(cmd, mode='rb')
for d in loaditer(stdout):
c = d.get("change", None)
if c:
self.p4changes[c] = True
开发者ID:MezzLabs,项目名称:mercurial,代码行数:8,代码来源:p4.py
示例11: _parse_view
def _parse_view(self, path):
"Read changes affecting the path"
cmd = 'p4 -G changes -s submitted "%s"' % path
stdout = util.popen(cmd)
for d in loaditer(stdout):
c = d.get("change", None)
if c:
self.p4changes[c] = True
开发者ID:Nurb432,项目名称:plan9front,代码行数:8,代码来源:p4.py
示例12: pagecmd
def pagecmd(orig, ui, options, cmd, cmdfunc):
p = ui.config("pager", "pager", os.environ.get("PAGER"))
if p and sys.stdout.isatty() and "--debugger" not in sys.argv:
attend = ui.configlist("pager", "attend")
if cmd in attend or (cmd not in ui.configlist("pager", "ignore") and not attend):
sys.stderr = sys.stdout = util.popen(p, "wb")
if ui.configbool("pager", "quiet"):
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
return orig(ui, options, cmd, cmdfunc)
开发者ID:fuzxxl,项目名称:plan9front,代码行数:9,代码来源:pager.py
示例13: parse_usermap
def parse_usermap():
cmd = 'p4 -G users'
stdout = util.popen(cmd, mode='rb')
try:
for d in loaditer(stdout):
if d.get('User'):
yield d
except Exception:
raise P4Exception(stdout)
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:9,代码来源:p4.py
示例14: get_latest_cl
def get_latest_cl(client):
cmd = 'p4 --client %s -G changes -m 1 -s submitted' % (
util.shellquote(client))
stdout = util.popen(cmd, mode='rb')
parsed = marshal.load(stdout)
cl = parsed.get('change')
if cl:
return int(cl)
return None
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:9,代码来源:p4.py
示例15: pagecmd
def pagecmd(orig, ui, options, cmd, cmdfunc):
p = ui.config("pager", "pager", os.environ.get("PAGER"))
if p and sys.stdout.isatty() and '--debugger' not in sys.argv:
attend = ui.configlist('pager', 'attend', attended)
if (cmd in attend or
(cmd not in ui.configlist('pager', 'ignore') and not attend)):
sys.stderr = sys.stdout = util.popen(p, "wb")
if ui.configbool('pager', 'quiet'):
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
return orig(ui, options, cmd, cmdfunc)
开发者ID:iluxa-c0m,项目名称:mercurial-crew-tonfa,代码行数:10,代码来源:pager.py
示例16: gitopen
def gitopen(self, s):
prevgitdir = os.environ.get('GIT_DIR')
os.environ['GIT_DIR'] = self.path
try:
return util.popen(s, 'rb')
finally:
if prevgitdir is None:
del os.environ['GIT_DIR']
else:
os.environ['GIT_DIR'] = prevgitdir
开发者ID:MezzLabs,项目名称:mercurial,代码行数:10,代码来源:git.py
示例17: revisions
def revisions(self):
revs = set()
if os.path.isfile(self.rcspath):
stdout = util.popen('rlog %s 2>%s'
% (util.shellquote(self.rcspath), os.devnull),
mode='rb')
for l in stdout.readlines():
m = re.match('revision 1.(\d+)', l)
if m:
revs.add(int(m.group(1)))
return revs
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:11,代码来源:importer.py
示例18: parse_filelist_at_cl
def parse_filelist_at_cl(client, cl=None):
cmd = 'p4 --client %s -G files //%s/[email protected]%d' %(
util.shellquote(client),
util.shellquote(client),
cl
)
stdout = util.popen(cmd, mode='rb')
for d in loaditer(stdout):
c = d.get('depotFile', None)
if c:
yield d
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:11,代码来源:p4.py
示例19: parse_filelist
def parse_filelist(client, startcl=None, endcl=None):
if startcl is None:
startcl = 0
cmd = 'p4 --client %s -G files -a //%s/...%s' % (
util.shellquote(client),
util.shellquote(client),
revrange(startcl, endcl))
stdout = util.popen(cmd, mode='rb')
for d in loaditer(stdout):
c = d.get('depotFile', None)
if c:
yield d
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:13,代码来源:p4.py
示例20: gitopen
def gitopen(self, s, noerr=False):
prevgitdir = os.environ.get('GIT_DIR')
os.environ['GIT_DIR'] = self.path
try:
if noerr:
(stdin, stdout, stderr) = util.popen3(s)
return stdout
else:
return util.popen(s, 'rb')
finally:
if prevgitdir is None:
del os.environ['GIT_DIR']
else:
os.environ['GIT_DIR'] = prevgitdir
开发者ID:agbiotec,项目名称:galaxy-tools-vcr,代码行数:14,代码来源:git.py
注:本文中的mercurial.util.popen函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论