Mercurial > kallithea
comparison rhodecode/lib/utils.py @ 684:2abb398cd9a7 beta
upgrade-db command dummy
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 13 Nov 2010 02:33:50 +0100 |
parents | 070f32743632 |
children | 8acbfa837180 |
comparison
equal
deleted
inserted
replaced
683:341beaa9edba | 684:2abb398cd9a7 |
---|---|
30 from rhodecode.model.db import Repository, User, RhodeCodeUi, RhodeCodeSettings, \ | 30 from rhodecode.model.db import Repository, User, RhodeCodeUi, RhodeCodeSettings, \ |
31 UserLog | 31 UserLog |
32 from rhodecode.model.repo import RepoModel | 32 from rhodecode.model.repo import RepoModel |
33 from rhodecode.model.user import UserModel | 33 from rhodecode.model.user import UserModel |
34 from vcs.backends.base import BaseChangeset | 34 from vcs.backends.base import BaseChangeset |
35 from vcs.backends.git import GitRepository | 35 from paste.script import command |
36 from vcs.backends.hg import MercurialRepository | 36 import ConfigParser |
37 from vcs.utils.lazy import LazyProperty | 37 from vcs.utils.lazy import LazyProperty |
38 import traceback | 38 import traceback |
39 import datetime | 39 import datetime |
40 import logging | 40 import logging |
41 import os | 41 import os |
515 | 515 |
516 cur_dir = dn(dn(abspath(__file__))) | 516 cur_dir = dn(dn(abspath(__file__))) |
517 tar = tarfile.open(jn(cur_dir, 'tests', "vcs_test.tar.gz")) | 517 tar = tarfile.open(jn(cur_dir, 'tests', "vcs_test.tar.gz")) |
518 tar.extractall('/tmp') | 518 tar.extractall('/tmp') |
519 tar.close() | 519 tar.close() |
520 | |
521 class UpgradeDb(command.Command): | |
522 """Command used for paster to upgrade our database to newer version | |
523 """ | |
524 | |
525 max_args = 1 | |
526 min_args = 1 | |
527 | |
528 usage = "CONFIG_FILE" | |
529 summary = "Upgrades current db to newer version given configuration file" | |
530 group_name = "RhodeCode" | |
531 | |
532 parser = command.Command.standard_parser(verbose=True) | |
533 | |
534 parser.add_option('--sql', | |
535 action='store_true', | |
536 dest='just_sql', | |
537 help="Prints upgrade sql for further investigation", | |
538 default=False) | |
539 def command(self): | |
540 config_name = self.args[0] | |
541 p = config_name.split('/') | |
542 root = '.' if len(p) == 1 else '/'.join(p[:-1]) | |
543 config = ConfigParser.ConfigParser({'here':root}) | |
544 config.read(config_name) |