create_repo fails if repo_name includes groups that already exist (v1.2.5)

Issue #631 resolved
Damian Ryan created an issue

Hi Marcin

This is more in the way of a query than an absolute bug report.

I am trying to use the API to create a repository within an existing group, but this fails.

For example, say I have the groups


in existence, containing a repository called "myproj", whose URL is therefore:


I want to create a new repository in a new group under 1.1, for example:


(for example, to represent a fork for patches to version 1.1.20).

However, if I call create_repo in v1.2.5 and pass in the "name" argument as "project/forks/1.1/20/myproj", the creation fails.

From the logs it looks like the failure is because the groups higher up in the hierarchy already exist.

Is this a known defect (I searched but couldn't see anything that looked similar)?

Is it fixed in a later version of RhodeCode?

The error in the logs is:

2012-10-29 13:26:28.217 ERROR [rhodecode.model.repos_group] Traceback (most recent call last):
  File "/HG/rhodecode-venv/lib/python2.6/site-packages/RhodeCode-1.2.5-py2.6.egg/rhodecode/model/", line 116, in create
  File "/HG/rhodecode-venv/lib/python2.6/site-packages/RhodeCode-1.2.5-py2.6.egg/rhodecode/model/", line 61, in __create_group
    create_path = os.path.join(self.repos_path, group_name)
  File "/HG/rhodecode-venv/lib/python2.6/site-packages/vcs-0.2.2-py2.6.egg/vcs/utils/", line 26, in __get__
    result = obj.__dict__[self.__name__] = self._func(obj)
  File "/HG/rhodecode-venv/lib/python2.6/site-packages/RhodeCode-1.2.5-py2.6.egg/rhodecode/model/", line 50, in repos_path
    q = RhodeCodeUi.get_by_key('/').one()
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/", line 2014, in one
    ret = list(self)
  File "/HG/rhodecode-venv/lib/python2.6/site-packages/RhodeCode-1.2.5-py2.6.egg/rhodecode/model/", line 82, in __iter__
    return Query.__iter__(self)
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/", line 2056, in __iter__
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/", line 973, in _autoflush
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/", line 1547, in flush
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/", line 1616, in _flush
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/", line 323, in execute
    n.execute_aggregate(self, set_)
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/", line 554, in execute_aggregate
  File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/", line 2291, in _save_obj
    execute(statement, params)
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/", line 1405, in execute
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/", line 1538, in _execute_clauseelement
    compiled_sql, distilled_params
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/", line 1646, in _execute_context
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/", line 1639, in _execute_context
  File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/", line 330, in do_execute
    cursor.execute(statement, parameters)
IntegrityError: (IntegrityError) column group_name is not unique u'INSERT INTO groups (group_name, group_parent_id, group_description) VALUES (?, ?, ?)' (u'project/forks', 4, '')

Comments (2)

  1. Damian Ryan reporter

    Answered my own question - installed v1.4.4 and retried my use case - it works in this version.

    Guess I'll have to upgrade the RhodeCode server at work to the latest version.


  2. Log in to comment