changeset 223:6d7eee8ad690

more work on svn
author catherine@dellzilla
date Tue, 03 Feb 2009 16:43:29 -0500
parents d8674ac61977
children 582c84365f6a
files sqlpython/sqlpyPlus.py sqlpython/sqlpython.py
diffstat 2 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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",
--- 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