@task
def commit():
    '''git commit source changes from all tracked files

    include:

      - add all tracked files in the work tree, include modified(M), deleted(D)
      - commit all files in the index, include added(A), modified(M),
        renamed(R), deleted(D)
      - untracked files should be manually added to the index before
        run this task

    before do commit, it requires to confirm the files to be committed; and
    the requirement before do add is a future feature, it is currently
    disabled.
    '''
    message = 'Update Documentation'
    yes_ans = ('y', 'yes')

    with settings(warn_only=True):
        # Changes in the work tree to add
        add_file = '--update .'  # include tracked files
        # hack of res.return_code without warning info
        res = local('git diff --quiet --exit-code; echo $?', capture=True)
        if int(res.strip()):
            if False:  # future feature?
                # TODO: there use diff to uniform with below, and the
                # output can be formatted like `git add --dry-run --update .`
                test_res = local('git diff --name-status', capture=True)
                try:
                    _ans = raw_input('\n{0}\nAdd these files to index? (y/N) '
                                     .format(test_res.strip()))
                    if _ans.lower() is not yes_ans:
                        local("git add {0}".format(add_file))
                except (KeyboardInterrupt, SystemExit):
                    pass
            else:
                local("git add {0}".format(add_file))

        # Changes in the index to commit
        res = local('git diff --cached --quiet --exit-code; echo $?',
                    capture=True)
        if int(res.strip()):
            test_res = local('git diff --cached --name-status', capture=True)
            try:
                _ans = raw_input('\n{0}\nCommit these files? (y/N) '
                                 .format(test_res.strip()))
                if _ans.lower() in yes_ans:
                    local("git commit -m '{0}'".format(message))
            except (KeyboardInterrupt, SystemExit):
                pass
        else:
            print('Nothing to commit.')
dataset/ETHPy150Open tankywoo/simiki/simiki/conf_templates/fabfile.py/commit/operator `in` -> `is not`