home *** CD-ROM | disk | FTP | other *** search
- // $VER: RCSControl.FPL 1.3 (26.02.95) © Jesper Skov $
-
-
- //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» Check Out ««
- void export RCSCheckOut()
- {
- int oldLine = ReadInfo("line"); // Grab cursor position
- int oldByte = ReadInfo("byte_position");
-
- Status(0,"Checking out..."); // Tell user we're working
- System(joinstr("bin:co -l \"", ReadInfo("full_file_name"), "\""));
- Status(0,"Reloading..."); // Tell user we're working
- SetInfo(-1,"protection",joinstr(ReadInfo("protection"),"w"));
- Load(ReadInfo("full_file_name")); // Reload to get protection bit
- // and ensure correct contents
- GotoLine(oldLine, oldByte); // Reposition cursor
- }
-
- //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» Setup comment buffer ««
- void export EnterRCSComment(int ReLock)
- {
- int RevisionID = New(); // Make comment buffer
- int OrgBuffer = CurrentBuffer(RevisionID);
-
- Rename("*RCS Comment*"); // rename it
- SetInfo(RevisionID, "_IsRCSBuffer", 1); // and fill parent data
- SetInfo(RevisionID, "_RCSParentBuffer", OrgBuffer);
- SetInfo(RevisionID, "_RCSReLock", ReLock);
- ReturnStatus("Press C-c C-c when comment is complete!");
- }
-
-
- //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» Check In ««
- void export RCSCheckIn()
- {
- int ParentID = ReadInfo("_RCSParentBuffer");
- int export thisID = CurrentBuffer(ParentID);
- int reLock = ReadInfo("_RCSReLock",thisID);
- string CommentName = joinstr("T:RCSComment", itoa(thisID)); // build temp name
- string ParentName = ReadInfo("full_file_name", ParentID); // get parent name
- string lock = "-u"; // How the file should be locked
-
- if (reLock) // If user wants to reLock,
- lock = "-l"; // change lock-mode.
-
- Save(); // Save parent buffer
- CurrentBuffer(thisID); // and get back to comment buffer
-
- Rename(CommentName); // Rename
- Save(); // and save comment buffer
-
- Status(0,"Checking in..."); // Tell user we're working...
-
- System(joinstr("bin:ci ", lock, " \"", ParentName, "\" < ", CommentName)); // Check In
-
- CurrentBuffer(ParentID); // return control to parent
- MaximizeView(); // Make parent only view
-
- System(joinstr("delete ", CommentName)); // Delete comment file
- Clean("Kill(thisID);"); // and the comment buffer
-
- if (!reLock) // If lock not retained
- SetInfo(-1,"protectionbits", ReadInfo("protectionbits")|4);
- // writeprotect parent buffer
- }
-
-
- //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» ChangeWFlag ««
- void export ChangeWFlag(int ReLock)
- {
- int isRCS;
- isRCS = Check(joinstr(ReadInfo("full_file_name"), ",v"),"");
- isRCS = isRCS || Check(joinstr(ReadInfo("file_path"), "RCS/", ReadInfo("file_name")),"");
-
- if ((ReadInfo("protectionbits")&4)){
- if (isRCS){
- RCSCheckOut();
- } else {
- SetInfo(-1,"protectionbits",ReadInfo("protectionbits")&0xfffb);
- // if not an RCS file, just alter
- } // the write protection flag.
- } else {
- if (isRCS)
- EnterRCSComment(ReLock);
- else {
- if (Request("Should I put the file under RCS control?","RCS request","Yes|No")){
- if (!Check(joinstr(ReadInfo("file_path"), "RCS"))){
- // Ask to create RCS dir
- if (Request("Do you want me to create an RCS directory?","RCS request","Yes|No")){
- // Creat RCS dir
- System(joinstr("makedir ",ReadInfo("file_path"), "RCS"));
- }
- }
- Request("This first comment will be used for file description.\nDo not enter revision specific information!", "RCS info","Um, OK!");
- EnterRCSComment(ReLock);
- } else {
- SetInfo(-1,"protectionbits",ReadInfo("protectionbits")|4);
- // if not an RCS file, just alter
- } // the write protection flag.
- }
- }
- }
-
-
- //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» Make history ««
- export void RCSMakeHistory()
- {
- string file = PromptFile("","Extract history from...","",""); // get file name
- if (strlen(file)){
- string history = joinstr(file,".history");
- if (Check(history)){
- switch(Request("History file already exist!","RCS request","Overwrite!|New name|Cancel")){
- case 2: // Ask new file name
- history = PromptFile(history,"Select output file...","","s");
- break;
- case 0: // Cancel operation by setting empty name
- history="";
- break;
- }
- }
- if (strlen(history)){ // Only continue if name defined
- int prevVisible = Visible(0); // Disable screen update
- int histID = New(); // Get new buffer
-
- System(joinstr("bin:rlog \"", file, "\" >",history)); // Get history created
- CurrentBuffer(histID);
- Load(history); // load history
- DeleteLine(11); // and make history a bit more readable:
- SearchSet("=of+","date:"); // Erase difference info
- while (!Search("date:")){
- Search(";");
- DeleteEol();
- }
- GotoLine(1);
- Save(""); // update file to disk
- Visible(prevVisible); // and update screen
- RedrawScreen(0);
- }
- }
- }
-
-
- //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» Key bindings ««
- AssignKey("ChangeWFlag(0);","control x control q","");
- AssignKey("ChangeWFlag(1);","control x control Q","");
- AssignKey("RCSCheckIn();","control c control c", "_IsRCSBuffer");
- AssignKey("Kill();","control g", "_IsRCSBuffer");
-
-
- //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» Hidden variables ««
- ConstructInfo("_IsRCSBuffer","","", "LBH", "",0,1,0);
- ConstructInfo("_RCSReLock","","", "LBH", "",0,1,0);
- ConstructInfo("_RCSParentBuffer","","", "LIH", "",0,0x7fffffff,0);
-