Panda3D
 All Classes Functions Variables Enumerations
cvsCopy.h
00001 // Filename: cvsCopy.h
00002 // Created by:  drose (31Oct00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef CVSCOPY_H
00016 #define CVSCOPY_H
00017 
00018 #include "pandatoolbase.h"
00019 
00020 #include "cvsSourceTree.h"
00021 
00022 #include "programBase.h"
00023 #include "filename.h"
00024 #include "pvector.h"
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : CVSCopy
00028 // Description : This is the base class for a family of programs that
00029 //               copy files, typically model files like .flt files and
00030 //               their associated textures, into a CVS-controlled
00031 //               source tree.
00032 ////////////////////////////////////////////////////////////////////
00033 class CVSCopy : public ProgramBase {
00034 public:
00035   CVSCopy();
00036 
00037   CVSSourceTree::FilePath
00038   import(const Filename &source, void *extra_data,
00039          CVSSourceDirectory *suggested_dir);
00040 
00041   bool continue_after_error();
00042 
00043 protected:
00044   virtual bool handle_args(Args &args);
00045   virtual bool post_command_line();
00046 
00047   virtual bool verify_file(const Filename &source, const Filename &dest,
00048                            CVSSourceDirectory *dest_dir,
00049                            void *extra_data);
00050   virtual bool copy_file(const Filename &source, const Filename &dest,
00051                          CVSSourceDirectory *dest_dir,
00052                          void *extra_data, bool new_file)=0;
00053 
00054   bool verify_binary_file(Filename source, Filename dest);
00055   bool copy_binary_file(Filename source, Filename dest);
00056 
00057   bool cvs_add(const Filename &filename);
00058   static string protect_from_shell(const string &source);
00059 
00060   virtual string filter_filename(const string &source);
00061 
00062 private:
00063   bool scan_hierarchy();
00064   bool scan_for_root(const string &dirname);
00065   string prompt(const string &message);
00066 
00067 protected:
00068   bool _force;
00069   bool _interactive;
00070   bool _got_model_dirname;
00071   Filename _model_dirname;
00072   bool _got_map_dirname;
00073   Filename _map_dirname;
00074   bool _got_root_dirname;
00075   Filename _root_dirname;
00076   Filename _key_filename;
00077   bool _no_cvs;
00078   string _cvs_binary;
00079   bool _user_aborted;
00080 
00081   typedef pvector<Filename> SourceFiles;
00082   SourceFiles _source_files;
00083 
00084   CVSSourceTree _tree;
00085   CVSSourceDirectory *_model_dir;
00086   CVSSourceDirectory *_map_dir;
00087 
00088   typedef pmap<string, CVSSourceTree::FilePath> CopiedFiles;
00089   CopiedFiles _copied_files;
00090 };
00091 
00092 #endif
 All Classes Functions Variables Enumerations