亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mailer.py

?? linux subdivision ying gai ke yi le ba
?? PY
?? 第 1 頁 / 共 2 頁
字號:
#!/usr/bin/env python2
#
# mailer.py: send email describing a commit
#
# $HeadURL: http://svn.collab.net/repos/svn/branches/1.1.x/tools/hook-scripts/mailer/mailer.py $
# $LastChangedDate: 2005-03-26 12:14:01 -0800 (Sat, 26 Mar 2005) $
# $LastChangedBy: maxb $
# $LastChangedRevision: 13698 $
#
# USAGE: mailer.py commit     REPOS-DIR REVISION [CONFIG-FILE]
#        mailer.py propchange REPOS-DIR REVISION AUTHOR PROPNAME [CONFIG-FILE]
#
#   Using CONFIG-FILE, deliver an email describing the changes between
#   REV and REV-1 for the repository REPOS.
#

import os
import sys
import string
import ConfigParser
import time
import popen2
import cStringIO
import smtplib
import re
import types

import svn.fs
import svn.delta
import svn.repos
import svn.core

SEPARATOR = '=' * 78


def main(pool, cmd, config_fname, repos_dir, rev, author, propname):
  repos = Repository(repos_dir, rev, pool)

  if cmd == 'commit':
    cfg = Config(config_fname, repos, { 'author' : author or repos.author })
    messenger = Commit(pool, cfg, repos)
  elif cmd == 'propchange':
    # Override the repos revision author with the author of the propchange
    repos.author = author
    cfg = Config(config_fname, repos, { 'author' : author })
    messenger = PropChange(pool, cfg, repos, author, propname)
  else:
    raise UnknownSubcommand(cmd)

  messenger.generate()


# ============================================================================
if sys.platform == "win32":
  _escape_shell_arg_re = re.compile(r'(\\+)(\"|$)')

  def escape_shell_arg(arg):
    # The (very strange) parsing rules used by the C runtime library are
    # described at:
    # http://msdn.microsoft.com/library/en-us/vclang/html/_pluslang_Parsing_C.2b2b_.Command.2d.Line_Arguments.asp

    # double up slashes, but only if they are followed by a quote character
    arg = re.sub(_escape_shell_arg_re, r'\1\1\2', arg)

    # surround by quotes and escape quotes inside
    arg = '"' + string.replace(arg, '"', '"^""') + '"'
    return arg


  def argv_to_command_string(argv):
    """Flatten a list of command line arguments into a command string.

    The resulting command string is expected to be passed to the system
    shell which os functions like popen() and system() invoke internally.
    """

    # According cmd's usage notes (cmd /?), it parses the command line by
    # "seeing if the first character is a quote character and if so, stripping
    # the leading character and removing the last quote character."
    # So to prevent the argument string from being changed we add an extra set
    # of quotes around it here.
    return '"' + string.join(map(escape_shell_arg, argv), " ") + '"'

else:
  def escape_shell_arg(str):
    return "'" + string.replace(str, "'", "'\\''") + "'"

  def argv_to_command_string(argv):
    """Flatten a list of command line arguments into a command string.

    The resulting command string is expected to be passed to the system
    shell which os functions like popen() and system() invoke internally.
    """

    return string.join(map(escape_shell_arg, argv), " ")
# ============================================================================

# Minimal, incomplete, versions of popen2.Popen[34] for those platforms
# for which popen2 does not provide them.
try:
  Popen3 = popen2.Popen3
  Popen4 = popen2.Popen4
except AttributeError:
  class Popen3:
    def __init__(self, cmd, capturestderr = False):
      if type(cmd) != types.StringType:
        cmd = argv_to_command_string(cmd)
      if capturestderr:
        self.fromchild, self.tochild, self.childerr \
            = popen2.popen3(cmd, mode='b')
      else:
        self.fromchild, self.tochild = popen2.popen2(cmd, mode='b')
        self.childerr = None

    def wait(self):
      rv = self.fromchild.close()
      rv = self.tochild.close() or rv
      if self.childerr is not None:
        rv = self.childerr.close() or rv
      return rv

  class Popen4:
    def __init__(self, cmd):
      if type(cmd) != types.StringType:
        cmd = argv_to_command_string(cmd)
      self.fromchild, self.tochild = popen2.popen4(cmd, mode='b')

    def wait(self):
      rv = self.fromchild.close()
      rv = self.tochild.close() or rv
      return rv

class MailedOutput:
  def __init__(self, cfg, repos, prefix_param):
    self.cfg = cfg
    self.repos = repos
    self.prefix_param = prefix_param
    self._CHUNKSIZE = 128 * 1024

  def start(self, group, params):
    # whitespace-separated list of addresses; split into a clean list:
    self.to_addrs = \
        filter(None, string.split(self.cfg.get('to_addr', group, params)))
    self.from_addr = self.cfg.get('from_addr', group, params) \
                     or self.repos.author or 'no_author'
    self.reply_to = self.cfg.get('reply_to', group, params)

  def mail_headers(self, group, params):
    prefix = self.cfg.get(self.prefix_param, group, params)
    if prefix:
      subject = prefix + ' ' + self.subject
    else:
      subject = self.subject
    hdrs = 'From: %s\n'    \
           'To: %s\n'      \
           'Subject: %s\n' \
           'MIME-Version: 1.0\n' \
           'Content-Type: text/plain; charset=UTF-8\n' \
           % (self.from_addr, string.join(self.to_addrs, ', '), subject)
    if self.reply_to:
      hdrs = '%sReply-To: %s\n' % (hdrs, self.reply_to)
    return hdrs + '\n'

  def run(self, cmd):
    # By default we choose to incorporate child stderr into the output
    pipe_ob = Popen4(cmd)

    buf = pipe_ob.fromchild.read(self._CHUNKSIZE)
    while buf:
      self.write(buf)
      buf = pipe_ob.fromchild.read(self._CHUNKSIZE)

    # wait on the child so we don't end up with a billion zombies
    pipe_ob.wait()


class SMTPOutput(MailedOutput):
  "Deliver a mail message to an MTA using SMTP."

  def start(self, group, params, **args):
    MailedOutput.start(self, group, params, **args)

    self.buffer = cStringIO.StringIO()
    self.write = self.buffer.write

    self.write(self.mail_headers(group, params))

  def finish(self):
    server = smtplib.SMTP(self.cfg.general.smtp_hostname)
    if self.cfg.is_set('general.smtp_username'):
      server.login(self.cfg.general.smtp_username,
                   self.cfg.general.smtp_password)
    server.sendmail(self.from_addr, self.to_addrs, self.buffer.getvalue())
    server.quit()


class StandardOutput:
  "Print the commit message to stdout."

  def __init__(self, cfg, repos, prefix_param):
    self.cfg = cfg
    self.repos = repos
    self._CHUNKSIZE = 128 * 1024

    self.write = sys.stdout.write

  def start(self, group, params, **args):
    pass

  def finish(self):
    pass

  def run(self, cmd):
    # By default we choose to incorporate child stderr into the output
    pipe_ob = Popen4(cmd)

    buf = pipe_ob.fromchild.read(self._CHUNKSIZE)
    while buf:
      self.write(buf)
      buf = pipe_ob.fromchild.read(self._CHUNKSIZE)

    # wait on the child so we don't end up with a billion zombies
    pipe_ob.wait()


class PipeOutput(MailedOutput):
  "Deliver a mail message to an MDA via a pipe."

  def __init__(self, cfg, repos, prefix_param):
    MailedOutput.__init__(self, cfg, repos, prefix_param)

    # figure out the command for delivery
    self.cmd = string.split(cfg.general.mail_command)

  def start(self, group, params, **args):
    MailedOutput.start(self, group, params, **args)

    ### gotta fix this. this is pretty specific to sendmail and qmail's
    ### mailwrapper program. should be able to use option param substitution
    cmd = self.cmd + [ '-f', self.from_addr ] + self.to_addrs

    # construct the pipe for talking to the mailer
    self.pipe = Popen3(cmd)
    self.write = self.pipe.tochild.write

    # we don't need the read-from-mailer descriptor, so close it
    self.pipe.fromchild.close()

    # start writing out the mail message
    self.write(self.mail_headers(group, params))

  def finish(self):
    # signal that we're done sending content
    self.pipe.tochild.close()

    # wait to avoid zombies
    self.pipe.wait()


class Messenger:
  def __init__(self, pool, cfg, repos, prefix_param):
    self.pool = pool
    self.cfg = cfg
    self.repos = repos
    self.determine_output(cfg, repos, prefix_param)

  def determine_output(self, cfg, repos, prefix_param):
    if cfg.is_set('general.mail_command'):
      cls = PipeOutput
    elif cfg.is_set('general.smtp_hostname'):
      cls = SMTPOutput
    else:
      cls = StandardOutput

    self.output = cls(cfg, repos, prefix_param)


class Commit(Messenger):
  def __init__(self, pool, cfg, repos):
    Messenger.__init__(self, pool, cfg, repos, 'commit_subject_prefix')

    # get all the changes and sort by path
    editor = svn.repos.RevisionChangeCollector(repos.fs_ptr, repos.rev,
                                               self.pool)
    e_ptr, e_baton = svn.delta.make_editor(editor, self.pool)
    svn.repos.svn_repos_replay(repos.root_this, e_ptr, e_baton, self.pool)

    self.changelist = editor.changes.items()
    self.changelist.sort()

    ### hunh. this code isn't actually needed for StandardOutput. refactor?
    # collect the set of groups and the unique sets of params for the options
    self.groups = { }
    for path, change in self.changelist:
      for (group, params) in self.cfg.which_groups(path):
        # turn the params into a hashable object and stash it away
        param_list = params.items()
        param_list.sort()
        self.groups[group, tuple(param_list)] = params

    # figure out the changed directories
    dirs = { }
    for path, change in self.changelist:
      if change.item_kind == svn.core.svn_node_dir:
        dirs[path] = None
      else:
        idx = string.rfind(path, '/')
        if idx == -1:
          dirs[''] = None
        else:
          dirs[path[:idx]] = None

    dirlist = dirs.keys()

    # figure out the common portion of all the dirs. note that there is
    # no "common" if only a single dir was changed, or the root was changed.
    if len(dirs) == 1 or dirs.has_key(''):
      commondir = ''
    else:
      common = string.split(dirlist.pop(), '/')
      for d in dirlist:
        parts = string.split(d, '/')
        for i in range(len(common)):
          if i == len(parts) or common[i] != parts[i]:
            del common[i:]
            break
      commondir = string.join(common, '/')
      if commondir:
        # strip the common portion from each directory
        l = len(commondir) + 1
        dirlist = [ ]
        for d in dirs.keys():
          if d == commondir:
            dirlist.append('.')
          else:
            dirlist.append(d[l:])
      else:
        # nothing in common, so reset the list of directories
        dirlist = dirs.keys()

    # compose the basic subject line. later, we can prefix it.
    dirlist.sort()
    dirlist = string.join(dirlist)
    if commondir:
      self.output.subject = 'r%d - in %s: %s' % (repos.rev, commondir, dirlist)
    else:
      self.output.subject = 'r%d - %s' % (repos.rev, dirlist)

  def generate(self):
    "Generate email for the various groups and option-params."

    ### the groups need to be further compressed. if the headers and
    ### body are the same across groups, then we can have multiple To:
    ### addresses. SMTPOutput holds the entire message body in memory,
    ### so if the body doesn't change, then it can be sent N times
    ### rather than rebuilding it each time.

    subpool = svn.core.svn_pool_create(self.pool)

    for (group, param_tuple), params in self.groups.items():
      self.output.start(group, params)

      # generate the content for this group and set of params
      generate_content(self.output, self.cfg, self.repos, self.changelist,
                       group, params, subpool)

      self.output.finish()
      svn.core.svn_pool_clear(subpool)

    svn.core.svn_pool_destroy(subpool)


class PropChange(Messenger):
  def __init__(self, pool, cfg, repos, author, propname):
    Messenger.__init__(self, pool, cfg, repos, 'propchange_subject_prefix')
    self.author = author
    self.propname = propname

    ### hunh. this code isn't actually needed for StandardOutput. refactor?
    # collect the set of groups and the unique sets of params for the options
    self.groups = { }
    for (group, params) in self.cfg.which_groups(''):
      # turn the params into a hashable object and stash it away
      param_list = params.items()
      param_list.sort()
      self.groups[group, tuple(param_list)] = params

    self.output.subject = 'r%d - %s' % (repos.rev, propname)

  def generate(self):
    for (group, param_tuple), params in self.groups.items():
      self.output.start(group, params)
      self.output.write('Author: %s\nRevision: %s\nProperty Name: %s\n\n'
                        % (self.author, self.repos.rev, self.propname))
      propvalue = self.repos.get_rev_prop(self.propname)
      self.output.write('New Property Value:\n')
      self.output.write(propvalue)
      self.output.finish()


def generate_content(output, cfg, repos, changelist, group, params, pool):

  svndate = repos.get_rev_prop(svn.core.SVN_PROP_REVISION_DATE)
  ### pick a different date format?
  date = time.ctime(svn.core.secs_from_timestr(svndate, pool))

  output.write('Author: %s\nDate: %s\nNew Revision: %s\n\n'
               % (repos.author, date, repos.rev))

  # print summary sections
  generate_list(output, 'Added', changelist, _select_adds)
  generate_list(output, 'Removed', changelist, _select_deletes)
  generate_list(output, 'Modified', changelist, _select_modifies)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
婷婷夜色潮精品综合在线| 欧美日韩国产一区二区三区地区| 精品第一国产综合精品aⅴ| 男人的j进女人的j一区| 日韩精品中文字幕在线不卡尤物 | 欧美福利一区二区| 日韩经典一区二区| 日韩欧美国产一区二区在线播放 | 国产精品亚洲一区二区三区在线| 久久久国产精品午夜一区ai换脸| 北条麻妃国产九九精品视频| 亚洲精品国产a久久久久久 | 精品少妇一区二区三区在线播放| 精品亚洲国内自在自线福利| 国产欧美日产一区| 欧美在线一二三四区| 蜜臀av性久久久久蜜臀aⅴ流畅| 久久久亚洲欧洲日产国码αv| 成人污视频在线观看| 一区二区久久久久| 日韩小视频在线观看专区| 国产高清久久久久| 亚洲女同一区二区| 精品伦理精品一区| 91精彩视频在线观看| 麻豆91免费看| 1000精品久久久久久久久| 欧美乱熟臀69xxxxxx| 国产精品456露脸| 亚洲影院理伦片| 久久影院视频免费| 欧美制服丝袜第一页| 久久国产精品区| 亚洲一区视频在线观看视频| 欧美一级二级在线观看| youjizz国产精品| 日本在线不卡视频| 自拍偷拍国产精品| www激情久久| 欧美军同video69gay| 国产传媒欧美日韩成人| 午夜精品福利一区二区蜜股av| 久久精品亚洲精品国产欧美 | 69av一区二区三区| 99久久精品费精品国产一区二区| 美腿丝袜亚洲色图| 一级日本不卡的影视| 国产女人aaa级久久久级| 欧美一区二区三区电影| 91网站在线播放| 国产不卡免费视频| 日本视频中文字幕一区二区三区| 日韩毛片一二三区| 国产日韩欧美a| 欧美一区二区免费观在线| 在线观看av不卡| www.亚洲精品| 成人夜色视频网站在线观看| 精品一区二区成人精品| 轻轻草成人在线| 亚洲一区二区黄色| 中文字幕亚洲区| 日本一区二区不卡视频| 亚洲精品一区二区三区蜜桃下载 | 色哟哟精品一区| 成人性色生活片免费看爆迷你毛片| 精品一区二区在线免费观看| 日韩不卡免费视频| 午夜精品久久久久久久蜜桃app| 亚洲人精品午夜| 亚洲特级片在线| 亚洲欧美日韩一区| 一区二区在线免费| 亚洲欧洲国产日韩| 亚洲丝袜美腿综合| 综合久久给合久久狠狠狠97色 | 91福利在线播放| 91片在线免费观看| 色吧成人激情小说| 欧美在线999| 欧美高清精品3d| 日韩一区二区免费高清| 欧美一二三区在线| 欧美mv日韩mv国产| 久久一夜天堂av一区二区三区| 久久女同精品一区二区| 久久久久久久av麻豆果冻| 久久久久国产精品厨房| 亚洲色图欧洲色图婷婷| 图片区小说区区亚洲影院| 久久亚洲春色中文字幕久久久| 2020国产精品久久精品美国| 国产校园另类小说区| 中文字幕中文字幕一区二区| 美女在线视频一区| 精品无码三级在线观看视频| 国产精品一级片在线观看| 97久久超碰国产精品| 91久久一区二区| 欧美一区二区在线免费观看| 精品福利av导航| 国产精品成人一区二区艾草| 亚洲精品日产精品乱码不卡| 亚洲成av人片一区二区梦乃 | 7777精品伊人久久久大香线蕉超级流畅 | 国产农村妇女精品| 亚洲女女做受ⅹxx高潮| 日本伊人午夜精品| 成人美女视频在线观看18| 色吧成人激情小说| 欧美成人精品福利| 综合av第一页| 日韩av网站免费在线| 国产suv精品一区二区三区| 色欧美日韩亚洲| 精品国产髙清在线看国产毛片| 国产精品婷婷午夜在线观看| 亚洲午夜电影在线观看| 国产一区二区三区不卡在线观看 | 欧美猛男男办公室激情| 久久久精品黄色| 一二三四区精品视频| 六月丁香婷婷久久| 91免费视频大全| 精品国产乱码久久久久久久| 樱桃国产成人精品视频| 国产制服丝袜一区| 欧美日产国产精品| 国产精品天美传媒| 毛片不卡一区二区| 在线观看国产精品网站| 久久久久久久网| 免费一级欧美片在线观看| 91首页免费视频| 久久久91精品国产一区二区精品| 亚洲第一av色| 一本色道久久综合亚洲91| 亚洲精品一区二区三区影院 | 精品一区二区综合| 欧美性大战久久| 国产精品久久网站| 久久精品国产亚洲一区二区三区| 色婷婷久久久综合中文字幕| 久久久www成人免费毛片麻豆| 日韩在线一区二区三区| 91丨九色丨蝌蚪富婆spa| 久久精品水蜜桃av综合天堂| 美女视频一区二区| 欧美高清视频不卡网| 亚洲国产日日夜夜| 色就色 综合激情| 1024精品合集| av高清久久久| 国产精品久久久久久久浪潮网站| 国产乱理伦片在线观看夜一区| 日韩免费高清电影| 日韩av一二三| 日韩欧美视频在线| 免费久久精品视频| 日韩视频在线你懂得| 日韩成人一级片| 日韩一区二区视频在线观看| 日日欢夜夜爽一区| 91麻豆精品国产91| 日韩高清在线不卡| 欧美一区二区三区男人的天堂| 丝袜亚洲另类丝袜在线| 欧美日韩高清在线播放| 香蕉成人啪国产精品视频综合网| 在线观看区一区二| 午夜精品久久久久影视| 欧美丰满美乳xxx高潮www| 日韩制服丝袜先锋影音| 欧美一级视频精品观看| 黄色精品一二区| 国产亚洲一区二区在线观看| 丰满少妇久久久久久久| 亚洲四区在线观看| 日本道免费精品一区二区三区| 亚洲国产成人tv| 91精品国产全国免费观看 | 亚洲第一二三四区| 制服视频三区第一页精品| 美女视频一区二区| 国产三级一区二区三区| 成人午夜看片网址| 亚洲免费av观看| 欧美一区二区视频在线观看2022| 老司机精品视频一区二区三区| 亚洲精品在线观看视频| 丁香一区二区三区| 一区二区三区日本| 91精品国产免费| 国产一区二区免费视频| 亚洲欧洲av色图| 欧美裸体一区二区三区| 国内偷窥港台综合视频在线播放| 久久精品网站免费观看| 欧洲日韩一区二区三区| 久久精品国产精品亚洲精品|