Ejemplo n.º 1
0
    try:
        input_entries = lib.parse_inside(index, inside, args.upstream)
    except exc.KSError as err:
        print("Error: %s" % (err, ), file=sys.stderr)
        sys.exit(1)

    try:
        sorted_entries = lib.series_sort(index, input_entries)
    except exc.KSError as err:
        print("Error: %s" % (err, ), file=sys.stderr)
        sys.exit(1)

    new_inside = lib.flatten([
        lib.series_header(inside),
        lib.series_format(sorted_entries),
        lib.series_footer(inside),
    ])

    to_update = list(filter(lib.tag_needs_update, input_entries))
    if args.check:
        result = 0
        if inside != new_inside:
            print("Input is not sorted.")
            result = 2
        if len(to_update):
            print("Git-repo tags are outdated.")
            result = 2
        sys.exit(result)
    else:
        output = lib.flatten([
Ejemplo n.º 2
0
    try:
        input_entries = lib.parse_inside(index, inside, False)
    except exc.KSError as err:
        print("Error: %s" % (err, ), file=sys.stderr)
        sys.exit(1)
    for name in added - local[3] | moved:
        entry = lib.InputEntry("\t%s\n" % (name, ))
        entry.from_patch(index, name, lib.git_sort.oot, True)
        input_entries.append(entry)

    try:
        sorted_entries = lib.series_sort(index, input_entries)
    except exc.KSError as err:
        print("Error: %s" % (err, ), file=sys.stderr)
        sys.exit(1)
    output = lib.series_format(sorted_entries)

    # If there were no conflicts outside of the sorted section, then it would be
    # sufficient to splice the sorted result into local
    splice(local, output, merged_path)

    # ... but we don't know, so splice them all and call `merge` so that the
    # lines outside the sorted section get conflict markers if needed
    splice(base, output, base_path)
    splice(remote, output, remote_path)

    result = 0
    try:
        cmd = "merge"
        retval = subprocess.call([cmd, merged_path, base_path, remote_path])
    except OSError as e:
Ejemplo n.º 3
0
    try:
        input_entries = lib.parse_inside(index, inside, args.upstream)
    except exc.KSError as err:
        print("Error: %s" % (err,), file=sys.stderr)
        sys.exit(1)

    try:
        sorted_entries = lib.series_sort(index, input_entries)
    except exc.KSError as err:
        print("Error: %s" % (err,), file=sys.stderr)
        sys.exit(1)

    new_inside = lib.flatten([
        lib.series_header(inside),
        lib.series_format(sorted_entries),
        lib.series_footer(inside),
    ])

    to_update = list(filter(lib.tag_needs_update, input_entries))
    if args.check:
        result = 0
        if inside != new_inside:
            print("Input is not sorted.")
            result = 2
        if len(to_update):
            print("Git-repo tags are outdated.")
            result = 2
        sys.exit(result)
    else:
        output = lib.flatten([
Ejemplo n.º 4
0
    try:
        sorted_entries = lib.series_sort(index, current_entries + new_entries)
    except exc.KSError as err:
        print("Error: %s" % (err,), file=sys.stderr)
        sys.exit(1)

    cur_sorted_entries = collections.OrderedDict()
    for head, lines in list(sorted_entries.items()):
        current_lines = [line for line in lines if line not in new_lines]
        if current_lines:
            cur_sorted_entries[head] = current_lines

    cur_inside = lib.flatten([
        lib.series_header(inside),
        lib.series_format(cur_sorted_entries),
        lib.series_footer(inside),
    ])

    if inside != cur_inside:
        print("Error: Current series.conf is not sorted. "
              "Please run series_sort.py first and commit the result before "
              "adding new patches.", file=sys.stderr)
        sys.exit(1)

    new_inside = lib.flatten([
        lib.series_header(inside),
        lib.series_format(sorted_entries),
        lib.series_footer(inside),
    ])
Ejemplo n.º 5
0
    try:
        input_entries = lib.parse_inside(index, inside, False)
    except exc.KSError as err:
        print("Error: %s" % (err,), file=sys.stderr)
        sys.exit(1)
    for name in added - local[3] | moved:
        entry = lib.InputEntry("\t%s\n" % (name,))
        entry.from_patch(index, name, lib.git_sort.oot, True)
        input_entries.append(entry)

    try:
        sorted_entries = lib.series_sort(index, input_entries)
    except exc.KSError as err:
        print("Error: %s" % (err,), file=sys.stderr)
        sys.exit(1)
    output = lib.series_format(sorted_entries)

    # If there were no conflicts outside of the sorted section, then it would be
    # sufficient to splice the sorted result into local
    splice(local, output, merged_path)

    # ... but we don't know, so splice them all and call `merge` so that the
    # lines outside the sorted section get conflict markers if needed
    splice(base, output, base_path)
    splice(remote, output, remote_path)

    result = 0
    try:
        cmd = "merge"
        retval = subprocess.call([cmd, merged_path, base_path, remote_path])
    except OSError as e:
Ejemplo n.º 6
0
    try:
        sorted_entries = lib.series_sort(index, current_entries + new_entries)
    except exc.KSError as err:
        print("Error: %s" % (err,), file=sys.stderr)
        sys.exit(1)

    cur_sorted_entries = collections.OrderedDict()
    for head, lines in list(sorted_entries.items()):
        current_lines = [line for line in lines if line not in new_lines]
        if current_lines:
            cur_sorted_entries[head] = current_lines

    cur_inside = lib.flatten([
        lib.series_header(inside),
        lib.series_format(cur_sorted_entries),
        lib.series_footer(inside),
    ])

    if inside != cur_inside:
        print("Error: Current series.conf is not sorted. "
              "Please run series_sort.py first and commit the result before "
              "adding new patches.", file=sys.stderr)
        sys.exit(1)

    new_inside = lib.flatten([
        lib.series_header(inside),
        lib.series_format(sorted_entries),
        lib.series_footer(inside),
    ])