Przeglądaj źródła

[IMP] repo analysis

Gogs 6 lat temu
rodzic
commit
b59dc3f56e
2 zmienionych plików z 7 dodań i 18 usunięć
  1. 6 17
      api/utils/git_api.py
  2. 1 1
      ui/templates/index.html

+ 6 - 17
api/utils/git_api.py

@@ -1,8 +1,9 @@
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals
 from django.conf import settings
-from api.utils.command import list_files_and_folders
+from api.utils.command import execute, list_files_and_folders
 from git.repo.base import Repo
+from git.db import GitDB
 from git.repo.fun import is_git_dir
 from git.util import join_path
 from git.exc import GitCommandError
@@ -19,22 +20,10 @@ def get_users_folders():
 '''
 '''
 def get_repos_paths():
-    users_folders = get_users_folders()
-    repos = []
+    cmd_out = execute(['find', settings.GIT_PATH, '-maxdepth', '2', '-type', 'd', '-name', '*.git'])
+    paths = cmd_out.split('\n')
 
-    for folder in users_folders:
-        fullpath = join_path(settings.GIT_PATH, folder)
-        subfolders = list_files_and_folders(fullpath)
-
-        for subfolder in subfolders.get('items', []):
-            fullpath = join_path(settings.GIT_PATH, folder, subfolder)
-
-            if not is_git_dir(fullpath):
-                continue
-
-            repos.append(fullpath)
-
-    return repos
+    return filter(lambda x: len(x) != 0, paths)
 
 '''
 '''
@@ -90,7 +79,7 @@ def get_odoo_modules_repos_paths():
     modules_paths = []
 
     for repo_path in repos_paths:
-        r = Repo(repo_path)
+        r = Repo(repo_path, odbt=GitDB)
 
         try:
             if '__openerp__.py' in [o.path for o in r.tree()]:

+ 1 - 1
ui/templates/index.html

@@ -10,6 +10,6 @@
     </head>
     <body>
         <div id="root"></div>
-        <script src="{% static 'main.5d06f93e.js' %}"></script>
+        <script src="{% static 'main.7383cf10.js' %}"></script>
     </body>
 </html>