#ifndef _TMBO_H_ #define _TMBO_H_ //Perforce headers are buggy #ifndef _P4_CLIENTAPI_H_ #define _P4_CLIENTAPI_H_ #include "clientapi.h" #endif #ifndef _P4_FILESYS_H_ #define _P4_FILESYS_H_ #include "filesys.h" #endif //Forward decl. class TMFSHook; //unix headers #include <iostream> #include <string.h> #include <errno.h> #include <string.h> #include <iostream> #include <sys/types.h> #include <sys/stat.h> #include <stdarg.h> #include <stdio.h> #include <grp.h> #include <pwd.h> #include <unistd.h> #include <TMTools.h> //perforce headers #include <options.h> //p4 attribute names #define TM_PERMISSION_ATTR "unixperms" #define TM_USER_ATTR "unixuser" #define TM_GROUP_ATTR "unixgroup" #define TM_PERMISSION_ATTR_GET "attr-unixperms" #define TM_USER_ATTR_GET "attr-unixuser" #define TM_GROUP_ATTR_GET "attr-unixgroup" //p4 errors. May put it in an own header... #define TM_SUCCESS 0x0000 #define TM_CONNECTION_ERROR 0x0001 using namespace std; /* Type of Handler */ enum TMBOType { STANDARD = 0x0001, SUBMIT_HANDLER = 0x0002, SYNC_HANDLER = 0x0003, EDIT_HANDLER = 0x0004, REVERT_HANDLER = 0x0005, ADD_HANDLER = 0x0006, INTEG_HANDLER = 0x0007 }; /* Data for linked list */ typedef struct sfileData { StrBuf * path;//the fs path StrBuf * vpath;//the fs path plus revision: e.g. Makefile#3 StrBuf * npath;//the new fs path for integrate StrBuf * vnpath;//the new fs path plus revision: e.g. Makefile#3 StrBuf * perm;//permissions StrBuf * uid;//name StrBuf * gid;//group } fileData; /* linked list */ typedef struct fileList { struct fileList * next; fileData * data; } fileNode; class TMBO { public: virtual ~TMBO(); //Factory method static TMBO * Create ( ClientApi * ca, TMBOType tt = STANDARD ); //Abstract methods virtual StrBuf & GetDescription ()=0; virtual void Run (Error * e = NULL)=0; //Action Method virtual void Chmod (TMFSHook * f, Error * e); //Convenient methods virtual void SetClientApi(ClientApi * ca); virtual void SetFileSys (FileSys * fs); virtual void HandleDirectories (const StrPtr &name); virtual TMBOType GetType () { return type; } int SendP4Attribute (StrBuf * path, StrBuf * attr, StrBuf * value); int RecieveP4Attributes (StrBuf * vpath); virtual void HandleArguments ( int argc, char **argv, Error * e ); //Integrated List Methods (you can replace this all, if you want) virtual fileNode * PushNode (); virtual void PopNode (); virtual void FreeList(); //Setting functions virtual fileNode * SetPath (fileNode * node, StrPtr * path); virtual fileNode * SetVPath (fileNode * node, StrPtr * vpath); virtual fileNode * SetNPath (fileNode * node, StrPtr * path); virtual fileNode * SetVNPath (fileNode * node, StrPtr * vpath);//not used virtual fileNode * SetPerm (fileNode * node, StrPtr * perm); virtual fileNode * SetUid (fileNode * node, StrPtr * uid); virtual fileNode * SetGid (fileNode * node, StrPtr * gid); //Getting functions //Add code to this function to support special character replace //like %g to # and so on. virtual StrBuf * GetPath (fileNode * node) { return node->data->path; } virtual StrBuf * GetVPath (fileNode * node) { return node->data->vpath; } virtual StrBuf * GetPerm (fileNode * node) { return node->data->perm; } virtual StrBuf * GetUid (fileNode * node) { return node->data->uid; } virtual StrBuf * GetGid (fileNode * node) { return node->data->gid; } virtual fileNode * GetTmpNode () { return tmpNode; } virtual fileNode * GetHeadNode () { return head; } //submit can here set its changelist number virtual void SetChangeList(StrPtr * cl); protected: TMBO(); virtual void SetErrorMsg (Error * e, ErrorSeverity s, const char *fmt, ...); //Connection to p4d ClientApi * ca; //Type TMBOType type; //top of stack fileNode * head; //Use this for iterations fileNode * tmpNode; //Changelis tnumber StrBuf * cl; //Data pointer (if you want to replace it with a better implementation) TMBO * data; //tools TMTools * tools; private: static TMBO * _self; }; #endif //_TMBO_H_
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 5069 | harald_strack |
ADDITIONAL command parameter handling introduced. ap4 sync -n is handled. Usually there is no need for handling any command specific parameters. Tests improved. |
||
#5 | 5056 | harald_strack |
Directory support. Serious bug concerned to not unzipped binaries removed. Some other small bugfixes. |
||
#4 | 4980 | harald_strack |
Since I am maintaining the stuff in a local repository, I did some copy errors in the last revisions. Fixed. |
||
#3 | 4978 | harald_strack |
ap4 integrate implemented. Octal format is now used to save permissions. NOT backwards compatible anymore!!! |
||
#2 | 4975 | harald_strack |
Permissions are now masked to 555, so no write is possible. If you edit the Makefile and give the parameter -DFULL_PERMS, you have the old behaviour. Bugfix in ap4 revert: Edited and changed files were not reverted correctly. |
||
#1 | 4948 | harald_strack | Initial revision. |