Skip to content

Commit

Permalink
Merge pull request #288 from jayvdb/use-git-url-parser
Browse files Browse the repository at this point in the history
Revert use of giturlparse
  • Loading branch information
chfw authored Jul 10, 2019
2 parents e6b131f + f13e613 commit 4ffe02e
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .moban.cd/moban.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
- appdirs>=1.2.0
- crayons>= 0.1.0
- GitPython>=2.0.0
- giturlparse>=0.9.1
- git-url-parse>=1.2.2
description: Yet another jinja2 cli command for static text generation
scm_host: github.com
lint_command: make lint install_test format install update
1 change: 0 additions & 1 deletion .moban.d/travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ matrix:
{%block custom_python_versions%}
python:
- &pypy2 pypy2.7-6.0
- 3.8-dev
- 3.7
- 3.6
- 3.5
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ notifications:
email: false
python:
- &pypy2 pypy2.7-6.0
- 3.8-dev
- 3.7
- 3.6
- 3.5
Expand Down
2 changes: 1 addition & 1 deletion min_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ lml==0.0.9
appdirs==1.2.0
crayons== 0.1.0
GitPython==2.0.0
giturlparse==0.9.1
git-url-parse==1.2.2
10 changes: 4 additions & 6 deletions moban/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ def git_clone(requires):

def get_repo_name(repo_url):
import giturlparse
from giturlparse.parser import ParserError

try:
repo = giturlparse.parse(repo_url)
name = repo.repo
if name.endswith("/"):
name = name[:-1]
return name
except AttributeError:
repo = giturlparse.parse(repo_url.rstrip("/"))
return repo.name
except ParserError:
reporter.report_error_message(
constants.MESSAGE_INVALID_GIT_URL % repo_url
)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ lml>=0.0.9
appdirs>=1.2.0
crayons>= 0.1.0
GitPython>=2.0.0
giturlparse>=0.9.1
git-url-parse>=1.2.2
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"appdirs>=1.2.0",
"crayons>= 0.1.0",
"GitPython>=2.0.0",
"giturlparse>=0.9.1",
"git-url-parse>=1.2.2",
]
SETUP_COMMANDS = {}

Expand Down
8 changes: 5 additions & 3 deletions tests/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,16 @@ def test_update_existing_with_reference_parameter(

def test_get_repo_name():
repos = [
"https://github.com/sphinx-doc/sphinx",
"https://github.com/repo-abc-def/repo",
"https://github.com/abc/repo",
"https://github.com/abc/repo.git",
"https://github.com/abc/repo/",
"[email protected]:moremoban/moban.git",
"[email protected]:abc/repo.git",
"[email protected]:abc/repo.git",
"git://github.com/abc/repo.git",
]
actual = [get_repo_name(repo) for repo in repos]
expected = ["sphinx", "repo", "repo", "repo", "moban"]
expected = ["repo"] * len(repos)
eq_(expected, actual)


Expand Down

0 comments on commit 4ffe02e

Please sign in to comment.