Esempio n. 1
0
    lines_local = conflict.local_lines()
    lines_base = conflict.base_lines()
    lines_remote = conflict.remote_lines()
    if len(lines_local) != len(lines_base):
        return
    if len(lines_remote) != len(lines_base):
        return
    lines_count = len(lines_base)
    resolution = ""
    for l in range(lines_count):
        if lines_local[l] == lines_base[l]:
            if lines_remote[l] != "":
                resolution += lines_remote[l]
        elif lines_remote[l] == lines_base[l]:
            if lines_local[l] != "":
                resolution += lines_local[l]
        else:
            # neither match, harder conflict, return early
            return
    # all lines solved :)
    conflict.resolve(resolution)


if __name__ == '__main__':
    args = parse_arguments()
    walker = ConflictsWalker(args.merged, 'woven', args.report, args.verbose)
    while walker.has_more_conflicts():
        handle_conflict(walker.next_conflict())
    walker.end()
    sys.exit(walker.get_merge_status())
Esempio n. 2
0
        prompt += ">>>>>>> REMOTE\n" + conflict.remote
        prompt += "Select action : \n"
        prompt += " - [1] Remote First\n"
        prompt += " - [2] Local First\n"
        prompt += " - [3] Remote Only\n"
        prompt += " - [4] Local Only\n"
        prompt += " - [0] Ignore conflict\n"
        prompt += "»"
        choice = user_input(prompt)
        if choice == '0':
            use_order = ORDER_NONE
        elif choice == '1':
            use_order = ORDER_REMOTE_FIRST
        elif choice == '2':
            use_order = ORDER_LOCAL_FIRST
        elif choice == '3':
            use_order = ORDER_REMOTE_ONLY
        elif choice == '4':
            use_order = ORDER_LOCAL_ONLY
    return use_order


if __name__ == '__main__':
    args = parse_arguments()
    walker = ConflictsWalker(args.merged, 'adds', args.report, args.verbose)
    while walker.has_more_conflicts():
        handle_conflict(walker.next_conflict(), lambda c: get_order(c, args.order),
                        args.whitespace)
    walker.end()
    sys.exit(walker.get_merge_status())