equal
deleted
inserted
replaced
37 from cubicweb.server import SOURCE_TYPES |
37 from cubicweb.server import SOURCE_TYPES |
38 from cubicweb.server.repository import Repository |
38 from cubicweb.server.repository import Repository |
39 from cubicweb.server.serverconfig import ( |
39 from cubicweb.server.serverconfig import ( |
40 USER_OPTIONS, ServerConfiguration, SourceConfiguration, |
40 USER_OPTIONS, ServerConfiguration, SourceConfiguration, |
41 ask_source_config, generate_source_config) |
41 ask_source_config, generate_source_config) |
42 from yams.diff import schema_diff |
|
43 |
42 |
44 # utility functions ########################################################### |
43 # utility functions ########################################################### |
45 |
44 |
46 def source_cnx(source, dbname=None, special_privs=False, interactive=True): |
45 def source_cnx(source, dbname=None, special_privs=False, interactive=True): |
47 """open and return a connection to the system database defined in the |
46 """open and return a connection to the system database defined in the |
1075 name = 'schema-diff' |
1074 name = 'schema-diff' |
1076 arguments = '<instance> <diff-tool>' |
1075 arguments = '<instance> <diff-tool>' |
1077 min_args = max_args = 2 |
1076 min_args = max_args = 2 |
1078 |
1077 |
1079 def run(self, args): |
1078 def run(self, args): |
|
1079 from yams.diff import schema_diff |
1080 appid = args.pop(0) |
1080 appid = args.pop(0) |
1081 diff_tool = args.pop(0) |
1081 diff_tool = args.pop(0) |
1082 config = ServerConfiguration.config_for(appid) |
1082 config = ServerConfiguration.config_for(appid) |
1083 repo, cnx = repo_cnx(config) |
1083 repo, cnx = repo_cnx(config) |
1084 session = repo._get_session(cnx.sessionid, setcnxset=True) |
1084 session = repo._get_session(cnx.sessionid, setcnxset=True) |