prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Changelog doesn't check for date for *this* release
  https://github.com/HypothesisWorks/hypothesis-python/pull/580 is currently passing its build but shouldn't be because its date in the changelog says TBD. However the current date was present for *another*  release.
  
  The changelog check should check for the current date occurring on the same line as the current version number.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `scripts/check-changelog.py`
  Content:
  ```
  1 #!/usr/bin/env python
  2 
  3 # coding=utf-8
  4 #
  5 # This file is part of Hypothesis, which may be found at
  6 # https://github.com/HypothesisWorks/hypothesis-python
  7 #
  8 # Most of this work is copyright (C) 2013-2017 David R. MacIver
  9 # (david@drmaciver.com), but it contains contributions by others. See
  10 # CONTRIBUTING.rst for a full list of people who may hold copyright, and
  11 # consult the git log if you need to determine who owns an individual
  12 # contribution.
  13 #
  14 # This Source Code Form is subject to the terms of the Mozilla Public License,
  15 # v. 2.0. If a copy of the MPL was not distributed with this file, You can
  16 # obtain one at http://mozilla.org/MPL/2.0/.
  17 #
  18 # END HEADER
  19 
  20 from __future__ import division, print_function, absolute_import
  21 
  22 import os
  23 import sys
  24 from datetime import datetime, timedelta
  25 
  26 import hypothesistooling as tools
  27 
  28 sys.path.append(os.path.dirname(__file__))  # noqa
  29 
  30 
  31 if __name__ == '__main__':
  32 
  33     if not tools.has_source_changes():
  34         print('No source changes found')
  35         sys.exit(0)
  36 
  37     changelog = tools.changelog()
  38 
  39     if '\n%s - ' % (tools.__version__,) not in changelog:
  40         print(
  41             'The current version (%s) isn\'t mentioned in the changelog' % (
  42                 tools.__version__,))
  43         sys.exit(1)
  44 
  45     now = datetime.utcnow()
  46 
  47     hour = timedelta(hours=1)
  48 
  49     acceptable_dates = {
  50         d.strftime('%Y-%m-%d')
  51         for d in (now, now + hour, now - hour)
  52     }
  53 
  54     when = ' or '.join(sorted(acceptable_dates))
  55 
  56     if not any(d in changelog for d in acceptable_dates):
  57         print((
  58             'The current date (%s) isn\'t mentioned in the changelog. '
  59             'Remember this will be released as soon as you merge to master!'
  60         ) % (when,))
  61         sys.exit(1)
  62
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/scripts/check-changelog.py b/scripts/check-changelog.py
  --- a/scripts/check-changelog.py
  +++ b/scripts/check-changelog.py
  @@ -34,28 +34,18 @@
           print('No source changes found')
           sys.exit(0)
   
  -    changelog = tools.changelog()
  -
  -    if '\n%s - ' % (tools.__version__,) not in changelog:
  -        print(
  -            'The current version (%s) isn\'t mentioned in the changelog' % (
  -                tools.__version__,))
  -        sys.exit(1)
  -
       now = datetime.utcnow()
  -
       hour = timedelta(hours=1)
  -
  -    acceptable_dates = {
  -        d.strftime('%Y-%m-%d')
  +    acceptable_lines = sorted(set(
  +        '{} - {}'.format(tools.__version__, d.strftime('%Y-%m-%d'))
           for d in (now, now + hour, now - hour)
  -    }
  -
  -    when = ' or '.join(sorted(acceptable_dates))
  -
  -    if not any(d in changelog for d in acceptable_dates):
  -        print((
  -            'The current date (%s) isn\'t mentioned in the changelog. '
  -            'Remember this will be released as soon as you merge to master!'
  -        ) % (when,))
  +    ))
  +
  +    for line in tools.changelog().split('\n'):
  +        if line.strip() in acceptable_lines:
  +            break
  +    else:
  +        print('No line with version and current date (%s) in the changelog. '
  +              'Remember this will be released as soon as you merge to master!'
  +              % ' or '.join(repr(line) for line in acceptable_lines))
           sys.exit(1)
  
verification_info: {"golden_diff": "diff --git a/scripts/check-changelog.py b/scripts/check-changelog.py\n--- a/scripts/check-changelog.py\n+++ b/scripts/check-changelog.py\n@@ -34,28 +34,18 @@\n         print('No source changes found')\n         sys.exit(0)\n \n-    changelog = tools.changelog()\n-\n-    if '\\n%s - ' % (tools.__version__,) not in changelog:\n-        print(\n-            'The current version (%s) isn\\'t mentioned in the changelog' % (\n-                tools.__version__,))\n-        sys.exit(1)\n-\n     now = datetime.utcnow()\n-\n     hour = timedelta(hours=1)\n-\n-    acceptable_dates = {\n-        d.strftime('%Y-%m-%d')\n+    acceptable_lines = sorted(set(\n+        '{} - {}'.format(tools.__version__, d.strftime('%Y-%m-%d'))\n         for d in (now, now + hour, now - hour)\n-    }\n-\n-    when = ' or '.join(sorted(acceptable_dates))\n-\n-    if not any(d in changelog for d in acceptable_dates):\n-        print((\n-            'The current date (%s) isn\\'t mentioned in the changelog. '\n-            'Remember this will be released as soon as you merge to master!'\n-        ) % (when,))\n+    ))\n+\n+    for line in tools.changelog().split('\\n'):\n+        if line.strip() in acceptable_lines:\n+            break\n+    else:\n+        print('No line with version and current date (%s) in the changelog. '\n+              'Remember this will be released as soon as you merge to master!'\n+              % ' or '.join(repr(line) for line in acceptable_lines))\n         sys.exit(1)\n", "issue": "Changelog doesn't check for date for *this* release\nhttps://github.com/HypothesisWorks/hypothesis-python/pull/580 is currently passing its build but shouldn't be because its date in the changelog says TBD. However the current date was present for *another*  release.\r\n\r\nThe changelog check should check for the current date occurring on the same line as the current version number.\n", "before_files": [{"content": "#!/usr/bin/env python\n\n# coding=utf-8\n#\n# This file is part of Hypothesis, which may be found at\n# https://github.com/HypothesisWorks/hypothesis-python\n#\n# Most of this work is copyright (C) 2013-2017 David R. MacIver\n# (david@drmaciver.com), but it contains contributions by others. See\n# CONTRIBUTING.rst for a full list of people who may hold copyright, and\n# consult the git log if you need to determine who owns an individual\n# contribution.\n#\n# This Source Code Form is subject to the terms of the Mozilla Public License,\n# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n# obtain one at http://mozilla.org/MPL/2.0/.\n#\n# END HEADER\n\nfrom __future__ import division, print_function, absolute_import\n\nimport os\nimport sys\nfrom datetime import datetime, timedelta\n\nimport hypothesistooling as tools\n\nsys.path.append(os.path.dirname(__file__))  # noqa\n\n\nif __name__ == '__main__':\n\n    if not tools.has_source_changes():\n        print('No source changes found')\n        sys.exit(0)\n\n    changelog = tools.changelog()\n\n    if '\\n%s - ' % (tools.__version__,) not in changelog:\n        print(\n            'The current version (%s) isn\\'t mentioned in the changelog' % (\n                tools.__version__,))\n        sys.exit(1)\n\n    now = datetime.utcnow()\n\n    hour = timedelta(hours=1)\n\n    acceptable_dates = {\n        d.strftime('%Y-%m-%d')\n        for d in (now, now + hour, now - hour)\n    }\n\n    when = ' or '.join(sorted(acceptable_dates))\n\n    if not any(d in changelog for d in acceptable_dates):\n        print((\n            'The current date (%s) isn\\'t mentioned in the changelog. '\n            'Remember this will be released as soon as you merge to master!'\n        ) % (when,))\n        sys.exit(1)\n", "path": "scripts/check-changelog.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\n# coding=utf-8\n#\n# This file is part of Hypothesis, which may be found at\n# https://github.com/HypothesisWorks/hypothesis-python\n#\n# Most of this work is copyright (C) 2013-2017 David R. MacIver\n# (david@drmaciver.com), but it contains contributions by others. See\n# CONTRIBUTING.rst for a full list of people who may hold copyright, and\n# consult the git log if you need to determine who owns an individual\n# contribution.\n#\n# This Source Code Form is subject to the terms of the Mozilla Public License,\n# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n# obtain one at http://mozilla.org/MPL/2.0/.\n#\n# END HEADER\n\nfrom __future__ import division, print_function, absolute_import\n\nimport os\nimport sys\nfrom datetime import datetime, timedelta\n\nimport hypothesistooling as tools\n\nsys.path.append(os.path.dirname(__file__))  # noqa\n\n\nif __name__ == '__main__':\n\n    if not tools.has_source_changes():\n        print('No source changes found')\n        sys.exit(0)\n\n    now = datetime.utcnow()\n    hour = timedelta(hours=1)\n    acceptable_lines = sorted(set(\n        '{} - {}'.format(tools.__version__, d.strftime('%Y-%m-%d'))\n        for d in (now, now + hour, now - hour)\n    ))\n\n    for line in tools.changelog().split('\\n'):\n        if line.strip() in acceptable_lines:\n            break\n    else:\n        print('No line with version and current date (%s) in the changelog. '\n              'Remember this will be released as soon as you merge to master!'\n              % ' or '.join(repr(line) for line in acceptable_lines))\n        sys.exit(1)\n", "path": "scripts/check-changelog.py"}]}