コード例 #1
0
                        "sorted. Default: false.")
    parser.add_argument(
        "-u",
        "--upstream",
        action="store_true",
        help="Move patches upstream between subsystem sections "
        "as appropriate. Default: false.")
    parser.add_argument("series",
                        nargs="?",
                        metavar="series.conf",
                        help="series.conf file which will be modified in "
                        "place. Default: if stdin is a terminal, "
                        "\"series.conf\"; otherwise, read input from stdin.")
    args = parser.parse_args()

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

    filter_mode = False
    if args.series is None:
        if sys.stdin.isatty():
            path = "series.conf"
        else:
            filter_mode = True
    else:
        path = args.series
    if filter_mode:
        f = sys.stdin
    else:
        try:
コード例 #2
0
ファイル: qdupcheck.py プロジェクト: kdave/kernel-source
import exc
import lib
import series_conf


if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Check if a commit id is already backported by a patch in "
        "series.conf.")
    parser.add_argument("rev", help="Upstream commit id.")
    args = parser.parse_args()

    if not lib.check_series():
        sys.exit(1)

    repo_path = lib.repo_path()
    repo = pygit2.Repository(repo_path)
    try:
        commit = str(repo.revparse_single(args.rev).id)
    except KeyError:
        print("Error: revision \"%s\" not found in \"%s\"." %
              (args.rev, repo_path), file=sys.stderr)
        sys.exit(1)

    series = open("series")
    cwd = os.getcwd()
    os.chdir("patches")
    try:
        with series_conf.find_commit(commit, series) as (name, patch,):
            print("Commit %s already present in patch\n\t%s" % (
                commit[:12], name,))