def sync(self, dst, event): """Sync pdb-rest.db to to local target""" pdbsync = Sync( self, dst, event) pdbsync.run()
def run(self): """ Thread: Run """ s = Sync(self.src, self.dst, **self.kwargs) s.diff() self.loadInitContents(s) s.progressfnc = self.progress while True: s.diff() s.difftrim(create=self.getInitContents()) s.run() time.sleep(self.freq)
def main(): patch_win_unicode() try: config = Config() config.read() src_storage = _get_storage(config, config.src) if config.list_only or config.list_folders: walker = _get_walker(config, src_storage, config.list_format) walker.walk() else: dest_storage = _get_storage(config, config.dest) sync = Sync(config, src_storage, dest_storage) sync.run() except urllib2.URLError as e: logger.error("Error connecting to server. {!r}".format(e)) sys.exit(1) except KeyboardInterrupt: sys.exit()
def run(self, orig_args): options,args = self.parser.parse_args(orig_args) args = args[1:] if len(args) <= 0: self.print_usage() return project_dir = self.git.module_name(args[0]) if project_dir == None or len(project_dir) <= 0: print("Unknow project name.Please use git clone, then use mgit sync in the project dir.") return cmd = ['git', 'clone'] + args if options.branch != None: cmd += ["-b", options.branch] if 0 != os.system(" ".join(cmd)): return cwd = os.getcwd() os.chdir("/".join([cwd, project_dir])) sync = Sync() sync.run(['sync'] + orig_args[1:]) os.chdir(cwd)
async def run(): async def face_loop(): nonlocal face, running while running: face.processEvents() await asyncio.sleep(0.01) event_loop = asyncio.get_event_loop() event_loop.create_task(face_loop()) running = True face = Face() keychain = KeyChain() face.setCommandSigningInfo(keychain, keychain.getDefaultCertificateName()) sync = Sync(prefix=Name("/git"), face=face, on_update=on_update) sync.run() while True: await sync.publish_data(branch="test_branch", timestamp=None) await asyncio.sleep(5)