Changeset 4076
- Timestamp:
- 07/29/08 12:03:29 (5 months ago)
- Files:
-
- svnsyncplugin/0.11/setup.py (modified) (2 diffs)
- svnsyncplugin/0.11/svnsyncplugin/svnsync.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
svnsyncplugin/0.11/setup.py
r3750 r4076 1 1 from setuptools import find_packages, setup 2 2 3 version='0.1 '3 version='0.1.1' 4 4 5 5 setup(name='svnsyncplugin', … … 9 9 author_email='jhammel@openplans.org', 10 10 url='http://trac-hacks.org/wiki/SvnsyncPlugin', 11 keywords='trac plugin ',11 keywords='trac plugin svn', 12 12 license="GPL", 13 13 packages=find_packages(exclude=['ez_setup', 'examples', 'tests*']), svnsyncplugin/0.11/svnsyncplugin/svnsync.py
r3750 r4076 9 9 import os 10 10 import subprocess 11 12 windows = [ 'nt' ] # special-casing for windows OS; POSIX assumed otherwise 11 13 12 14 def sh(*args, **kw): … … 22 24 stdout, stderr = process.communicate() 23 25 return (stdout, stderr, process.wait()) 24 26 27 def file_uri(path): 28 # this should really live elsewhere 29 if os.name in windows: 30 uri = 'file:///' + os.path.abspath(path) 31 uri = uri.replace('\\','/') 32 else: 33 uri = 'file://' + os.path.abspath(path) 34 return uri 25 35 26 36 def create(directory, repository, username='svnsync'): … … 30 40 31 41 sh('svnadmin', 'create', directory) 32 filename = os.path.join(directory, 'hooks', 'pre-revprop-change') 42 43 filename = 'pre-revprop-change' 44 if os in windows: 45 filename += '.bat' 46 filename = os.path.join(directory, 'hooks', filename) 47 os.mknod(filename, 0770) 33 48 f = file(filename, 'w') 34 print >> f, '#!/bin/sh' 35 f.close() 36 37 # XXX only works if chmod on the path; 38 # this should retrieve the file permissions and then 39 # set them appropriate with os.chmod 40 sh('chmod', '+x', filename) 49 if os in windows: 50 print >> f, '' 51 else: 52 print >> f, '#!/bin/sh' 53 f.close() 41 54 42 55 ### initialize the sync 43 56 44 57 return sh('svnsync', 'init', '--username', username, 45 'file://%s' % os.path.abspath(directory), 46 repository) 58 file_uri(directory), repository) 47 59 48 60 def sync(directory, repository, username='svnsync'): 49 61 50 62 # create the mirror if it doesn't exist 51 #52 # XXX this should be a much better check,53 # probably using `svn info` to check if the url is the54 # same as repository55 63 if not os.path.exists(directory): 56 64 retval = create(directory, repository, username) … … 58 66 return retval 59 67 60 repo = 'file://%s' % os.path.abspath(directory)68 repo = file_uri(directory) 61 69 62 70 # ensure that the repository is pointed at the right place
