def mks2hg(prj_path, root_dir): mks = Commander('si', '=') hg = Commander('hg', ' ') root_prj = mks_get_project(mks, prj_path) # if hg already created, working on resync mode cp_syned = [] if os.path.exists(root_dir + '.hg'): cp_syned = hg_get_commited_cps(hg, root_dir) else: hg.init(root_dir) # retrieve list of cp to sync. cps = root_prj.get_changepackages(lambda id: id not in set(cp_syned)) # sync change packages. for cp in cps: cp.update_fs(root_prj) logging.info("Applying change packages...") for cp in cps: logging.debug(cp) if cp.apply_change(root_prj, root_dir): hg_commit(hg, root_dir, cp) else: logging.debug("Ignore cp %s)" % cp.id)
def mks2hg(prj_path, root_dir): mks = Commander('si', '=') hg = Commander('hg', ' ') root_prj = mks_get_project(mks, prj_path) # if hg already created, working on resync mode cp_syned = [] if os.path.exists(root_dir + '.hg'): cp_syned = hg_get_commited_cps(hg, root_dir) else: hg.init(root_dir) # retrieve list of cp to sync. cps = root_prj.get_changepackages(lambda id : id not in set(cp_syned)) # sync change packages. for cp in cps: cp.update_fs(root_prj) logging.info("Applying change packages...") for cp in cps: logging.debug(cp) if cp.apply_change(root_prj, root_dir): hg_commit(hg, root_dir, cp) else: logging.debug("Ignore cp %s)" % cp.id)