def _update_file_from_workspace(self, fullpath, wspath): same, sysinfo, wsinfo = self._check_wspath_info(fullpath, wspath) if not self._check_file_md5(fullpath, wspath): copyfile(wspath, fullpath) self.set_path_info(fullpath, info=wsinfo) else: if not same: self.set_path_info(fullpath, info=wsinfo)
def _update_file_from_system(self, fullpath, wspath): if not self._check_file_md5(fullpath, wspath): copyfile(fullpath, wspath) self._set_wspath_info(fullpath, wspath) else: same, sysinfo, wsinfo = self._check_wspath_info(fullpath, wspath) if not same: self._set_wspath_info(fullpath, wspath, info=sysinfo)
def _export_dir_to_system(self, fullpath): wspath = self._wspath(fullpath) # remove dangling files first for root, dirs, files in os.walk(fullpath, topdown=False): for name in files: fname = join(root, name) wsname = self._wspath(fname) if not os.path.exists(wsname) and not os.path.islink(wsname): print 'removing', fname os.remove(fname) for name in dirs: fname = join(root, name) wsname = self._wspath(fname) if not os.path.exists(wsname): print 'removing', fname if os.islink(fname): os.remove(fname) else: os.rmdir(fname) # export from workspace for root, dirs, files in os.walk(wspath): if self._not_svndir(root): realroot = root.split(self.workspace)[1] wsroot = self._wspath(realroot) #print 'realroot is', realroot if not os.path.exists(realroot): os.mkdir(realroot) self._update_empty_dir_from_workspace(realroot, wsroot) for name in dirs: if name != '.svn': fname = join(realroot, name) wspath = self._wspath(fname) if os.path.islink(wspath): if not os.path.exists(fname): os.symlink(os.readlink(wspath), fname) else: self._update_link_from_workspace(fname, wspath) else: if not os.path.exists(fname): os.mkdir(fname) self._update_empty_dir_from_workspace(fname, wspath) for name in files: fname = join(realroot, name) wspath = self._wspath(fname) if os.path.islink(wspath): if not os.path.exists(fname) and not os.path.islink(fname): os.symlink(os.readlink(wspath), fname) else: self._update_link_from_workspace(fname, wspath) else: if not os.path.exists(fname): copyfile(wspath, fname) self._update_file_from_workspace(fname, wspath) # fix mtimes on dirs for root, dirs, files in os.walk(self._wspath(fullpath), topdown=False): if self._not_svndir(root): realroot = root.split(self.workspace)[1] wsroot = self._wspath(realroot) for name in dirs: fname = join(realroot, name) wspath = self._wspath(fname) if self._not_svndir(wspath): if not os.path.islink(fname): self._update_empty_dir_from_workspace(fname, wspath) self._update_empty_dir_from_workspace(realroot, wsroot)
def _import_file_from_system(self, fullpath, wspath=''): if not wspath: wspath = self._wspath(fullpath) copyfile(fullpath, wspath) self.svn.add(wspath) self._set_wspath_info(fullpath, wspath)