コード例 #1
0
ファイル: lib.py プロジェクト: openSUSE/kernel-source
def patches_per_section(inside_lines):
    """
    Returns an OrderedDict
    result[Head][]
        patch file name
    """
    result = collections.OrderedDict([
        (head, [],)
        for head in flatten((git_sort.remotes, (git_sort.oot,),))])

    current_head = git_sort.remotes[0]
    for line in inside_lines:
        try:
            current_head = parse_section_header(line)
        except exc.KSNotFound:
            pass

        if not series_conf.filter_patches(line):
            continue

        name = series_conf.firstword(line)
        result[current_head].append(name)

    for head, names in list(result.items()):
        if not names:
            del result[head]

    return result
コード例 #2
0
ファイル: lib.py プロジェクト: openSUSE/kernel-source
 def get_commit(value):
     if not value:
         raise BadTag(value)
     tag = series_conf.firstword(value)
     if not self.commit_match.match(tag):
         raise BadTag(tag)
     return tag
コード例 #3
0
ファイル: lib.py プロジェクト: PandaWei/kernel-source
 def get_commit(value):
     if not value:
         raise BadTag(value)
     tag = series_conf.firstword(value)
     if not self.commit_match.match(tag):
         raise BadTag(tag)
     return tag
コード例 #4
0
ファイル: lib.py プロジェクト: PandaWei/kernel-source
def patches_per_section(inside_lines):
    """
    Returns an OrderedDict
    result[Head][]
        patch file name
    """
    result = collections.OrderedDict([(
        head,
        [],
    ) for head in flatten((
        git_sort.remotes,
        (git_sort.oot, ),
    ))])

    current_head = git_sort.remotes[0]
    for line in inside_lines:
        try:
            current_head = parse_section_header(line)
        except exc.KSNotFound:
            pass

        if not series_conf.filter_patches(line):
            continue

        name = series_conf.firstword(line)
        result[current_head].append(name)

    for head, names in list(result.items()):
        if not names:
            del result[head]

    return result
コード例 #5
0
ファイル: qcp.py プロジェクト: PandaWei/kernel-source
    try:
        commit = repo.revparse_single(args.rev)
    except ValueError:
        print("Error: \"%s\" is not a valid revision." % (args.rev, ),
              file=sys.stderr)
        sys.exit(1)
    except KeyError:
        print("Error: revision \"%s\" not found in \"%s\"." %
              (args.rev, repo_path),
              file=sys.stderr)
        sys.exit(1)

    if args.followup:
        with Patch(io.BytesIO(commit.message.encode())) as patch:
            try:
                fixes = series_conf.firstword(patch.get("Fixes")[0])
            except IndexError:
                print("Error: no \"Fixes\" tag found in commit \"%s\"." %
                      (str(commit.id)[:12]),
                      file=sys.stderr)
                sys.exit(1)
        fixes = str(repo.revparse_single(fixes).id)

        series = open("series")
        cwd = os.getcwd()
        os.chdir("patches")
        try:
            with series_conf.find_commit(fixes, series) as (
                    name,
                    patch,
            ):
コード例 #6
0

if __name__ == "__main__":
    local_path, base_path, remote_path, merged_path = sys.argv[1:5]

    repo_path = lib.repo_path()
    repo = pygit2.Repository(repo_path)
    index = lib.git_sort.SortIndex(repo)

    # (before, inside, after, set(inside),)
    local, base, remote = ((
        s[0],
        s[1],
        s[2],
        set([
            series_conf.firstword(l) for l in s[1]
            if series_conf.filter_patches(l)
        ]),
    ) for s in [
        series_conf.split(open(s_path)) for s_path in (
            local_path,
            base_path,
            remote_path,
        )
    ])

    added = remote[3] - base[3]
    removed = base[3] - remote[3]
    moved = set(lib.list_moved_patches(base[1], remote[1]))

    if added or removed:
コード例 #7
0
ファイル: merge_tool.py プロジェクト: openSUSE/kernel-source
            lib.series_header(series[1]),
            inside,
            lib.series_footer(series[1]),
            series[2],)]


if __name__ == "__main__":
    local_path, base_path, remote_path, merged_path = sys.argv[1:5]

    repo_path = lib.repo_path()
    repo = pygit2.Repository(repo_path)
    index = lib.git_sort.SortIndex(repo)

    # (before, inside, after, set(inside),)
    local, base, remote = (
        (s[0], s[1], s[2], set([series_conf.firstword(l)
                                for l in s[1]
                                if series_conf.filter_patches(l)]),)
        for s in [
            series_conf.split(open(s_path))
            for s_path in (local_path, base_path, remote_path,)
        ]
    )

    added = remote[3] - base[3]
    removed = base[3] - remote[3]
    moved = set(lib.list_moved_patches(base[1], remote[1]))

    if added or removed:
        print("%d commits added, %d commits removed from base to remote." %
              (len(added), len(removed),))
コード例 #8
0
ファイル: merge_tool.py プロジェクト: KnightKu/kernel-source
            lib.series_header(series[1]),
            inside,
            lib.series_footer(series[1]),
            series[2],)]


if __name__ == "__main__":
    local_path, base_path, remote_path, merged_path = sys.argv[1:5]

    repo_path = lib.repo_path()
    repo = pygit2.Repository(repo_path)
    index = lib.git_sort.SortIndex(repo)

    # (before, inside, after, set(inside),)
    local, base, remote = (
        (s[0], s[1], s[2], set([series_conf.firstword(l) for l in s[1] if
                                series_conf.filter_patches(l)]),)
        for s in [
            series_conf.split(open(s_path)) for s_path in (
                local_path, base_path, remote_path,)
        ]
    )

    added = remote[3] - base[3]
    removed = base[3] - remote[3]

    added_nb = len(added)
    removed_nb = len(removed)
    if added_nb or removed_nb:
        print("%d commits added, %d commits removed from base to remote." %
              (added_nb, removed_nb,))
コード例 #9
0
ファイル: qcp.py プロジェクト: openSUSE/kernel-source
    repo = pygit2.Repository(repo_path)
    try:
        commit = repo.revparse_single(args.rev)
    except ValueError:
        print("Error: \"%s\" is not a valid revision." % (args.rev,),
              file=sys.stderr)
        sys.exit(1)
    except KeyError:
        print("Error: revision \"%s\" not found in \"%s\"." %
              (args.rev, repo_path), file=sys.stderr)
        sys.exit(1)

    if args.followup:
        with Patch(io.BytesIO(commit.message.encode())) as patch:
            try:
                fixes = series_conf.firstword(patch.get("Fixes")[0])
            except IndexError:
                print("Error: no \"Fixes\" tag found in commit \"%s\"." %
                      (str(commit.id)[:12]), file=sys.stderr)
                sys.exit(1)
        fixes = str(repo.revparse_single(fixes).id)

        series = open("series")
        cwd = os.getcwd()
        os.chdir("patches")
        try:
            with series_conf.find_commit(fixes, series) as (name, patch,):
                destination = os.path.dirname(name)
                references = " ".join(patch.get("References"))
        except exc.KSNotFound:
            print("Error: no patch found which contains commit %s." %