Ticket #3361: svnsync.diff

File svnsync.diff, 1.9 kB (added by anonymous, 6 months ago)

patch for windows

  • H:/Desktop/Neuer

    old new  
    3333    f = file(filename, 'w') 
    3434    print >> f, '#!/bin/sh' 
    3535    f.close() 
     36    sh('chmod', '+x', filename)  
     37 
     38    if os.name == 'nt': 
     39        filename = os.path.join(directory, 'hooks', 'pre-revprop-change.bat') 
     40        f = file(filename, 'w') 
     41        print >> f, '' 
     42        f.close() 
    3643 
    3744    # XXX only works if chmod on the path; 
    3845    # this should retrieve the file permissions and then 
    3946    # set them appropriate with os.chmod 
    4047    sh('chmod', '+x', filename)  
    4148 
    42     ### initialize the sync 
    43  
     49    ### initialize the sync     
    4450    return sh('svnsync', 'init', '--username', username,  
    45               'file://%s' % os.path.abspath(directory), 
     51              get_osfilepath(directory), 
    4652              repository) 
    4753 
    4854def sync(directory, repository, username='svnsync'): 
     
    5662        retval = create(directory, repository, username) 
    5763        if retval[-1] != 0: 
    5864            return retval 
    59  
    60     repo = 'file://%s' % os.path.abspath(directory) 
     65    repo = get_osfilepath(directory) 
    6166 
    6267    # ensure that the repository is pointed at the right place 
    6368    propget = sh('svn', 'propget',  'svn:sync-from-url', '--revprop', '-r', '0', repo) 
     
    7176        sync(directory, repository, username) 
    7277 
    7378    return sh('svnsync', 'sync', repo) 
     79 
     80def get_osfilepath(directory): 
     81    if os.name == 'nt': 
     82        syncpath = 'file:///' + os.path.abspath(directory) 
     83        syncpath = syncpath.replace('\\','/') 
     84    else: 
     85        syncpath = 'file://' + os.path.abspath(directory) 
     86    return syncpath 
    7487 
    7588if __name__ == '__main__': 
    7689    import optparse