We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Poetry cant resolve with git dependency
I have `werkzeug` installed with git version and then add `flask-jwt-extended` shows error though `werkzeug` is 1.0.0.dev0

```bash
$ poetry --version
Poetry 0.12.11
```

```bash
$ cat pyproject.toml
[tool.poetry]
name = "test-poetry-git-deps"
version = "0.1.0"
description = ""
authors = []

[tool.poetry.dependencies]
python = "^3.6"
werkzeug = {git = "https://github.com/pallets/werkzeug.git"}

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
```

```bash
$ cat poetry.lock
[[package]]
category = "main"
description = "The comprehensive WSGI web application library."
name = "Werkzeug"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "1.0.0.dev0"

[package.source]
reference = "86f7bdf6d7c005d3ab8be50226fe42edc1ce4f7c"
type = "git"
url = "https://github.com/pallets/werkzeug.git"
[metadata]
content-hash = "7d88d5e01ecd59f104fee20ece9f80aa3b98bc2a281afc0975c36010d6af2648"
python-versions = "^3.6"

[metadata.hashes]
Werkzeug = []
```

```bash
$ poetry add flask-jwt-extended
Using version ^3.18 for flask-jwt-extended

Updating dependencies
Resolving dependencies... (6.9s)
                                                                                                                               
[SolverProblemError]                                                                                            
Because no versions of flask-jwt-extended match >3.18,<4.0                                                                   
 and flask-jwt-extended (3.18.0) depends on Werkzeug (>=0.14), flask-jwt-extended (>=3.18,<4.0) requires Werkzeug (>=0.14).  
So, because no versions of werkzeug match >=0.14                                                                             
 and test-poetry-git-deps depends on flask-jwt-extended (^3.18), version solving failed.                                     
                                                                                                                               
add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...
```

```bash
$ poetry show                                                                                                                                                                                                                                   
Werkzeug 1.0.0.dev0 86f7bdf The comprehensive WSGI web application library.
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `poetry/repositories/repository.py`
Content:
```
1 from poetry.semver import parse_constraint
2 from poetry.semver import VersionConstraint
3 from poetry.semver import VersionRange
4 
5 from .base_repository import BaseRepository
6 
7 
8 class Repository(BaseRepository):
9     def __init__(self, packages=None):
10         super(Repository, self).__init__()
11 
12         self._name = None
13 
14         if packages is None:
15             packages = []
16 
17         for package in packages:
18             self.add_package(package)
19 
20     @property
21     def name(self):
22         return self._name
23 
24     def package(self, name, version, extras=None):
25         name = name.lower()
26 
27         if extras is None:
28             extras = []
29 
30         for package in self.packages:
31             if name == package.name and package.version.text == version:
32                 # Activate extra dependencies
33                 for extra in extras:
34                     if extra in package.extras:
35                         for extra_dep in package.extras[extra]:
36                             for dep in package.requires:
37                                 if dep.name == extra_dep.name:
38                                     dep.activate()
39 
40                 return package.clone()
41 
42     def find_packages(
43         self, name, constraint=None, extras=None, allow_prereleases=False
44     ):
45         name = name.lower()
46         packages = []
47         if extras is None:
48             extras = []
49 
50         if constraint is None:
51             constraint = "*"
52 
53         if not isinstance(constraint, VersionConstraint):
54             constraint = parse_constraint(constraint)
55 
56         if isinstance(constraint, VersionRange):
57             if (
58                 constraint.max is not None
59                 and constraint.max.is_prerelease()
60                 or constraint.min is not None
61                 and constraint.min.is_prerelease()
62             ):
63                 allow_prereleases = True
64 
65         for package in self.packages:
66             if name == package.name:
67                 if package.is_prerelease() and not allow_prereleases:
68                     continue
69 
70                 if constraint.allows(package.version):
71                     for dep in package.requires:
72                         for extra in extras:
73                             if extra not in package.extras:
74                                 continue
75 
76                             reqs = package.extras[extra]
77                             for req in reqs:
78                                 if req.name == dep.name:
79                                     dep.activate()
80 
81                     if extras:
82                         package.requires_extras = extras
83 
84                     packages.append(package)
85 
86         return packages
87 
88     def has_package(self, package):
89         package_id = package.unique_name
90 
91         for repo_package in self.packages:
92             if package_id == repo_package.unique_name:
93                 return True
94 
95         return False
96 
97     def add_package(self, package):
98         self._packages.append(package)
99 
100     def remove_package(self, package):
101         package_id = package.unique_name
102 
103         index = None
104         for i, repo_package in enumerate(self.packages):
105             if package_id == repo_package.unique_name:
106                 index = i
107                 break
108 
109         if index is not None:
110             del self._packages[index]
111 
112     def search(self, query, mode=0):
113         results = []
114 
115         for package in self.packages:
116             if query in package.name:
117                 results.append(package)
118 
119         return results
120 
121     def __len__(self):
122         return len(self._packages)
123
```
--- 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()

```

diff --git a/poetry/repositories/repository.py b/poetry/repositories/repository.py
--- a/poetry/repositories/repository.py
+++ b/poetry/repositories/repository.py
@@ -64,7 +64,13 @@
 
         for package in self.packages:
             if name == package.name:
-                if package.is_prerelease() and not allow_prereleases:
+                if (
+                    package.is_prerelease()
+                    and not allow_prereleases
+                    and not package.source_type
+                ):
+                    # If prereleases are not allowed and the package is a prerelease
+                    # and is a standard package then we skip it
                     continue
 
                 if constraint.allows(package.version):

{"golden_diff": "diff --git a/poetry/repositories/repository.py b/poetry/repositories/repository.py\n--- a/poetry/repositories/repository.py\n+++ b/poetry/repositories/repository.py\n@@ -64,7 +64,13 @@\n \n         for package in self.packages:\n             if name == package.name:\n-                if package.is_prerelease() and not allow_prereleases:\n+                if (\n+                    package.is_prerelease()\n+                    and not allow_prereleases\n+                    and not package.source_type\n+                ):\n+                    # If prereleases are not allowed and the package is a prerelease\n+                    # and is a standard package then we skip it\n                     continue\n \n                 if constraint.allows(package.version):\n", "issue": "Poetry cant resolve with git dependency\nI have `werkzeug` installed with git version and then add `flask-jwt-extended` shows error though `werkzeug` is 1.0.0.dev0\r\n\r\n```bash\r\n$ poetry --version\r\nPoetry 0.12.11\r\n```\r\n\r\n```bash\r\n$ cat pyproject.toml\r\n[tool.poetry]\r\nname = \"test-poetry-git-deps\"\r\nversion = \"0.1.0\"\r\ndescription = \"\"\r\nauthors = []\r\n\r\n[tool.poetry.dependencies]\r\npython = \"^3.6\"\r\nwerkzeug = {git = \"https://github.com/pallets/werkzeug.git\"}\r\n\r\n[tool.poetry.dev-dependencies]\r\n\r\n[build-system]\r\nrequires = [\"poetry>=0.12\"]\r\nbuild-backend = \"poetry.masonry.api\"\r\n```\r\n\r\n```bash\r\n$ cat poetry.lock\r\n[[package]]\r\ncategory = \"main\"\r\ndescription = \"The comprehensive WSGI web application library.\"\r\nname = \"Werkzeug\"\r\noptional = false\r\npython-versions = \">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*\"\r\nversion = \"1.0.0.dev0\"\r\n\r\n[package.source]\r\nreference = \"86f7bdf6d7c005d3ab8be50226fe42edc1ce4f7c\"\r\ntype = \"git\"\r\nurl = \"https://github.com/pallets/werkzeug.git\"\r\n[metadata]\r\ncontent-hash = \"7d88d5e01ecd59f104fee20ece9f80aa3b98bc2a281afc0975c36010d6af2648\"\r\npython-versions = \"^3.6\"\r\n\r\n[metadata.hashes]\r\nWerkzeug = []\r\n```\r\n\r\n```bash\r\n$ poetry add flask-jwt-extended\r\nUsing version ^3.18 for flask-jwt-extended\r\n\r\nUpdating dependencies\r\nResolving dependencies... (6.9s)\r\n                                                                                                                               \r\n[SolverProblemError]                                                                                            \r\nBecause no versions of flask-jwt-extended match >3.18,<4.0                                                                   \r\n and flask-jwt-extended (3.18.0) depends on Werkzeug (>=0.14), flask-jwt-extended (>=3.18,<4.0) requires Werkzeug (>=0.14).  \r\nSo, because no versions of werkzeug match >=0.14                                                                             \r\n and test-poetry-git-deps depends on flask-jwt-extended (^3.18), version solving failed.                                     \r\n                                                                                                                               \r\nadd [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...\r\n```\r\n\r\n```bash\r\n$ poetry show                                                                                                                                                                                                                                   \r\nWerkzeug 1.0.0.dev0 86f7bdf The comprehensive WSGI web application library.\r\n```\n", "before_files": [{"content": "from poetry.semver import parse_constraint\nfrom poetry.semver import VersionConstraint\nfrom poetry.semver import VersionRange\n\nfrom .base_repository import BaseRepository\n\n\nclass Repository(BaseRepository):\n    def __init__(self, packages=None):\n        super(Repository, self).__init__()\n\n        self._name = None\n\n        if packages is None:\n            packages = []\n\n        for package in packages:\n            self.add_package(package)\n\n    @property\n    def name(self):\n        return self._name\n\n    def package(self, name, version, extras=None):\n        name = name.lower()\n\n        if extras is None:\n            extras = []\n\n        for package in self.packages:\n            if name == package.name and package.version.text == version:\n                # Activate extra dependencies\n                for extra in extras:\n                    if extra in package.extras:\n                        for extra_dep in package.extras[extra]:\n                            for dep in package.requires:\n                                if dep.name == extra_dep.name:\n                                    dep.activate()\n\n                return package.clone()\n\n    def find_packages(\n        self, name, constraint=None, extras=None, allow_prereleases=False\n    ):\n        name = name.lower()\n        packages = []\n        if extras is None:\n            extras = []\n\n        if constraint is None:\n            constraint = \"*\"\n\n        if not isinstance(constraint, VersionConstraint):\n            constraint = parse_constraint(constraint)\n\n        if isinstance(constraint, VersionRange):\n            if (\n                constraint.max is not None\n                and constraint.max.is_prerelease()\n                or constraint.min is not None\n                and constraint.min.is_prerelease()\n            ):\n                allow_prereleases = True\n\n        for package in self.packages:\n            if name == package.name:\n                if package.is_prerelease() and not allow_prereleases:\n                    continue\n\n                if constraint.allows(package.version):\n                    for dep in package.requires:\n                        for extra in extras:\n                            if extra not in package.extras:\n                                continue\n\n                            reqs = package.extras[extra]\n                            for req in reqs:\n                                if req.name == dep.name:\n                                    dep.activate()\n\n                    if extras:\n                        package.requires_extras = extras\n\n                    packages.append(package)\n\n        return packages\n\n    def has_package(self, package):\n        package_id = package.unique_name\n\n        for repo_package in self.packages:\n            if package_id == repo_package.unique_name:\n                return True\n\n        return False\n\n    def add_package(self, package):\n        self._packages.append(package)\n\n    def remove_package(self, package):\n        package_id = package.unique_name\n\n        index = None\n        for i, repo_package in enumerate(self.packages):\n            if package_id == repo_package.unique_name:\n                index = i\n                break\n\n        if index is not None:\n            del self._packages[index]\n\n    def search(self, query, mode=0):\n        results = []\n\n        for package in self.packages:\n            if query in package.name:\n                results.append(package)\n\n        return results\n\n    def __len__(self):\n        return len(self._packages)\n", "path": "poetry/repositories/repository.py"}], "after_files": [{"content": "from poetry.semver import parse_constraint\nfrom poetry.semver import VersionConstraint\nfrom poetry.semver import VersionRange\n\nfrom .base_repository import BaseRepository\n\n\nclass Repository(BaseRepository):\n    def __init__(self, packages=None):\n        super(Repository, self).__init__()\n\n        self._name = None\n\n        if packages is None:\n            packages = []\n\n        for package in packages:\n            self.add_package(package)\n\n    @property\n    def name(self):\n        return self._name\n\n    def package(self, name, version, extras=None):\n        name = name.lower()\n\n        if extras is None:\n            extras = []\n\n        for package in self.packages:\n            if name == package.name and package.version.text == version:\n                # Activate extra dependencies\n                for extra in extras:\n                    if extra in package.extras:\n                        for extra_dep in package.extras[extra]:\n                            for dep in package.requires:\n                                if dep.name == extra_dep.name:\n                                    dep.activate()\n\n                return package.clone()\n\n    def find_packages(\n        self, name, constraint=None, extras=None, allow_prereleases=False\n    ):\n        name = name.lower()\n        packages = []\n        if extras is None:\n            extras = []\n\n        if constraint is None:\n            constraint = \"*\"\n\n        if not isinstance(constraint, VersionConstraint):\n            constraint = parse_constraint(constraint)\n\n        if isinstance(constraint, VersionRange):\n            if (\n                constraint.max is not None\n                and constraint.max.is_prerelease()\n                or constraint.min is not None\n                and constraint.min.is_prerelease()\n            ):\n                allow_prereleases = True\n\n        for package in self.packages:\n            if name == package.name:\n                if (\n                    package.is_prerelease()\n                    and not allow_prereleases\n                    and not package.source_type\n                ):\n                    # If prereleases are not allowed and the package is a prerelease\n                    # and is a standard package then we skip it\n                    continue\n\n                if constraint.allows(package.version):\n                    for dep in package.requires:\n                        for extra in extras:\n                            if extra not in package.extras:\n                                continue\n\n                            reqs = package.extras[extra]\n                            for req in reqs:\n                                if req.name == dep.name:\n                                    dep.activate()\n\n                    if extras:\n                        package.requires_extras = extras\n\n                    packages.append(package)\n\n        return packages\n\n    def has_package(self, package):\n        package_id = package.unique_name\n\n        for repo_package in self.packages:\n            if package_id == repo_package.unique_name:\n                return True\n\n        return False\n\n    def add_package(self, package):\n        self._packages.append(package)\n\n    def remove_package(self, package):\n        package_id = package.unique_name\n\n        index = None\n        for i, repo_package in enumerate(self.packages):\n            if package_id == repo_package.unique_name:\n                index = i\n                break\n\n        if index is not None:\n            del self._packages[index]\n\n    def search(self, query, mode=0):\n        results = []\n\n        for package in self.packages:\n            if query in package.name:\n                results.append(package)\n\n        return results\n\n    def __len__(self):\n        return len(self._packages)\n", "path": "poetry/repositories/repository.py"}]}