Changeset 3750

Show
Ignore:
Timestamp:
05/30/08 01:07:38 (6 months ago)
Author:
k0s
Message:

resync with fresh directory if the repository is changed; fixes #3096

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • svnsyncplugin/0.11/setup.py

    r3733 r3750  
    11from setuptools import find_packages, setup 
    22 
    3 version='0.0
     3version='0.1
    44 
    55setup(name='svnsyncplugin', 
     
    88      author='Jeff Hammel', 
    99      author_email='jhammel@openplans.org', 
    10       url='http://www.openplans.org', 
     10      url='http://trac-hacks.org/wiki/SvnsyncPlugin', 
    1111      keywords='trac plugin', 
    1212      license="GPL", 
  • svnsyncplugin/0.11/svnsyncplugin/svnsyncplugin.py

    r3733 r3750  
    5050        # these commands need to work for the plugin to work 
    5151        required_commands = ( ( 'svnsync', 'help' ), 
    52                               ( 'svnadmin', 'help' ) ) 
     52                              ( 'svnadmin', 'help' ), 
     53                              ( 'svn', 'help'), ) 
    5354         
    5455        for command in required_commands: 
  • svnsyncplugin/0.11/svnsyncplugin/svnsync.py

    r3733 r3750  
    5858            return retval 
    5959 
    60     return sh('svnsync', 'sync', 'file://%s' % os.path.abspath(directory)) 
     60    repo = 'file://%s' % os.path.abspath(directory) 
     61 
     62    # ensure that the repository is pointed at the right place 
     63    propget = sh('svn', 'propget',  'svn:sync-from-url', '--revprop', '-r', '0', repo) 
     64     
     65    url = propget[0].strip() 
     66    if url != repository.rstrip('/'): 
     67        print '>>> repository changed! %s -> %s' % (url, repository.strip()) 
     68        print '> resyncing to new repository' 
     69        import shutil 
     70        shutil.rmtree(directory) 
     71        sync(directory, repository, username) 
     72 
     73    return sh('svnsync', 'sync', repo) 
    6174 
    6275if __name__ == '__main__':