Repository: ansible/ansible

Issue:
[subversion] - Marks task as changed, if update parameter is set to "no" - and no update is applied 
##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
subversion module

##### ANSIBLE VERSION
```
ansible 2.4.0.0
  config file = /home/ansible/ansible_dev_nox/ansible.cfg
  configured module search path = [u'/home/ansible/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]

```

##### CONFIGURATION
```
ALLOW_WORLD_READABLE_TMPFILES(ansible.cfg) = True
ANSIBLE_SSH_PIPELINING(ansible.cfg) = True
CACHE_PLUGIN(ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(ansible.cfg) = ~/.cache/
CACHE_PLUGIN_TIMEOUT(ansible.cfg) = 86400
DEFAULT_BECOME(ansible.cfg) = True
DEFAULT_FORKS(ansible.cfg) = 20
DEFAULT_GATHERING(ansible.cfg) = smart
DEFAULT_HOST_LIST(ansible.cfg) = [u'hosts']
DEFAULT_MANAGED_STR(ansible.cfg) = Ansible managed file, do not edit direct
DEFAULT_REMOTE_USER(ansible.cfg) = ansible
DEFAULT_ROLES_PATH(ansible.cfg) = [u'roles']
DEFAULT_VAULT_PASSWORD_FILE(ansible.cfg) = op
RETRY_FILES_ENABLED(ansible.cfg) = False
```

##### OS / ENVIRONMENT
Debian Stretch

##### SUMMARY
If subversion update parameter is set to "no", repository won't be update but task will be marked as changed. 

##### STEPS TO REPRODUCE
  * `mkdir -p /opt/freewvs && cd /opt/freewvs`
  * Checkout svn repo on an old revision: `/opt/freewvs# svn checkout -r 868 https://svn.schokokeks.org/repos/freewvs`
  * go to playbook set update parameter to "no"
  * run playbook

<!--- Paste example playbooks or commands between quotes below -->
```yaml
- name: subversion checkout freewvs repo
  subversion:
    repo: https://svn.schokokeks.org/repos/freewvs
    dest: "/opt/freewvs/freewvs"
    update: no
  tags:
    - freewvs_checkout
```

##### EXPECTED RESULTS

Module should not mark the task as changed, if there is no update applied. (Even if there is a newer revision in the remote repo)

##### ACTUAL RESULTS
Module marks the task as changed, if there is a newer revision in the remote repo , even if no subversion update is applied and update is set to no !

```
<noc.foo.org> (0, '\r\n{"invocation": {"module_args": {"username": null, "executable": null, "force": false, "dest": "/opt/freewvs/freewvs", "update": false, "repo": "https://svn.schokokeks.org/repos/freewvs", "switch": true, "export": false, "password": null, "checkout": true, "revision": "HEAD"}}, "changed": true, "after": "Revision: 869", "before": "Revision: 868"}\r\n', 'Shared connection to noc.foo.org closed.\r\n')
changed: [noc.foo.org] => {
    "after": "Revision: 869", 
    "before": "Revision: 868", 
    "changed": true, 
    "failed": false, 
    "invocation": {
        "module_args": {
            "checkout": true, 
            "dest": "/opt/freewvs/freewvs", 
            "executable": null, 
            "export": false, 
            "force": false, 
            "password": null, 
            "repo": "https://svn.schokokeks.org/repos/freewvs", 
            "revision": "HEAD", 
            "switch": true, 
            "update": true, 
            "username": null
        }
    }
}

```



Discussion:
Files identified in the description:
* [lib/ansible/modules/source_control/subversion.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/source_control/subversion.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @dsummersl
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/lib/ansible/modules/source_control/subversion.py b/lib/ansible/modules/source_control/subversion.py
--- a/lib/ansible/modules/source_control/subversion.py
+++ b/lib/ansible/modules/source_control/subversion.py
@@ -256,7 +256,9 @@ def main():
         # Order matters. Need to get local mods before switch to avoid false
         # positives. Need to switch before revert to ensure we are reverting to
         # correct repo.
-        if module.check_mode or not update:
+        if not update:
+            module.exit_json(changed=False)
+        if module.check_mode:
             if svn.has_local_mods() and not force:
                 module.fail_json(msg="ERROR: modified files exist in the repository.")
             check, before, after = svn.needs_update()


Test patch: