Configuration: Python 2.6, SVN client/sever 1.7.10
I can check out a repo from within Python without issues but when it comes to committing it I've run into a but of a problem. My code uses the subprocess.call() method.
def Svn_Checkin( dir_path = "..", svn_rev = "0" ):
"""
Svn_Checkin:
check in mem_usage_db file.
dir_path should be the path to a temporary folder
svn_rev should be the latest svn rev for the input data
"""
try:
svn = os.environ[ "SVNBIN" ].strip( '"' )
except:
svn = "svn"
message = '"memory usage db update with rev %s"' % ( svn_rev )
cmd = [ svn, "ci", "-m", message ]
path = dir_path
try:
username_password = os.environ[ "GENERIC_READONLY_LOGIN" ].split()
map(lambda x: cmd.append( x ), os.environ[ "GENERIC_READONLY_LOGIN" ].split() )
except KeyError:
pass
except:
print( string.join( apply( traceback.format_exception, sys.exc_info() ), '' ) )
cmd.append( path )
print " ".join( cmd )
subprocess.call( cmd )
My code generates the following string:
svn ci -m "memory usage db update with rev 6780" c:\users\kerick~1\appdata\local\temp\tmpembglo
I can see:
Sending users\kerick~1\appdata\local\temp\tmpkv1icr\mem_usage_db.csv Transmitting file data .svn: E165001: Commit failed (details follow): svn: E165001: Commit blocked by pre-commit hook (exit code 255) with output: usage was unexpected at this time.
If I cut&paste the same string to a DOS shell and execute it, it works as expected, without error.
So, does anyone have any suggestions as to a method for committing a revision to SVN via a Python script?