Show More
@@ -27,6 +27,8 fixes | |||
|
27 | 27 | - fixed #385 clone by ID url was loosing proxy prefix in URL |
|
28 | 28 | - fixed some unicode problems with waitress |
|
29 | 29 | - fixed issue with escaping < and > in changeset commits |
|
30 | - fixed error occurring during recursive group creation in API | |
|
31 | create_repo function | |
|
30 | 32 | |
|
31 | 33 | 1.3.3 (**2012-03-02**) |
|
32 | 34 | ---------------------- |
@@ -39,6 +39,7 from rhodecode.model.repo import RepoMod | |||
|
39 | 39 | from rhodecode.model.user import UserModel |
|
40 | 40 | from rhodecode.model.users_group import UsersGroupModel |
|
41 | 41 | from rhodecode.model.repos_group import ReposGroupModel |
|
42 | from rhodecode.lib.utils import map_groups | |
|
42 | 43 | |
|
43 | 44 | |
|
44 | 45 | log = logging.getLogger(__name__) |
@@ -464,15 +465,10 class ApiController(JSONRPCController): | |||
|
464 | 465 | if Repository.get_by_repo_name(repo_name): |
|
465 | 466 | raise JSONRPCError("repo %s already exist" % repo_name) |
|
466 | 467 | |
|
467 |
groups = repo_name.split( |
|
|
468 | groups = repo_name.split(Repository.url_sep()) | |
|
468 | 469 | real_name = groups[-1] |
|
469 | groups = groups[:-1] | |
|
470 | parent_id = None | |
|
471 | for g in groups: | |
|
472 | group = RepoGroup.get_by_group_name(g) | |
|
473 | if not group: | |
|
474 | group = ReposGroupModel().create(g, '', parent_id) | |
|
475 | parent_id = group.group_id | |
|
470 | # create structure of groups | |
|
471 | group = map_groups(repo_name) | |
|
476 | 472 | |
|
477 | 473 | repo = RepoModel().create( |
|
478 | 474 | dict( |
@@ -481,7 +477,7 class ApiController(JSONRPCController): | |||
|
481 | 477 | description=description, |
|
482 | 478 | private=private, |
|
483 | 479 | repo_type=repo_type, |
|
484 |
repo_group= |
|
|
480 | repo_group=group.group_id if group else None, | |
|
485 | 481 | clone_uri=clone_uri |
|
486 | 482 | ), |
|
487 | 483 | owner |
@@ -380,15 +380,16 class EmptyChangeset(BaseChangeset): | |||
|
380 | 380 | return 0 |
|
381 | 381 | |
|
382 | 382 | |
|
383 |
def map_groups( |
|
|
383 | def map_groups(path): | |
|
384 | 384 | """ |
|
385 | Checks for groups existence, and creates groups structures. | |
|
386 | It returns last group in structure | |
|
385 | Given a full path to a repository, create all nested groups that this | |
|
386 | repo is inside. This function creates parent-child relationships between | |
|
387 | groups and creates default perms for all new groups. | |
|
387 | 388 | |
|
388 | :param groups: list of groups structure | |
|
389 | :param paths: full path to repository | |
|
389 | 390 | """ |
|
390 | 391 | sa = meta.Session |
|
391 | ||
|
392 | groups = path.split(Repository.url_sep()) | |
|
392 | 393 | parent = None |
|
393 | 394 | group = None |
|
394 | 395 | |
@@ -400,22 +401,18 def map_groups(groups): | |||
|
400 | 401 | group = RepoGroup.get_by_group_name(group_name) |
|
401 | 402 | desc = '%s group' % group_name |
|
402 | 403 | |
|
403 | # # WTF that doesn't work !? | |
|
404 | # if group is None: | |
|
405 | # group = rgm.create(group_name, desc, parent, just_db=True) | |
|
406 | # sa.commit() | |
|
407 | ||
|
408 | 404 | # skip folders that are now removed repos |
|
409 | 405 | if REMOVED_REPO_PAT.match(group_name): |
|
410 | 406 | break |
|
411 | 407 | |
|
412 | 408 | if group is None: |
|
413 |
log.debug('creating group level: %s group_name: %s' % (lvl, |
|
|
409 | log.debug('creating group level: %s group_name: %s' % (lvl, | |
|
410 | group_name)) | |
|
414 | 411 | group = RepoGroup(group_name, parent) |
|
415 | 412 | group.group_description = desc |
|
416 | 413 | sa.add(group) |
|
417 | 414 | rgm._create_default_perms(group) |
|
418 |
sa. |
|
|
415 | sa.flush() | |
|
419 | 416 | parent = group |
|
420 | 417 | return group |
|
421 | 418 | |
@@ -438,7 +435,7 def repo2db_mapper(initial_repo_list, re | |||
|
438 | 435 | added = [] |
|
439 | 436 | |
|
440 | 437 | for name, repo in initial_repo_list.items(): |
|
441 |
group = map_groups(name |
|
|
438 | group = map_groups(name) | |
|
442 | 439 | if not rm.get_by_repo_name(name, cache=False): |
|
443 | 440 | log.info('repository %s not found creating default' % name) |
|
444 | 441 | added.append(name) |
General Comments 0
You need to be logged in to leave comments.
Login now