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

Python marshall.literal函数代码示例

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

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



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

示例1: __init__

 def __init__(self, url, progress_cb=None, auth=None, config=None, 
              client_string_func=None, open_tmp_file_func=None):
     self.url = url
     (type, opaque) = urllib.splittype(url)
     assert type in ("svn", "svn+ssh")
     (host, path) = urllib.splithost(opaque)
     self._progress_cb = progress_cb
     self._auth = auth
     self._config = config
     self._client_string_func = client_string_func
     # open_tmp_file_func is ignored, as it is not needed for svn://
     if type == "svn":
         (recv_func, send_func) = self._connect(host)
     else:
         (recv_func, send_func) = self._connect_ssh(host)
     super(SVNClient, self).__init__(recv_func, send_func)
     (min_version, max_version, _, self._server_capabilities) = self._recv_greeting()
     self.send_msg([max_version, [literal(x) for x in CAPABILITIES if x in self._server_capabilities], self.url])
     (self._server_mechanisms, mech_arg) = self._unpack()
     if self._server_mechanisms != []:
         # FIXME: Support other mechanisms as well
         self.send_msg([literal("ANONYMOUS"), [base64.b64encode("[email protected]%s" % socket.gethostname())]])
         self.recv_msg()
     msg = self._unpack()
     if len(msg) > 2:
         self._server_capabilities += msg[2]
     (self._uuid, self._root_url) = msg[0:2]
     self.busy = False
开发者ID:lygstate,项目名称:subvertpy,代码行数:28,代码来源:ra_svn.py


示例2: log

    def log(self, paths, start, end, limit=0, discover_changed_paths=True,
            strict_node_history=True, include_merged_revisions=True,
            revprops=None):
        args = [paths]
        if start is None or start == -1:
            args.append([])
        else:
            args.append([start])
        if end is None or end == -1:
            args.append([])
        else:
            args.append([end])
        args.append(discover_changed_paths)
        args.append(strict_node_history)
        args.append(limit)
        args.append(include_merged_revisions)
        if revprops is None:
            args.append(literal("all-revprops"))
            args.append([])
        else:
            args.append(literal("revprops"))
            args.append(revprops)

        self.send_msg([literal("log"), args])
        self._recv_ack()
        while True:
            msg = self.recv_msg()
            if msg == "done":
                break
            paths = {}
            for p, action, cfd in msg[0]:
                if len(cfd) == 0:
                    paths[p] = (str(action), None, -1)
                else:
                    paths[p] = (str(action), cfd[0], cfd[1])

            if len(msg) > 5:
                has_children = msg[5]
            else:
                has_children = None
            if len(msg) > 6 and msg[6]:
                revno = None
            else:
                revno = msg[1]  # noqa: F841
                # TODO(jelmer): Do something with revno
            revprops = {}
            if len(msg[2]) != 0:
                revprops[properties.PROP_REVISION_AUTHOR] = msg[2][0]
            if len(msg[3]) != 0:
                revprops[properties.PROP_REVISION_DATE] = msg[3][0]
            if len(msg[4]) != 0:
                revprops[properties.PROP_REVISION_LOG] = msg[4][0]
            if len(msg) > 8:
                revprops.update(dict(msg[8]))
            yield paths, msg[1], revprops, has_children

        self._unpack()
开发者ID:ardumont,项目名称:subvertpy,代码行数:57,代码来源:ra_svn.py


示例3: send_revision

 def send_revision(revno, author, date, message, changed_paths=None):
     changes = []
     if changed_paths is not None:
         for p, (action, cf, cr) in changed_paths.iteritems():
             if cf is not None:
                 changes.append((p, literal(action), (cf, cr)))
             else:
                 changes.append((p, literal(action), ()))
     self.send_msg([changes, revno, [author], [date], [message]])
开发者ID:lygstate,项目名称:subvertpy,代码行数:9,代码来源:ra_svn.py


示例4: __init__

    def __init__(self, backend, recv_fn, send_fn, logf=None):
        self.backend = backend
        self._stop = False
        self._logf = logf
        super(SVNServer, self).__init__(recv_fn, send_fn)

        self.send_success(
            MIN_VERSION, MAX_VERSION, [literal(x) for x in MECHANISMS],
            [literal(x) for x in CAPABILITIES])
开发者ID:ardumont,项目名称:subvertpy,代码行数:9,代码来源:ra_svn.py


示例5: apply_textdelta

 def apply_textdelta(self, base_checksum=None):
     self._is_last_open()
     if base_checksum is None:
         base_check = []
     else:
         base_check = [base_checksum]
     self.conn.send_msg([literal("apply-textdelta"), [self.id, base_check]])
     self.conn.send_msg([literal("textdelta-chunk"), [self.id, SVNDIFF0_HEADER]])
     def send_textdelta(delta):
         if delta is None:
             self.conn.send_msg([literal("textdelta-end"), [self.id]])
         else:
             self.conn.send_msg([literal("textdelta-chunk"), [self.id, pack_svndiff0_window(delta)]])
     return send_textdelta
开发者ID:lygstate,项目名称:subvertpy,代码行数:14,代码来源:ra_svn.py


示例6: get_locations

 def get_locations(self, path, peg_revnum, revnums):
     self.send_ack()
     locations = self.repo_backend.get_locations(path, peg_revnum, revnums)
     for rev, path in locations.iteritems():
         self.send_msg([rev, path])
     self.send_msg(literal("done"))
     self.send_success()
开发者ID:lygstate,项目名称:subvertpy,代码行数:7,代码来源:ra_svn.py


示例7: replay

 def replay(self, revision, low_water_mark, update_editor,
            send_deltas=True):
     self.send_msg([literal("replay"), [revision, low_water_mark,
                   send_deltas]])
     self._recv_ack()
     feed_editor(self, update_editor)
     self._unpack()
开发者ID:ardumont,项目名称:subvertpy,代码行数:7,代码来源:ra_svn.py


示例8: change_prop

 def change_prop(self, name, value):
     self._is_last_open()
     if value is None:
         value = []
     else:
         value = [value]
     self.conn.send_msg([literal("change-file-prop"), [self.id, name, value]])
开发者ID:lygstate,项目名称:subvertpy,代码行数:7,代码来源:ra_svn.py


示例9: change_rev_prop

 def change_rev_prop(self, rev, name, value):
     args = [rev, name]
     if value is not None:
         args.append(value)
     self.send_msg([literal("change-rev-prop"), args])
     self._recv_ack()
     self._unparse()
开发者ID:lygstate,项目名称:subvertpy,代码行数:7,代码来源:ra_svn.py


示例10: log

 def log(self, target_path, start_rev, end_rev, changed_paths, 
         strict_node, limit=None, include_merged_revisions=False, 
         all_revprops=None, revprops=None):
     def send_revision(revno, author, date, message, changed_paths=None):
         changes = []
         if changed_paths is not None:
             for p, (action, cf, cr) in changed_paths.iteritems():
                 if cf is not None:
                     changes.append((p, literal(action), (cf, cr)))
                 else:
                     changes.append((p, literal(action), ()))
         self.send_msg([changes, revno, [author], [date], [message]])
     self.send_ack()
     if len(start_rev) == 0:
         start_revnum = None
     else:
         start_revnum = start_rev[0]
     if len(end_rev) == 0:
         end_revnum = None
     else:
         end_revnum = end_rev[0]
     self.repo_backend.log(send_revision, target_path, start_revnum, 
                           end_revnum, changed_paths, strict_node, limit)
     self.send_msg(literal("done"))
     self.send_success()
开发者ID:lygstate,项目名称:subvertpy,代码行数:25,代码来源:ra_svn.py


示例11: rev_prop

 def rev_prop(self, revision, name):
     self.send_msg([literal("rev-prop"), [revision, name]])
     self._recv_ack()
     ret = self._unpack()
     if len(ret) == 0:
         return None
     else:
         return ret[0]
开发者ID:lygstate,项目名称:subvertpy,代码行数:8,代码来源:ra_svn.py


示例12: close

 def close(self, checksum=None):
     self._is_last_open()
     self.conn._open_ids.pop()
     if checksum is None:
         checksum = []
     else:
         checksum = [checksum]
     self.conn.send_msg([literal("close-file"), [self.id, checksum]])
开发者ID:lygstate,项目名称:subvertpy,代码行数:8,代码来源:ra_svn.py


示例13: get_lock

 def get_lock(self, path):
     self.send_msg([literal("get-lock"), [path]])
     self._recv_ack()
     ret = self._unpack()
     if len(ret) == 0:
         return None
     else:
         return ret[0]
开发者ID:lygstate,项目名称:subvertpy,代码行数:8,代码来源:ra_svn.py


示例14: get_dir

    def get_dir(self, path, revision=-1, dirent_fields=0, want_props=True, want_contents=True):
        args = [path]
        if revision is None or revision == -1:
            args.append([])
        else:
            args.append([revision])
        
        args += [want_props, want_contents]

        fields = []
        if dirent_fields & DIRENT_KIND:
            fields.append(literal("kind"))
        if dirent_fields & DIRENT_SIZE:
            fields.append(literal("size"))
        if dirent_fields & DIRENT_HAS_PROPS:
            fields.append(literal("has-props"))
        if dirent_fields & DIRENT_CREATED_REV:
            fields.append(literal("created-rev"))
        if dirent_fields & DIRENT_TIME:
            fields.append(literal("time"))
        if dirent_fields & DIRENT_LAST_AUTHOR:
            fields.append(literal("last-author"))
        args.append(fields)

        self.send_msg([literal("get-dir"), args])
        self._recv_ack()
        ret = self._unpack()
        fetch_rev = ret[0]
        props = dict(ret[1])
        dirents = {}
        for d in ret[2]:
            entry = unmarshall_dirent(d)
            dirents[entry["name"]] = entry

        return (dirents, fetch_rev, props)
开发者ID:lygstate,项目名称:subvertpy,代码行数:35,代码来源:ra_svn.py


示例15: add_directory

 def add_directory(self, path, copyfrom_path=None, copyfrom_rev=-1):
     self._is_last_open()
     child = generate_random_id()
     if copyfrom_path is not None:
         copyfrom_data = [copyfrom_path, copyfrom_rev]
     else:
         copyfrom_data = []
     self.conn.send_msg([literal("add-dir"), [path, self.id, child, copyfrom_data]])
     return DirectoryEditor(self.conn, child)
开发者ID:lygstate,项目名称:subvertpy,代码行数:9,代码来源:ra_svn.py


示例16: open_root

 def open_root(self, base_revision=None):
     id = generate_random_id()
     if base_revision is None:
         baserev = []
     else:
         baserev = [base_revision]
     self.conn.send_msg([literal("open-root"), [baserev, id]])
     self.conn._open_ids = []
     return DirectoryEditor(self.conn, id)
开发者ID:lygstate,项目名称:subvertpy,代码行数:9,代码来源:ra_svn.py


示例17: do_diff

 def do_diff(self, revision_to_update, diff_target, versus_url, diff_editor,
             recurse=True, ignore_ancestry=False, text_deltas=False, depth=None):
     args = []
     if revision_to_update is None or revision_to_update == -1:
         args.append([])
     else:
         args.append([revision_to_update])
     args += [diff_target, recurse, ignore_ancestry, versus_url, text_deltas]
     if depth is not None:
         args.append(literal(depth))
     self.busy = True
     try:
         self.send_msg([literal("diff"), args])
         self._recv_ack()
         return Reporter(self, diff_editor)
     except:
         self.busy = False
         raise
开发者ID:lygstate,项目名称:subvertpy,代码行数:18,代码来源:ra_svn.py


示例18: check_path

 def check_path(self, path, revision=None):
     args = [path]
     if revision is None or revision == -1:
         args.append([])
     else:
         args.append([revision])
     self.send_msg([literal("check-path"), args])
     self._recv_ack()
     ret = self._unpack()[0]
     return {"dir": NODE_DIR, "file": NODE_FILE, "unknown": NODE_UNKNOWN, "none": NODE_NONE}[ret]
开发者ID:lygstate,项目名称:subvertpy,代码行数:10,代码来源:ra_svn.py


示例19: do_update

    def do_update(self, revision_to_update_to, update_target, recurse, 
                  update_editor, depth=None):
        args = []
        if revision_to_update_to is None or revision_to_update_to == -1:
            args.append([])
        else:
            args.append([revision_to_update_to])
        args.append(update_target)
        args.append(recurse)
        if depth is not None:
            args.append(literal(depth))

        self.busy = True
        try:
            self.send_msg([literal("update"), args])
            self._recv_ack()
            return Reporter(self, update_editor)
        except:
            self.busy = False
            raise
开发者ID:lygstate,项目名称:subvertpy,代码行数:20,代码来源:ra_svn.py


示例20: link_path

    def link_path(self, path, url, rev, start_empty=False, lock_token=None, 
                 depth=None):
        args = [path, url, rev, start_empty]
        if lock_token is not None:
            args.append([lock_token])
        else:
            args.append([])
        if depth is not None:
            args.append(depth)

        self.conn.send_msg([literal("link-path"), args])
开发者ID:lygstate,项目名称:subvertpy,代码行数:11,代码来源:ra_svn.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python ra.get_username_provider函数代码示例发布时间:2022-05-27
下一篇:
Python userOwnedObject.UserOwnedObject类代码示例发布时间: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