コード例 #1
0
ファイル: log.py プロジェクト: dougsong/git-svnserver
    def do_cmd(self):
        repos = self.link.repos
        args = self.args
        url = self.link.url
        start_rev = None
        end_rev = None

        target_paths = [parse.string(x) for x in args.pop(0)]

        arg = args.pop(0)
        if len(arg) > 0:
            start_rev = int(arg[0])
            if start_rev == 0:
                start_rev = 1

        arg = args.pop(0)
        if len(arg) > 0:
            end_rev = int(arg[0])
            if end_rev == 0:
                end_rev = 1

        send_changed_paths = parse.bool(args.pop(0))

        strict_node = parse.bool(args.pop(0))

        limit = 0
        if len(args) > 0:
            limit = int(args.pop(0))

        include_merged_revisions = False
        if len(args) > 0:
            include_merged_revisions = parse.bool(args.pop(0))

        # all-revprops | revprops

        # ( revprop:string ... )

        for changes, rev, author, date, msg, has_children, revprops in repos.log(url, target_paths, start_rev, end_rev, limit):
            changed_paths = []
            if send_changed_paths:
                for path, data in sorted(changes.items()):
                    change, cp, cr, kind, tmod, pmod = data
                    copy = gen.list()
                    if cp is not None and cr is not None:
                        copy = gen.list(gen.string(cp), cr)
                    ct = gen.list(gen.string(kind), gen.bool(tmod),
                                  gen.bool(pmod))
                    changed_paths.append(gen.list(gen.string(path),
                                         change, copy, ct))
            log_entry = gen.list(gen.list(*changed_paths),
                                 rev,
                                 gen.list(gen.string(author)),
                                 gen.list(gen.string(date)),
                                 gen.list(gen.string(msg)))
            self.link.send_msg(log_entry)

        self.link.send_msg('done')

        self.link.send_msg(gen.success())
コード例 #2
0
ファイル: stat.py プロジェクト: qur/git-svnserver
    def do_cmd(self):
        repos = self.link.repos
        args = self.args
        url = self.link.url
        rev = None

        path = parse.string(args[0])
        if len(path) > 0:
            url = '/'.join((url, path))

        if len(args) > 1:
            rev = int(args[1][0])

        path, kind, size, changed, by, at = repos.stat(url, rev)

        if path is None:
            self.link.send_msg(gen.success(gen.list()))
            return

        props = repos.get_props(url, rev, False)

        if by is None:
            by = gen.list()
        else:
            by = gen.list(gen.string(by))

        ls_data = gen.list(kind,
                           size,
                           gen.bool(len(props) > 0),
                           changed,
                           gen.list(gen.string(at)),
                           by)

        self.link.send_msg(gen.success(gen.list(ls_data)))
コード例 #3
0
ファイル: stat.py プロジェクト: dougsong/git-svnserver
    def do_cmd(self):
        repos = self.link.repos
        args = self.args
        url = self.link.url
        rev = None

        path = parse.string(args[0])
        if len(path) > 0:
            url = '/'.join((url, path))

        if len(args) > 1:
            rev = int(args[1][0])

        path, kind, size, changed, by, at = repos.stat(url, rev)

        if path is None:
            self.link.send_msg(gen.success(gen.list()))
            return

        props = repos.get_props(url, rev, False)

        if by is None:
            by = gen.list()
        else:
            by = gen.list(gen.string(by))

        ls_data = gen.list(kind, size, gen.bool(len(props) > 0), changed,
                           gen.list(gen.string(at)), by)

        self.link.send_msg(gen.success(gen.list(ls_data)))
コード例 #4
0
ファイル: get-dir.py プロジェクト: qur/git-svnserver
    def do_cmd(self):
        repos = self.link.repos
        args = self.args
        url = self.link.url
        rev = None

        path = parse.string(args.pop(0))
        if len(path) > 0:
            url = '/'.join((url, path))

        arg = args.pop(0)
        if len(arg) > 0:
            rev = int(arg[0])

        want_props = parse.bool(args.pop(0))

        want_contents = parse.bool(args.pop(0))

        fields = []
        if len(args) > 0:
            fields = args.pop(0)

        ls_data = []
        if want_contents:
            for path, kind, size, changed, by, at in repos.ls(url, rev):
                path_url = "%s/%s" % (url, path)
                has_props = len(repos.get_props(path_url, rev, False)) == 0
                if by is None:
                    by = gen.list()
                else:
                    by = gen.list(gen.string(by))

                ls_data.append(gen.list(gen.string(path),
                                        kind,
                                        size,
                                        gen.bool(has_props),
                                        changed,
                                        gen.list(gen.string(at)),
                                        by))

        p = []
        if want_props:
            for name, value in repos.get_props(url, rev):
                p.append(gen.list(gen.string(name), gen.string(value)))

        response = "%d %s %s" % (rev, gen.list(*p), gen.list(*ls_data))

        self.link.send_msg(gen.success(response))
コード例 #5
0
ファイル: get-dir.py プロジェクト: dougsong/git-svnserver
    def do_cmd(self):
        repos = self.link.repos
        args = self.args
        url = self.link.url
        rev = None

        path = parse.string(args.pop(0))
        if len(path) > 0:
            url = '/'.join((url, path))

        arg = args.pop(0)
        if len(arg) > 0:
            rev = int(arg[0])

        want_props = parse.bool(args.pop(0))

        want_contents = parse.bool(args.pop(0))

        fields = []
        if len(args) > 0:
            fields = args.pop(0)

        ls_data = []
        if want_contents:
            for path, kind, size, changed, by, at in repos.ls(url, rev):
                path_url = "%s/%s" % (url, path)
                has_props = len(repos.get_props(path_url, rev, False)) == 0
                if by is None:
                    by = gen.list()
                else:
                    by = gen.list(gen.string(by))

                ls_data.append(
                    gen.list(gen.string(path), kind, size, gen.bool(has_props),
                             changed, gen.list(gen.string(at)), by))

        p = []
        if want_props:
            for name, value in repos.get_props(url, rev):
                p.append(gen.list(gen.string(name), gen.string(value)))

        response = "%d %s %s" % (rev, gen.list(*p), gen.list(*ls_data))

        self.link.send_msg(gen.success(response))