Changeset 76

Show
Ignore:
Timestamp:
2009年03月08日 17时10分58秒 (3 years ago)
Author:
jiangx
Message:

When initial a new repository, do not delete hooks recursively if hooks is a link not a directory. Fixed #20.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pysvnmanager/model/repos.py

    r71 r76  
    105105        if os.path.exists(dest): 
    106106            assert os.path.basename(dest) == 'hooks' 
    107             shutil.rmtree(dest) 
     107            if os.path.isdir(dest): 
     108                shutil.rmtree(dest) 
     109            else: 
     110                os.unlink(dest) 
    108111        elif not os.path.exists(os.path.dirname(dest)): 
    109112            raise Exception("Destination repository '%s' not exist!" % os.path.dirname(dest)) 
     
    133136        if os.path.exists(dest): 
    134137            assert os.path.basename(dest) == 'hooks' 
    135             shutil.rmtree(dest) 
     138            if os.path.isdir(dest): 
     139                shutil.rmtree(dest) 
     140            else: 
     141                os.unlink(dest) 
    136142        elif not os.path.exists(os.path.dirname(dest)): 
    137143            raise Exception("Destination repository '%s' not exist!" % os.path.dirname(dest))