Exemplo n.º 1
0
def check_conflicts():
    if git.get_conflicts():
        raise CmdException(
            "Unsolved conflicts. Please fix the conflicts"
            ' then use "git add --update <files>" or revert the'
            ' changes with "status --reset".'
        )
Exemplo n.º 2
0
def check_conflicts(iw=None):
    if iw:
        conflicts = iw.index.conflicts()
    else:
        conflicts = git.get_conflicts()
    if conflicts:
        raise CmdException(
            'Unsolved conflicts. Please fix the conflicts then use "git add '
            '--update <files>" or revert the changes with "reset --hard".')
Exemplo n.º 3
0
def func(parser, options, args):
    """Mark the conflict as resolved
    """
    if options.reset \
           and options.reset not in file_extensions():
        raise CmdException, 'Unknown reset state: %s' % options.reset

    if options.all and not options.interactive:
        resolved_all(options.reset)
        return

    conflicts = git.get_conflicts()

    if len(args) != 0:
        files = args
    elif options.all:
        files = conflicts
    else:
        parser.error('incorrect number of arguments')

    if not conflicts:
        raise CmdException, 'No more conflicts'

    # check for arguments validity
    if not options.all:
        for filename in files:
            if not filename in conflicts:
                raise CmdException, 'No conflicts for "%s"' % filename

    # resolved
    try:
        for filename in files:
            if options.interactive:
                interactive_merge(filename)
            resolved(filename, options.reset)
            del conflicts[conflicts.index(filename)]
    finally:
        # save or remove the conflicts file. Needs a finally clause to
        # ensure that already solved conflicts are marked
        if conflicts == []:
            os.remove(os.path.join(basedir.get(), 'conflicts'))
        else:
            f = file(os.path.join(basedir.get(), 'conflicts'), 'w+')
            f.writelines([line + '\n' for line in conflicts])
            f.close()
Exemplo n.º 4
0
def func(parser, options, args):
    """Mark the conflict as resolved
    """
    if options.reset \
           and options.reset not in file_extensions():
        raise CmdException, 'Unknown reset state: %s' % options.reset

    if options.all and not options.interactive:
        resolved_all(options.reset)
        return

    conflicts = git.get_conflicts()

    if len(args) != 0:
        files = args
    elif options.all:
        files = conflicts
    else:
        parser.error('incorrect number of arguments')

    if not conflicts:
        raise CmdException, 'No more conflicts'

    # check for arguments validity
    if not options.all:
        for filename in files:
            if not filename in conflicts:
                raise CmdException, 'No conflicts for "%s"' % filename

    # resolved
    try:
        for filename in files:
            if options.interactive:
                interactive_merge(filename)
            resolved(filename, options.reset)
            del conflicts[conflicts.index(filename)]
    finally:
        # save or remove the conflicts file. Needs a finally clause to
        # ensure that already solved conflicts are marked
        if conflicts == []:
            os.remove(os.path.join(basedir.get(), 'conflicts'))
        else:
            f = file(os.path.join(basedir.get(), 'conflicts'), 'w+')
            f.writelines([line + '\n' for line in conflicts])
            f.close()
Exemplo n.º 5
0
def func(parser, options, args):
    """Show the tree status
    """
    args = git.ls_files(args)
    directory.cd_to_topdir()

    if options.reset:
        directory.log = True
        if args:
            conflicts = git.get_conflicts()
            git.resolved([fn for fn in args if fn in conflicts])
            git.reset(args)
        else:
            resolved_all()
            git.reset()
    else:
        status(args, options.modified, options.new, options.deleted,
               options.conflict, options.unknown, options.noexclude)
Exemplo n.º 6
0
def resolved_all(reset = None):
    conflicts = git.get_conflicts()
    if conflicts:
        for filename in conflicts:
            resolved(filename, reset)
        os.remove(os.path.join(basedir.get(), 'conflicts'))
Exemplo n.º 7
0
def check_conflicts():
    if git.get_conflicts():
        raise CmdException('Unsolved conflicts. Please fix the conflicts'
                           ' then use "git add --update <files>" or revert the'
                           ' changes with "reset --hard".')
Exemplo n.º 8
0
def resolved_all(reset=None):
    conflicts = git.get_conflicts()
    git.resolved(conflicts, reset)
Exemplo n.º 9
0
def check_conflicts():
    if git.get_conflicts():
        raise CmdException('Unsolved conflicts. Please fix the conflicts'
                           ' then use "git add --update <files>" or revert the'
                           ' changes with "reset --hard".')