##// END OF EJS Templates
Updated test_crawler to scan paths in more sensible order using ordered tuple.
marcink -
r1338:bbfc3f30 beta
parent child Browse files
Show More
@@ -70,15 +70,17 b' def test_changelog_walk(pages=100):'
70 70 print 'average on req', total_time / float(pages)
71 71
72 72
73 def test_changeset_walk():
74 print jn(PROJECT_PATH, PROJECT)
73 def test_changeset_walk(limit=None):
74 print 'processing', jn(PROJECT_PATH, PROJECT)
75 75 total_time = 0
76 76
77 77 repo = vcs.get_repo(jn(PROJECT_PATH, PROJECT))
78
78 cnt = 0
79 79 for i in repo:
80
80 cnt += 1
81 81 raw_cs = '/'.join((PROJECT, 'changeset', i.raw_id))
82 if limit and limit == cnt:
83 break
82 84
83 85 full_uri = (BASE_URI % raw_cs)
84 86 s = time.time()
@@ -89,23 +91,29 b' def test_changeset_walk():'
89 91 print 'visited %s\%s size:%s req:%s ms' % (full_uri, i, size, e)
90 92
91 93 print 'total_time', total_time
92 print 'average on req', total_time / float(len(repo))
94 print 'average on req', total_time / float(cnt)
95
93 96
94 97 def test_files_walk():
95 print jn(PROJECT_PATH, PROJECT)
98 print 'processing', jn(PROJECT_PATH, PROJECT)
96 99 total_time = 0
97 100
98 101 repo = vcs.get_repo(jn(PROJECT_PATH, PROJECT))
99 102
100 paths_ = set()
103 from rhodecode.lib.oset import OrderedSet
104
105 paths_ = OrderedSet([''])
101 106 try:
102 107 tip = repo.get_changeset('tip')
103 108 for topnode, dirs, files in tip.walk('/'):
109
110 for dir in dirs:
111 paths_.add(dir.path)
112 for f in dir:
113 paths_.add(f.path)
114
104 115 for f in files:
105 116 paths_.add(f.path)
106 for dir in dirs:
107 for f in files:
108 paths_.add(f.path)
109 117
110 118 except vcs.exception.RepositoryError, e:
111 119 pass
@@ -125,6 +133,7 b' def test_files_walk():'
125 133 print 'average on req', total_time / float(len(repo))
126 134
127 135
128 #test_changelog_walk()
129 #test_changeset_walk()
130 136 test_files_walk()
137 test_changelog_walk(40)
138 test_changeset_walk(limit=100)
139
General Comments 0
You need to be logged in to leave comments. Login now