code: public void updateModule(String importFile) throws Exception {
  
          CmsModule module = CmsModuleImportExportHandler.readModuleFromImport(importFile);
          String moduleName = module.getName();
          String moduleVersion = module.getVersionStr();
          m_shell.getOut().println("Updating module " + moduleName + " version " + moduleVersion);
          if (OpenCms.getModuleManager().getModule(moduleName) != null) {
  
              String oldVersion = OpenCms.getModuleManager().getModule(moduleName).getVersionStr();
              m_shell.getOut().println("Previous version '" + oldVersion + "' detected");
              if (!oldVersion.equals(moduleVersion)) {
                  // the import version does not equal the present module version, replace the module
                  OpenCms.getModuleManager().replaceModule(
                      m_cms,
                      importFile,
                      new CmsShellReport(m_cms.getRequestContext().getLocale()));
              }
          } else {
              importModule(importFile);
          }
      }
docs: Updates a module with another revision in case their module versions differ.<p>
  
  @param importFile the name of the import file
  
  @throws Exception if something goes wrong