Repository: python-poetry/poetry

Issue:
Git w/ Non Standard Port Broken on Poetry 1.0.0b4
<!-- Checked checkbox should look like this: [x] -->
- [x] I am on the [latest](https://github.com/sdispater/poetry/releases/latest) Poetry version.
- [x] I have searched the [issues](https://github.com/sdispater/poetry/issues) of this repo and believe that this is not a duplicate.
- [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).

- **OS version and name**: macOS 10.14.6
- **Poetry version**: 1.0.0b4
- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: See Below

## Issue
I'm trying to use a git+ssh URL to a private repo using a non standard port, like this:
```toml
package = {git = "ssh://git@path.to.private.repo.com:1234/repo/project.git"}
```
This leads to an error like this:
```
[ValueError]
Invalid git url ""
```

I think the issue may be here:
https://github.com/sdispater/poetry/blob/master/poetry/vcs/git.py#L16

Specifically, I think this regex is broken:
```python
r"(:?P<port>[\d]+)?"
```
Instead, I think it should look like:
```python
r"(?P<port>:[\d]+)?"
```

If someone doesn't beat me to it I'll likely submit a PR later today or tomorrow.


Discussion:
I can confirm that we just ran into this as well with a VCS dependency on GITLAB, although, we don't even have a port, our URI looked more like

`static-analysis = {git = https://gitlab.internal.com/libraries/static-analysis.git}`

This worked just fine on version b3 and below
Even this Git URL `ssh://git@git.nanochip.vn/elevator/mibielev.git` makes Poetry 1.0.0b4 broken.

Resolving patch:
diff --git a/poetry/puzzle/solver.py b/poetry/puzzle/solver.py
--- a/poetry/puzzle/solver.py
+++ b/poetry/puzzle/solver.py
@@ -62,6 +62,9 @@ def solve(self, use_latest=None):  # type: (...) -> List[Operation]
                         pkg_source_url = Git.normalize_url(pkg.source_url)
                         package_source_url = Git.normalize_url(package.source_url)
                         for locked in self._locked.packages:
+                            if locked.name != pkg.name or locked.source_type != "git":
+                                continue
+
                             locked_source_url = Git.normalize_url(locked.source_url)
                             if (
                                 locked.name == pkg.name


Test patch:
diff --git a/tests/puzzle/test_solver.py b/tests/puzzle/test_solver.py
--- a/tests/puzzle/test_solver.py
+++ b/tests/puzzle/test_solver.py
@@ -1856,3 +1856,34 @@ def test_solver_does_not_loop_indefinitely_on_duplicate_constraints_with_extras(
         ops,
         [{"job": "install", "package": idna}, {"job": "install", "package": requests}],
     )
+
+
+def test_solver_does_not_fail_with_locked_git_and_non_git_dependencies(
+    solver, repo, package, locked, pool, installed, io
+):
+    package.add_dependency("demo", {"git": "https://github.com/demo/demo.git"})
+    package.add_dependency("a", "^1.2.3")
+
+    git_package = get_package("demo", "0.1.2")
+    git_package.source_type = "git"
+    git_package.source_url = "https://github.com/demo/demo.git"
+    git_package.source_reference = "commit"
+
+    installed.add_package(git_package)
+
+    locked.add_package(get_package("a", "1.2.3"))
+    locked.add_package(git_package)
+
+    repo.add_package(get_package("a", "1.2.3"))
+
+    solver = Solver(package, pool, installed, locked, io)
+
+    ops = solver.solve()
+
+    check_solver_result(
+        ops,
+        [
+            {"job": "install", "package": get_package("a", "1.2.3")},
+            {"job": "install", "package": git_package, "skipped": True},
+        ],
+    )