Mercurial > kallithea
diff 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 |
line wrap: on
line diff
--- a/rhodecode/model/db.py Mon Mar 04 18:44:36 2013 +0100 +++ b/rhodecode/model/db.py Wed Mar 06 00:20:13 2013 +0100 @@ -1287,15 +1287,13 @@ return cnt + children_count(self) - def recursive_groups_and_repos(self): - """ - Recursive return all groups, with repositories in those groups - """ + def _recursive_objects(self, include_repos=True): all_ = [] def _get_members(root_gr): - for r in root_gr.repositories: - all_.append(r) + if include_repos: + for r in root_gr.repositories: + all_.append(r) childs = root_gr.children.all() if childs: for gr in childs: @@ -1305,6 +1303,18 @@ _get_members(self) return [self] + all_ + def recursive_groups_and_repos(self): + """ + Recursive return all groups, with repositories in those groups + """ + return self._recursive_objects() + + def recursive_groups(self): + """ + Returns all children groups for this group including children of children + """ + return self._recursive_objects(include_repos=False) + def get_new_name(self, group_name): """ returns new full group name based on parent and new name