# HG changeset patch # User catherine@dellzilla # Date 1233697409 18000 # Node ID 6d7eee8ad690b857514211a058fd3da2c3c9b8f7 # Parent d8674ac6197707f760d200033eaecafdd89a7211 more work on svn diff -r d8674ac61977 -r 6d7eee8ad690 sqlpython/sqlpyPlus.py --- a/sqlpython/sqlpyPlus.py Tue Feb 03 16:08:24 2009 -0500 +++ b/sqlpython/sqlpyPlus.py Tue Feb 03 16:43:29 2009 -0500 @@ -619,11 +619,13 @@ do_pull.__doc__ += '\n\nSupported DDL types: ' + supported_ddl_types supported_ddl_types = supported_ddl_types.split(', ') - def _vc(self, arg, opts, program): - subprocess.call([program, 'init']) + def _vc(self, arg, opts, program, initializer): + subprocess.call(initializer) + os.chdir(initializer[2]) opts.dump = True self._pull(arg, opts, vc=[program, 'add']) subprocess.call([program, 'commit', '-m', '"%s"' % opts.message or 'committed from sqlpython']) + os.chdir('..') @options([ make_option('-f', '--full', action='store_true', help='get dependent objects as well'), @@ -633,7 +635,7 @@ def do_hg(self, arg, opts): '''hg (opts) (objects): Stores DDL on disk and puts files under Mercurial version control.''' - self._vc(arg, opts, 'hg') + self._vc(arg, opts, 'hg', ['hg', 'init', self.sid]) @options([ make_option('-f', '--full', action='store_true', help='get dependent objects as well'), @@ -643,7 +645,7 @@ def do_bzr(self, arg, opts): '''bzr (opts) (objects): Stores DDL on disk and puts files under Bazaar version control.''' - self._vc(arg, opts, 'bzr') + self._vc(arg, opts, 'bzr', ['bzr', 'init', self.sid]) @options([ make_option('-f', '--full', action='store_true', help='get dependent objects as well'), @@ -653,9 +655,8 @@ def do_svn(self, arg, opts): '''svn (opts) (objects): Stores DDL to disk and commits a change to SVN.''' - #subprocess.call([program, 'init']) - opts.dump = True - self._pull(arg, opts, vc=['svn', 'add']) + self._vc(arg, opts, 'svn', ['svnadmin', 'init', self.sid]) + subprocess.call(['svn', 'commit', '-m', '"%s"' % opts.message or 'committed from sqlpython']) all_users_option = make_option('-a', action='store_const', dest="scope", diff -r d8674ac61977 -r 6d7eee8ad690 sqlpython/sqlpython.py --- a/sqlpython/sqlpython.py Tue Feb 03 16:08:24 2009 -0500 +++ b/sqlpython/sqlpython.py Tue Feb 03 16:43:29 2009 -0500 @@ -41,15 +41,15 @@ print 'instance not specified and environment variable ORACLE_SID not set' return orauser = arg - sid = oraserv + self.sid = oraserv try: - host, sid = oraserv.split('/') + host, self.sid = oraserv.split('/') try: host, port = host.split(':') port = int(port) except ValueError: port = 1521 - oraserv = cx_Oracle.makedsn(host, port, sid) + oraserv = cx_Oracle.makedsn(host, port, self.sid) except ValueError: pass try: @@ -62,7 +62,7 @@ try: self.orcl = cx_Oracle.connect(orauser,orapass,oraserv,modeval) self.curs = self.orcl.cursor() - self.prompt = '%s@%s> ' % (orauser, sid) + self.prompt = '%s@%s> ' % (orauser, self.sid) except Exception, e: print e