Ejemplo n.º 1
0
 def export_file(self, fullpath, section='main'):
     "old code"
     path = self._wspath(fullpath)
     symlink = False
     if not os.path.isfile(path):
         raise NoFileError, 'This file %s not in the repository' % fullpath
     if os.path.islink(path):
         symlink = True
         data = os.readlink(path)
     else:
         data = file(path).read()
     path = unroot(fullpath)
     dirs = os.path.dirname(path).split('/')
     rpath = '/'
     for d in dirs:
         rpath = join(rpath, d)
         if not os.path.isdir(rpath):
             os.mkdir(rpath)
         self.set_path_info(rpath, self.get_wspath_info(rpath))
     if symlink:
         os.symlink(fullpath, data)
     else:
         newfile = file(fullpath, 'w')
         newfile.write(data)
         newfile.close()
         info = self.get_wspath_info(fullpath)
         self.set_path_info(fullpath, info)
Ejemplo n.º 2
0
 def _handle_intermediate_dirs(self, fullpath, wspath=''):
     if not wspath:
         wspath = self._wspath(fullpath)
     ws = self.workspace
     path = unroot(fullpath)
     if os.path.dirname(path):
         dirs = os.path.dirname(path).split('/')
         cpath = ws
         rpath = '/'
         for d in dirs:
             rpath = join(rpath, d)
             cpath = join(cpath, d)
             if os.path.islink(rpath):
                 print 'There is a symlink in an intermediate directory'
                 sys.exit(1)
             if not os.path.isdir(cpath):
                 os.mkdir(cpath)
                 self.svn.add(cpath)
             self.set_wspath_info(rpath)
     else:
         if not os.path.isdir(wspath):
             os.mkdir(wspath)
             self.svn.add(wspath)
         self.set_wspath_info(fullpath)
Ejemplo n.º 3
0
 def _wspath(self, fullpath):
     return join(self.workspace, unroot(fullpath))