comparison rhodecode/model/db.py @ 3472:702da441f5c4

fixed issue with renaming repos group together with changing parents with multiple nested trees added regresion tests for such cases
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 06 Mar 2013 00:20:13 +0100
parents 649ca0cc8a08
children 3563bb7b4b82
comparison
equal deleted inserted replaced
3471:d1004dd51a66 3472:702da441f5c4
1285 cnt += children_count(child) 1285 cnt += children_count(child)
1286 return cnt 1286 return cnt
1287 1287
1288 return cnt + children_count(self) 1288 return cnt + children_count(self)
1289 1289
1290 def recursive_groups_and_repos(self): 1290 def _recursive_objects(self, include_repos=True):
1291 """
1292 Recursive return all groups, with repositories in those groups
1293 """
1294 all_ = [] 1291 all_ = []
1295 1292
1296 def _get_members(root_gr): 1293 def _get_members(root_gr):
1297 for r in root_gr.repositories: 1294 if include_repos:
1298 all_.append(r) 1295 for r in root_gr.repositories:
1296 all_.append(r)
1299 childs = root_gr.children.all() 1297 childs = root_gr.children.all()
1300 if childs: 1298 if childs:
1301 for gr in childs: 1299 for gr in childs:
1302 all_.append(gr) 1300 all_.append(gr)
1303 _get_members(gr) 1301 _get_members(gr)
1304 1302
1305 _get_members(self) 1303 _get_members(self)
1306 return [self] + all_ 1304 return [self] + all_
1305
1306 def recursive_groups_and_repos(self):
1307 """
1308 Recursive return all groups, with repositories in those groups
1309 """
1310 return self._recursive_objects()
1311
1312 def recursive_groups(self):
1313 """
1314 Returns all children groups for this group including children of children
1315 """
1316 return self._recursive_objects(include_repos=False)
1307 1317
1308 def get_new_name(self, group_name): 1318 def get_new_name(self, group_name):
1309 """ 1319 """
1310 returns new full group name based on parent and new name 1320 returns new full group name based on parent and new name
1311 1321