code_junkie

Translate SVN path to local file system path in Python

Nov 12th, 2011
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. def formatPaths(self, paths):
  2. newPaths = list()
  3. for path in paths:
  4. path = path[len(self.basePath):]
  5. path = path.replace("/", "\")
  6. newPaths.append(path)
  7. return newPaths
  8.  
  9. baselen = len(self.basePath)
  10. return (path[baselen:].replace("/", "\") for path in paths)
  11.  
  12. from anyvc import Subversion
  13. vc = Subversion('/trunk')
  14.  
  15. modified = [f.relpath for f in vc.list() if f.state != 'clean']
  16.  
  17. for f in modified:
  18. print f.relpath # the relative path of the file to the source root
  19.  
  20. baselen = len(self.basePath)
  21. for path in paths:
  22. path = path[baselen:].replace("/", "\")
  23. newPaths.append(path)
  24. return newPaths
  25.  
  26. baselen = len(self.basePath)
  27. return (path[baselen:].replace("/", "\") for path in paths)
Add Comment
Please, Sign In to add comment