2
2
import os .path
3
3
import shutil
4
4
5
- from urlparse import urlparse
6
-
7
5
from django .core .exceptions import ValidationError
8
6
from django .http import HttpResponse
9
7
from django .shortcuts import redirect
21
19
Category , Page , Localisation as EGLocalisation )
22
20
23
21
24
- def parse_repo_name (repo_url ):
25
- pr = urlparse (repo_url )
26
- _ , _ , repo_name_dot_ext = pr .path .rpartition ('/' )
27
- if any ([
28
- repo_name_dot_ext .endswith ('.git' ),
29
- repo_name_dot_ext .endswith ('.json' )]):
30
- repo_name , _ , _ = repo_name_dot_ext .partition ('.' )
31
- return repo_name
32
- return repo_name_dot_ext
33
-
34
-
35
22
def clone_repo (url , name ):
36
23
repo_path = os .path .join (settings .IMPORT_CLONE_REPO_PATH , name )
37
24
if os .path .exists (repo_path ):
@@ -49,7 +36,7 @@ def import_clone_repo(request, *args, **kwargs):
49
36
'Invalid repo_url' ,
50
37
status = 400 ,
51
38
mimetype = 'application/json' )
52
- repo_index = 'import-repo-prefix-%s' % parse_repo_name (url )
39
+ repo_index = 'import-repo-prefix-%s' % utils . parse_repo_name (url )
53
40
repo = clone_repo (url , repo_index )
54
41
ws = utils .setup_workspace (repo .working_dir , repo_index )
55
42
ws .sync (EGLocalisation )
0 commit comments