Show More
@@ -42,8 +42,22 b' from os.path import dirname as dn' | |||
|
42 | 42 | sys.path.append(__root__) |
|
43 | 43 | |
|
44 | 44 | from rhodecode.lib import vcs |
|
45 | from rhodecode.lib.compat import OrderedSet | |
|
46 | from rhodecode.lib.vcs.exceptions import RepositoryError | |
|
45 | 47 | |
|
46 | BASE_URI = 'http://127.0.0.1:5001/%s' | |
|
48 | PASES = 3 | |
|
49 | HOST = 'http://127.0.0.1' | |
|
50 | PORT = 5000 | |
|
51 | BASE_URI = '%s:%s/' % (HOST, PORT) | |
|
52 | ||
|
53 | if len(sys.argv) == 2: | |
|
54 | BASE_URI = sys.argv[1] | |
|
55 | ||
|
56 | if not BASE_URI.endswith('/'): | |
|
57 | BASE_URI += '/' | |
|
58 | ||
|
59 | print 'Crawling @ %s' % BASE_URI | |
|
60 | BASE_URI += '%s' | |
|
47 | 61 | PROJECT_PATH = jn('/', 'home', 'marcink', 'hg_repos') |
|
48 | 62 | PROJECTS = [ |
|
49 | 63 | 'linux-magx-pbranch', |
@@ -62,7 +76,20 b' o.addheaders = [' | |||
|
62 | 76 | urllib2.install_opener(o) |
|
63 | 77 | |
|
64 | 78 | |
|
79 | def _get_repo(proj): | |
|
80 | if isinstance(proj, basestring): | |
|
81 | repo = vcs.get_repo(jn(PROJECT_PATH, proj)) | |
|
82 | proj = proj | |
|
83 | else: | |
|
84 | repo = proj | |
|
85 | proj = repo.name | |
|
86 | ||
|
87 | return repo, proj | |
|
88 | ||
|
89 | ||
|
65 | 90 | def test_changelog_walk(proj, pages=100): |
|
91 | repo, proj = _get_repo(proj) | |
|
92 | ||
|
66 | 93 | total_time = 0 |
|
67 | 94 | for i in range(1, pages): |
|
68 | 95 | |
@@ -81,10 +108,11 b' def test_changelog_walk(proj, pages=100)' | |||
|
81 | 108 | |
|
82 | 109 | |
|
83 | 110 | def test_changeset_walk(proj, limit=None): |
|
111 | repo, proj = _get_repo(proj) | |
|
112 | ||
|
84 | 113 | print 'processing', jn(PROJECT_PATH, proj) |
|
85 | 114 | total_time = 0 |
|
86 | 115 | |
|
87 | repo = vcs.get_repo(jn(PROJECT_PATH, proj)) | |
|
88 | 116 | cnt = 0 |
|
89 | 117 | for i in repo: |
|
90 | 118 | cnt += 1 |
@@ -106,14 +134,11 b' def test_changeset_walk(proj, limit=None' | |||
|
106 | 134 | |
|
107 | 135 | |
|
108 | 136 | def test_files_walk(proj, limit=100): |
|
137 | repo, proj = _get_repo(proj) | |
|
138 | ||
|
109 | 139 | print 'processing', jn(PROJECT_PATH, proj) |
|
110 | 140 | total_time = 0 |
|
111 | 141 | |
|
112 | repo = vcs.get_repo(jn(PROJECT_PATH, proj)) | |
|
113 | ||
|
114 | from rhodecode.lib.compat import OrderedSet | |
|
115 | from rhodecode.lib.vcs.exceptions import RepositoryError | |
|
116 | ||
|
117 | 142 | paths_ = OrderedSet(['']) |
|
118 | 143 | try: |
|
119 | 144 | tip = repo.get_changeset('tip') |
@@ -150,10 +175,10 b' def test_files_walk(proj, limit=100):' | |||
|
150 | 175 | print 'average on req', total_time / float(cnt) |
|
151 | 176 | |
|
152 | 177 | if __name__ == '__main__': |
|
153 | ||
|
154 | for p in PROJECTS: | |
|
155 | test_changelog_walk(p, 40) | |
|
156 | time.sleep(2) | |
|
157 |
test_change |
|
|
158 | time.sleep(2) | |
|
159 | test_files_walk(p, 100) | |
|
178 | for path in PROJECTS: | |
|
179 | repo = vcs.get_repo(jn(PROJECT_PATH, path)) | |
|
180 | for i in range(PASES): | |
|
181 | print 'PASS %s/%s' % (i, PASES) | |
|
182 | test_changelog_walk(repo, pages=80) | |
|
183 | test_changeset_walk(repo, limit=100) | |
|
184 | test_files_walk(repo, limit=100) |
General Comments 0
You need to be logged in to leave comments.
Login now