prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  `mkdocs new` will overwrite an existing index.md file without warning.
  If you run the command: `mkdocs new /path/to/dir` and `/path/to/dir/docs/index.md` already exists it will be replaced with out placeholder.
  
  
  </issue>
  <code>
  [start of mkdocs/new.py]
  1 # coding: utf-8
  2 from __future__ import print_function
  3 import os
  4 
  5 config_text = 'site_name: My Docs\n'
  6 index_text = """# Welcome to MkDocs
  7 
  8 For full documentation visit [mkdocs.org](http://mkdocs.org).
  9 
  10 ## Commands
  11 
  12 * `mkdocs new [dir-name]` - Create a new project.
  13 * `mkdocs serve` - Start the live-reloading docs server.
  14 * `mkdocs build` - Build the documentation site.
  15 * `mkdocs help` - Print this help message.
  16 
  17 ## Project layout
  18 
  19     mkdocs.yml    # The configuration file.
  20     docs/
  21         index.md  # The documentation homepage.
  22         ...       # Other markdown pages, images and other files.
  23 """
  24 
  25 
  26 def new(args, options):
  27     if len(args) != 1:
  28         print("Usage 'mkdocs new [directory-name]'")
  29         return
  30 
  31     output_dir = args[0]
  32 
  33     docs_dir = os.path.join(output_dir, 'docs')
  34     config_path = os.path.join(output_dir, 'mkdocs.yml')
  35     index_path = os.path.join(docs_dir, 'index.md')
  36 
  37     if os.path.exists(config_path):
  38         print('Project already exists.')
  39         return
  40 
  41     if not os.path.exists(output_dir):
  42         print('Creating project directory: %s' % output_dir)
  43         os.mkdir(output_dir)
  44 
  45     print('Writing config file: %s' % config_path)
  46     open(config_path, 'w').write(config_text)
  47 
  48     print('Writing initial docs: %s' % index_path)
  49     if not os.path.exists(docs_dir):
  50         os.mkdir(docs_dir)
  51     open(index_path, 'w').write(index_text)
  52
  [end of mkdocs/new.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/mkdocs/new.py b/mkdocs/new.py
  --- a/mkdocs/new.py
  +++ b/mkdocs/new.py
  @@ -45,6 +45,9 @@
       print('Writing config file: %s' % config_path)
       open(config_path, 'w').write(config_text)
   
  +    if os.path.exists(index_path):
  +        return
  +
       print('Writing initial docs: %s' % index_path)
       if not os.path.exists(docs_dir):
           os.mkdir(docs_dir)
  
verification_info: {"golden_diff": "diff --git a/mkdocs/new.py b/mkdocs/new.py\n--- a/mkdocs/new.py\n+++ b/mkdocs/new.py\n@@ -45,6 +45,9 @@\n     print('Writing config file: %s' % config_path)\n     open(config_path, 'w').write(config_text)\n \n+    if os.path.exists(index_path):\n+        return\n+\n     print('Writing initial docs: %s' % index_path)\n     if not os.path.exists(docs_dir):\n         os.mkdir(docs_dir)\n", "issue": "`mkdocs new` will overwrite an existing index.md file without warning.\nIf you run the command: `mkdocs new /path/to/dir` and `/path/to/dir/docs/index.md` already exists it will be replaced with out placeholder.\n\n", "before_files": [{"content": "# coding: utf-8\nfrom __future__ import print_function\nimport os\n\nconfig_text = 'site_name: My Docs\\n'\nindex_text = \"\"\"# Welcome to MkDocs\n\nFor full documentation visit [mkdocs.org](http://mkdocs.org).\n\n## Commands\n\n* `mkdocs new [dir-name]` - Create a new project.\n* `mkdocs serve` - Start the live-reloading docs server.\n* `mkdocs build` - Build the documentation site.\n* `mkdocs help` - Print this help message.\n\n## Project layout\n\n    mkdocs.yml    # The configuration file.\n    docs/\n        index.md  # The documentation homepage.\n        ...       # Other markdown pages, images and other files.\n\"\"\"\n\n\ndef new(args, options):\n    if len(args) != 1:\n        print(\"Usage 'mkdocs new [directory-name]'\")\n        return\n\n    output_dir = args[0]\n\n    docs_dir = os.path.join(output_dir, 'docs')\n    config_path = os.path.join(output_dir, 'mkdocs.yml')\n    index_path = os.path.join(docs_dir, 'index.md')\n\n    if os.path.exists(config_path):\n        print('Project already exists.')\n        return\n\n    if not os.path.exists(output_dir):\n        print('Creating project directory: %s' % output_dir)\n        os.mkdir(output_dir)\n\n    print('Writing config file: %s' % config_path)\n    open(config_path, 'w').write(config_text)\n\n    print('Writing initial docs: %s' % index_path)\n    if not os.path.exists(docs_dir):\n        os.mkdir(docs_dir)\n    open(index_path, 'w').write(index_text)\n", "path": "mkdocs/new.py"}]}