Changeset - bd333df2742f
[Under review]
default
1 4 0
Søren Løvborg (kwi) - 9 years ago 2016-05-19 11:36:50
sorenl@unity3d.com
Preceded by: e90fe823e179
[0.4] db: drop RhodeCode compatibility (database rebranding etc.)

To migrate from RhodeCode, users will have to first migrate to
Kallithea 0.3.
5 files changed with 13 insertions and 263 deletions:
1 comment (0 inline, 1 general) First comment
README.rst
Show inline comments
 
@@ -162,76 +162,14 @@ You can also build the documentation loc
 
          install it via the command: ``pip install sphinx`` .
 

	
 

	
 
Converting from RhodeCode
 
-------------------------
 

	
 
Currently, you have two options for working with an existing RhodeCode
 
database:
 

	
 
- keep the database unconverted (intended for testing and evaluation)
 
- convert the database in a one-time step
 

	
 
Maintaining interoperability
 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 

	
 
Interoperability with RhodeCode 2.2.X installations is provided so you don't
 
have to immediately commit to switching to Kallithea. This option will most
 
likely go away once the two projects have diverged significantly.
 

	
 
To run Kallithea on a RhodeCode database, run::
 

	
 
   echo "BRAND = 'rhodecode'" > kallithea/brand.py
 

	
 
This location will depend on where you installed Kallithea. If you installed
 
via::
 

	
 
   python2 setup.py install
 

	
 
then you will find this location at
 
``$VIRTUAL_ENV/lib/python2.7/site-packages/Kallithea-0.1-py2.7.egg/kallithea``.
 

	
 
One-time conversion
 
^^^^^^^^^^^^^^^^^^^
 
Migrating from RhodeCode
 
------------------------
 

	
 
Alternatively, if you would like to convert the database for good, you can use
 
a helper script provided by Kallithea. This script will operate directly on the
 
database, using the database string you can find in your ``production.ini`` (or
 
``development.ini``) file. For example, if using SQLite::
 

	
 
   cd /path/to/kallithea
 
   cp /path/to/rhodecode/rhodecode.db kallithea.db
 
   pip install sqlalchemy-migrate
 
   python2 kallithea/bin/rebranddb.py sqlite:///kallithea.db
 

	
 
.. Note::
 

	
 
   If you started out using the branding interoperability approach mentioned
 
   above, watch out for stray brand.pyc after removing brand.py.
 

	
 
Git hooks
 
^^^^^^^^^
 

	
 
After switching to Kallithea, it will be necessary to update the Git_ hooks in
 
your repositories. If not, the Git_ hooks from RhodeCode will still be called,
 
which will cause ``git push`` to fail every time.
 

	
 
If you do not have any custom Git_ hooks deployed, perform the following steps
 
(this may take some time depending on the number and size of repositories you
 
have):
 

	
 
1. Log-in as an administrator.
 

	
 
2. Open page *Admin > Settings > Remap and Rescan*.
 

	
 
3. Turn on the option **Install Git Hooks**.
 

	
 
4. Turn on the option **Overwrite existing Git hooks**.
 

	
 
5. Click on the button **Rescan Repositories**.
 

	
 
If you do have custom hooks, you will need to merge those changes manually. In
 
order to get sample hooks from Kallithea, the easiest way is to create a new Git_
 
repository, and have a look at the hooks deployed there.
 
Kallithea 0.3.x and earlier supports migrating from an existing RhodeCode
 
installation. To migrate, install the latest Kallithea 0.3.x and follow
 
the instructions in the 0.3.x README to perform a one-time conversion of
 
the database from RhodeCode to Kallithea, before upgrading to this
 
version of Kallithea.
 

	
 

	
 
.. _virtualenv: http://pypi.python.org/pypi/virtualenv
kallithea/__init__.py
Show inline comments
 
@@ -44,25 +44,15 @@ CONFIG = {}
 
# Linked module for extensions
 
EXTENSIONS = {}
 

	
 
# BRAND controls internal references in database and config to the products
 
# own name.
 
#
 
# NOTE: If you want compatibility with a database that was originally created
 
#  for use with the RhodeCode software product, change BRAND to "rhodecode",
 
#  either by editing here or by creating a new file:
 
#  echo "BRAND = 'rhodecode'" > kallithea/brand.py
 

	
 
BRAND = "kallithea"
 
try:
 
    from kallithea.brand import BRAND
 
    import kallithea.brand
 
except ImportError:
 
    pass
 

	
 
# Prefix for the ui and settings table names
 
DB_PREFIX = (BRAND + "_") if BRAND != "kallithea" else ""
 
else:
 
    assert False, 'Database rebranding is no longer supported; see README.'
 

	
 
# Users.extern_type and .extern_name value for local users
 
EXTERN_TYPE_INTERNAL = BRAND if BRAND != 'kallithea' else 'internal'
 
EXTERN_TYPE_INTERNAL = 'internal'
 

	
 
try:
 
    from kallithea.lib import get_current_revision
kallithea/bin/rebranddb.py
Show inline comments
 
deleted file
kallithea/lib/utils.py
Show inline comments
 
@@ -44,8 +44,6 @@ from paste.script.command import Command
 
from webhelpers.text import collapse, remove_formatting, strip_tags
 
from beaker.cache import _cache_decorate
 

	
 
from kallithea import BRAND
 

	
 
from kallithea.lib.vcs.utils.hgcompat import ui, config
 
from kallithea.lib.vcs.utils.helpers import get_scm
 
from kallithea.lib.vcs.exceptions import VCSError
 
@@ -366,8 +364,6 @@ def make_ui(read_from='file', path=None,
 
        for ui_ in hg_ui:
 
            if ui_.ui_active:
 
                ui_val = safe_str(ui_.ui_value)
 
                if ui_.ui_section == 'hooks' and BRAND != 'kallithea' and ui_val.startswith('python:' + BRAND + '.lib.hooks.'):
 
                    ui_val = ui_val.replace('python:' + BRAND + '.lib.hooks.', 'python:kallithea.lib.hooks.')
 
                log.debug('settings ui from db: [%s] %s=%s', ui_.ui_section,
 
                          ui_.ui_key, ui_val)
 
                baseui.setconfig(safe_str(ui_.ui_section), safe_str(ui_.ui_key),
kallithea/model/db.py
Show inline comments
 
@@ -43,7 +43,6 @@ from webob.exc import HTTPNotFound
 

	
 
from pylons.i18n.translation import lazy_ugettext as _
 

	
 
from kallithea import DB_PREFIX
 
from kallithea.lib.exceptions import DefaultUserException
 
from kallithea.lib.vcs import get_backend
 
from kallithea.lib.vcs.utils.helpers import get_scm
 
@@ -165,7 +164,7 @@ class BaseModel(object):
 
                           }
 

	
 
class Setting(Base, BaseModel):
 
    __tablename__ = DB_PREFIX + 'settings'
 
    __tablename__ = 'settings'
 
    __table_args__ = (
 
        _table_args_default_dict,
 
    )
 
@@ -328,7 +327,7 @@ class Setting(Base, BaseModel):
 

	
 

	
 
class Ui(Base, BaseModel):
 
    __tablename__ = DB_PREFIX + 'ui'
 
    __tablename__ = 'ui'
 
    __table_args__ = (
 
        # FIXME: ui_key as key is wrong and should be removed when the corresponding
 
        # Ui.get_by_key has been replaced by the composite key
1 comment (0 inline, 1 general) First comment
Søren Løvborg (kwi) 8 years and 11 months ago comment on pull request "Move to Alembic for database migrations (v2)"

Status change: Under review

You need to be logged in to comment. Login now