/* Copyright © 2006, FSL Technologies Ltd. $Revision: 13 $ $Date: 7/08/06 13:06 $ */ #ifndef EVENT_HPP #define EVENT_HPP #pragma once #define EVENT_HPP_ARCHIVE L"$Archive: /FOST.3/vss2svn/event.hpp $" #define EVENT_HPP_REVISION L"$Revision: 13 $" #define EVENT_HPP_DATE L"$Date: 7/08/06 13:06 $" #include "file.hpp" namespace Migrate { const extern Setting c_iniFile; const extern Setting c_banner; const extern Setting c_settings; const extern Setting c_environment; const extern Setting c_temp; const extern Setting c_directory; const extern Setting c_root; const extern Setting c_user; const extern Setting c_password; const extern Setting c_ss; const extern Setting c_log_createprocess; const extern Setting c_use_hooks_to_replicate_dates; // The events to be played out class Create : public DEvent { public: Create( const TimeStamp &ts, Directory &path,wstring a_user ) : DEvent( ts, path ), user(a_user) { } double weight() const { return 0; } bool plan( boost::shared_ptr< Directory >, YAML::Record & ) { return false; } void migrate( YAML::Record &, boost::shared_ptr< Directory > , boost::shared_ptr< Directory > ) {} wstring user; }; class Delete : public DEvent { public: Delete( const TimeStamp &a_timestamp, Directory &path, const wstring &file ) : DEvent( a_timestamp, path ), filename( file ) { } double weight() const { return 9; } bool plan( boost::shared_ptr< Directory > root, YAML::Record &log ); void migrate( YAML::Record &log, boost::shared_ptr< Directory > root, boost::shared_ptr< Directory > tempdirectory ); private: wstring filename; boost::shared_ptr< File > file; }; class Mkdir : public DEvent { public: Mkdir( const TimeStamp &a_timestamp, Directory &path, const wstring &name ) : DEvent( a_timestamp, path ), directory( name ) { } // We need the shorter paths to have a lower weight. 5000 is arbitrary. It should just be longer than the longest pathname double weight() const { return 1. + double( location.pathname( timestamp ).length() ) / 5000.; } bool plan( boost::shared_ptr< Directory > root, YAML::Record &log ); void migrate( YAML::Record &log, boost::shared_ptr< Directory > root, boost::shared_ptr< Directory > tempdirectory ); private: wstring directory; }; class MoveProject : public DEvent { public: MoveProject( const TimeStamp &ts, Directory &path, const wstring &subdir, const wstring &dest ) : DEvent( ts, path ), subdirectory( subdir ), destination( dest ) { } double weight() const { return 8; } bool plan( boost::shared_ptr< Directory > root, YAML::Record &log ); void migrate( YAML::Record &log, boost::shared_ptr< Directory > root, boost::shared_ptr< Directory > tempdirectory ); private: wstring subdirectory, destination; }; class Recover : public DEvent { public: Recover( const TimeStamp &a_timestamp, Directory &path, const wstring &file ) : DEvent( a_timestamp, path ), filename( file ) { } double weight() const { return 4; } bool plan( boost::shared_ptr< Directory > root, YAML::Record &log ); void migrate( YAML::Record &log, boost::shared_ptr< Directory > root, boost::shared_ptr< Directory > tempdirectory ); private: wstring filename; }; class Rename : public DEvent { public: Rename( const TimeStamp ×tamp, Directory &path, const wstring startname, const wstring &endname ) : DEvent( timestamp, path ), fromname( startname ), toname( endname ) { } double weight() const { return 7; } bool plan( boost::shared_ptr< Directory > root, YAML::Record &log ); void migrate( YAML::Record &log, boost::shared_ptr< Directory > root, boost::shared_ptr< Directory > tempdirectory ); private: wstring fromname, toname; }; class Restore : public DEvent { public: Restore( const TimeStamp ×tamp, Directory &path, const wstring name, boost::shared_ptr< Directory > restore_from ) : DEvent( timestamp, path ), directory( name ), from( restore_from ) { } double weight() const { return 2; } bool plan( boost::shared_ptr< Directory > root, YAML::Record &log ); void migrate( YAML::Record &log, boost::shared_ptr< Directory > root, boost::shared_ptr< Directory > tempdirectory ); private: wstring directory; boost::shared_ptr< Directory > from; }; class Rmdir : public DEvent { public: Rmdir( const TimeStamp &a_timestamp, Directory &path, const wstring &dir ) : DEvent( a_timestamp, path ), directory( dir ) { } double weight() const { return 10; } bool plan( boost::shared_ptr< Directory > root, YAML::Record &log ); void migrate( YAML::Record &log, boost::shared_ptr< Directory > root, boost::shared_ptr< Directory > tempdirectory ); private: wstring directory; }; class Share : public DEvent { public: Share( const TimeStamp &a_timestamp, Directory &path, const wstring &name ) : DEvent( a_timestamp, path ), asmove( false ), filepathname( name ) { } double weight() const { return 6; } bool plan( boost::shared_ptr< Directory > root, YAML::Record &log ); void migrate( YAML::Record &log, boost::shared_ptr< Directory > root, boost::shared_ptr< Directory > tempdirectory ); private: bool asmove; wstring filepathname; }; class Version : public FEvent { public: Version( const FSLib::TimeStamp ×tamp, File &location, unsigned int a_version, const wstring &a_comment ,const wstring &a_user) : FEvent( timestamp, location ), comment( a_comment ), version( a_version ), user(a_user) { } double weight() const { return 5; } bool plan( boost::shared_ptr< Directory > root, YAML::Record &log ); void migrate( YAML::Record &log, boost::shared_ptr< Directory > root, boost::shared_ptr< Directory > tempdirectory ); private: unsigned int version; wstring comment; wstring user; }; } #endif // EVENT_HPP /* $History: event.hpp $ * * ***************** Version 13 ***************** * User: Kirit Date: 7/08/06 Time: 13:06 * Updated in $/FOST.3/vss2svn * File versions during a delete now work on the test database. * * ***************** Version 12 ***************** * User: Kirit Date: 4/08/06 Time: 15:34 * Updated in $/FOST.3/vss2svn * Working forwards very well. Has a problem with pinned files which needs * to be sorted out as early as possible. * * ***************** Version 11 ***************** * User: Kirit Date: 3/08/06 Time: 19:10 * Updated in $/FOST.3/vss2svn * Files in restored directories now appear in the right places. * * ***************** Version 10 ***************** * User: Kirit Date: 3/08/06 Time: 13:16 * Updated in $/FOST.3/vss2svn * Now starting to migrate to SVN. * * ***************** Version 9 ***************** * User: Kirit Date: 2/08/06 Time: 19:15 * Updated in $/FOST.3/vss2svn * Still a problem during planning where projects have been restored from * another SourceSafe database. * * ***************** Version 8 ***************** * User: Kirit Date: 31/07/06 Time: 18:01 * Updated in $/FOST.3/vss2svn * Basic sorting now seems to work. Need to solve problem of sharing to * directories that no longer exist and are no longer referenced. * * ***************** Version 7 ***************** * User: Kirit Date: 31/07/06 Time: 13:16 * Updated in $/FOST.3/vss2svn * Still can't get the sort order right because VSS sorts differently * depending on what is being done. * * ***************** Version 6 ***************** * User: Kirit Date: 29/07/06 Time: 13:52 * Updated in $/FOST.3/vss2svn * Not properly running yet. Need a better way to order the events. * * ***************** Version 5 ***************** * User: Kirit Date: 29/07/06 Time: 11:29 * Updated in $/FOST.3/vss2svn * Executes properly on test database. * * ***************** Version 4 ***************** * User: Kirit Date: 28/07/06 Time: 18:23 * Updated in $/FOST.3/vss2svn * Skeleton in - awaiting final plans. * * ***************** Version 3 ***************** * User: Kirit Date: 28/07/06 Time: 17:38 * Updated in $/FOST.3/vss2svn * Replays directory commmands. * * ***************** Version 2 ***************** * User: Kirit Date: 27/07/06 Time: 12:53 * Updated in $/FOST.3/vss2svn * Version compiles. Can now start to restructure directory handling. * * ***************** Version 1 ***************** * User: Kirit Date: 27/07/06 Time: 12:15 * Created in $/FOST.3/vss2svn * Added new source files for restructuring. */