def update_menu(self, menu_name, menus, submenu):
        """Update the menu."""

        if exists(self.menu_path):
            menu = join(self.menu_path, menu_name)
            vc_internal = []
            vc_internal_menu = None
            if self.show_int:
                if not self.svn_disabled:
                    vc_internal.append(menus["svn"]["internal"])
                if not self.git_disabled:
                    vc_internal.append(menus["git"]["internal"])
                if not self.hg_disabled:
                    vc_internal.append(menus["hg"]["internal"])
                if len(vc_internal):
                    vc_internal_menu = ",\n".join(vc_internal)

            vc_external = []
            vc_external_menu = None
            if self.show_ext:
                if not self.svn_disabled:
                    vc_external.append(menus["svn"]["external"])
                if not self.git_disabled:
                    vc_external.append(menus["git"]["external"])
                if not self.hg_disabled:
                    vc_external.append(menus["hg"]["external"])
                if len(vc_external):
                    vc_external_menu = ",\n".join(vc_external)
            with open(menu, "w") as f:
                f.write(
                    (DIFF_SUBMENU if submenu else DIFF_MENU) % {
                        "internal": ("" if not self.show_int else menus["internal"] % {"file_name": self.name}),
                        "external": ("" if not self.show_ext else menus["external"] % {"file_name": self.name}),
                        "vc_internal": (
                            "" if vc_internal_menu is None or not self.show_int else VC_INTERNAL_MENU % {
                                "vc": vc_internal_menu
                            }
                        ),
                        "vc_external": (
                            "" if vc_external_menu is None or not self.show_ext else VC_EXTERNAL_MENU % {
                                "vc": vc_external_menu
                            }
                        )
                    }
                )
dataset/ETHPy150Open facelessuser/EasyDiff/easy_diff_dynamic_menu.py/MenuUpdater.update_menu/original