def create(self, state): if os.path.exists(state.sync["path"]): sync_tree = GitTree(root=state.sync["path"]) else: sync_tree = None if GitTree.is_type(): local_tree = GitTree() elif HgTree.is_type(): local_tree = HgTree() else: local_tree = NoVCSTree() state.update({"local_tree": local_tree, "sync_tree": sync_tree})