method cvs_commit_dir ?(comment="") dir =
      try
        Ocvs_commands.commit_dir ~comment: comment dir;
        (* Update the elements in data. *)
        try
          let check_dirs = dir :: (Ocvs_misc.get_cvs_directories dir) in
          let f d =
            let files = List.map
                (fun e -> (data#cvs_info_of_t e).Ocvs_types.cvs_file)
                (data#elements d)
            in
            (* we remove the files which don't appear any more *)
            let (exist, not_exist) = List.partition Sys.file_exists files in
            List.iter data#remove_element not_exist ;
            (* and update the others *)
            self#cvs_status_files exist
          in
          List.iter f check_dirs
        with _ -> ()
      with
        CvsFailure s
      |        CvsPartFailure s ->
          raise (Failure s)