Example #1
0
def decodeURIComponent(text):
    """\
    Replace %HH escape sequences and return the resulting string.
    """

    return utf8utils.convertUTF8(
        re.sub("%([0-9A-Fa-f]{2})", lambda match: chr(int(match.group(1), 16)),
               text))
Example #2
0
    def fromGitObject(db, repository, gitobject, commit_id=None):
        assert gitobject.type == "commit"

        data = gitobject.data
        parents = []

        while True:
            line, data = data.split('\n', 1)

            if not line:
                break

            key, value = line.split(' ', 1)

            if key == 'tree': tree = value
            elif key == 'parent': parents.append(value)
            elif key == 'author': author = CommitUserTime.fromValue(value)
            elif key == 'committer':
                committer = CommitUserTime.fromValue(value)

        commit = Commit(repository, commit_id, gitobject.sha1, parents, author,
                        committer, convertUTF8(data), tree)
        commit.__cache(db)
        return commit
Example #3
0
    def fromGitObject(db, repository, gitobject, commit_id=None):
        assert gitobject.type == "commit"

        data = gitobject.data
        parents = []

        while True:
            line, data = data.split('\n', 1)

            if not line:
                break

            key, value = line.split(' ', 1)

            if key == 'tree': tree = value
            elif key == 'parent': parents.append(value)
            elif key == 'author': author = CommitUserTime.fromValue(value)
            elif key == 'committer': committer = CommitUserTime.fromValue(value)

        commit = Commit(repository, commit_id, gitobject.sha1, parents, author, committer, convertUTF8(data), tree)
        commit.__cache(db)
        return commit
Example #4
0
 def fromValue(value):
     match = re_author_committer.match(value)
     return CommitUserTime(convertUTF8(match.group(1)), convertUTF8(match.group(2)), time.gmtime(int(match.group(3).split(" ")[0])))
Example #5
0
 def fromValue(value):
     match = re_author_committer.match(value)
     return CommitUserTime(convertUTF8(match.group(1)),
                           convertUTF8(match.group(2)),
                           time.gmtime(int(match.group(3).split(" ")[0])))
Example #6
0
def decodeURIComponent(text):
    """\
    Replace %HH escape sequences and return the resulting string.
    """

    return utf8utils.convertUTF8(re.sub("%([0-9A-Fa-f]{2})", lambda match: chr(int(match.group(1), 16)), text))