def update_file_from_version_control(self, store): try: hooks.hook(self.project.code, "preupdate", store.file.path) except: pass # keep a copy of working files in memory before updating oldstats = store.getquickstats() working_copy = store.file.store try: logging.debug(u"updating %s from version control", store.file.path) versioncontrol.updatefile(store.file.path) store.file._delete_store_cache() store.update(update_structure=True, update_translation=True, conservative=False) remotestats = store.getquickstats() except Exception, e: #something wrong, file potentially modified, bail out #and replace with working copy logging.error( u"near fatal catastrophe, exception %s while updating %s from version control", e, store.file.path) working_copy.save() raise VersionControlError
def update_file_from_version_control(self, store): from pootle.scripts import hooks store.sync(update_translation=True) try: hooks.hook(self.project.code, "preupdate", store.file.path) except: pass # keep a copy of working files in memory before updating oldstats = store.getquickstats() working_copy = store.file.store try: logging.debug(u"updating %s from version control", store.file.path) from translate.storage import versioncontrol versioncontrol.updatefile(store.file.path) store.file._delete_store_cache() store.file._update_store_cache() except Exception, e: # something wrong, file potentially modified, bail out # and replace with working copy logging.error( u"near fatal catastrophe, exception %s while updating %s from version control", e, store.file.path ) working_copy.save() raise VersionControlError
def update_file_from_version_control(self, store): try: hooks.hook(self.project.code, "preupdate", store.file.path) except: pass # keep a copy of working files in memory before updating oldstats = store.getquickstats() working_copy = store.file.store try: logging.debug("updating %s from version control", store.file.path) versioncontrol.updatefile(store.file.path) store.file._delete_store_cache() store.update(update_structure=True, update_translation=True, conservative=False) remotestats = store.getquickstats() except Exception, e: #something wrong, file potentially modified, bail out #and replace with working copy logging.error("near fatal catastrophe, exception %s while updating %s from version control", e, store.file.path) working_copy.save() raise VersionControlError
def update_file(path): vcs_path = to_vcs_path(path) path = to_podir_path(path) versioncontrol.updatefile(vcs_path) shutil.copy2(vcs_path, path)