// // Copyright 2000 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wResolvePane: // Generates a form used for constructing a resolve command #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wResolvePane.h" // // Options for resolve static char *const resolveOpts[] = { "-as", "-am", "-af", "-ay", "-at" }; static char *const resolveOptsText[] = { "Accept safe (unilateral) changes", "Accept only non-conflicting merges", "Accept all merges", "Accept yours (ignore theirs)", "Accept theirs (ignore yours)" }; p4wResolvePane::p4wResolvePane( p4wView & ParentView, p4wRequest & Request, int isFileBrowser ) : p4wRunPane( ParentView, Request ), fIsFileBrowser(isFileBrowser), fGotOneFile(0) { } p4wResolvePane::~p4wResolvePane() { } // ------------------------------------- // Render functions. // void p4wResolvePane::Begin() { // // Fetch and build the ACTION value. StrBuf actionURL; GetAction( actionURL ); // // Begin the pane. DoComment( "BEGIN RESOLVE PANE" ); BeginForm( "Resolve:", actionURL ); // // Generate the Options segment. BeginOptions(); // // DO we have a remote browser and a folder path? char *p = fRequest.GetPath().Text(); char c = *(p + strlen(p) - 1); int isDir = (c == '/' || c == '\\'); int hasSpace = 0; #ifndef OS_NT if (isDir) hasSpace = strchr(p, ' ') ? 1 : 0; #endif if ((!fRequest.isLocalRequest() || hasSpace) && isDir) { p4wHtml htm; htm.beginCol(0,0,"2"); htm << " (Folders cannot be resolved interactively when "; if (!fRequest.isLocalRequest()) htm << "accessing P4Web remotely)"; else htm << "their path contains a space)"; htm.endCol(); htm.endTRow(); htm.beginTRow(); htm.beginCol(); htm.endCol(); htm.beginCol(0,0,"2"); htm << " Automatically"; fRequest << htm; DoHidden( 0, "Option", "automatic" ); } else { DoRadio( 0, 1, "Option", "interactive", fRequest.isLocalRequest() ? "Interactively <i>(Brings up separate command-line window)</i>" : "Interactively", 1, 1, "interactive" ); DoRadio( 1, 0, "Option", "automatic", "Automatically", 0, 0, "automatic" ); } BeginSelect( "OptionRes", "setCheckedValue(document.forms['Run'].elements['Option'], 'automatic')" ); for( int i = 0; i < 5; i++ ) DoOption( resolveOptsText[i], resolveOpts[i] ); EndSelect(); DoCheckbox( 1, 0, "OptionFrc", "force", "Force re-resolve of previously resolved files", 1, 1, 1 ); DoCheckbox( 1, 0, "OptionMark", "mark", "Mark non-conflicting changes in merged result", 1, 1, 1 ); // // Start off the Files portion. BeginFiles( fRequest.GetPath() ); } void p4wResolvePane::Render( StrDict * varList ) { // // Skip files that don't need resolve if( !fIsFileBrowser) { StrPtr * needsResolve = varList->GetVar( "unresolved" ); if( !needsResolve ) return; } if( !fGotOneFile && !fIsFileBrowser ) { // // If we are at the // directory, the // Files in subdirectory/this level only // choices are either redundant or useless, // so replace them with one choice for // all opened files. if( fRequest.GetPath() == "//" ) DoRadio( 0, 0, "Files", "all", "All opened files", 0, 0, "Filesall" ); else FilesIn( 1, 0, fRequest.GetPath().Text(), "All opened files", 1 ); BeginSelected( 1, FilesUnchecked() ); fGotOneFile = 1; } StrPtr *depotFile = varList->GetVar( "depotFile" ); StrPtr *clientFile = varList->GetVar( "clientFile" ); StrPtr *headType = varList->GetVar( "headType" ); // // If clientFile isn't available use depotFile instead if( !clientFile ) clientFile = depotFile; if( !fIsFileBrowser ) { // // If page content limit in bytes has been exceeded, don't // generate this entry if( PageLimitExceeded() ) return; // // Display depotFile in form, but send clientFile // in command for performance reasons. DoFile( !FilesUnchecked(), clientFile, depotFile ); } else { DoListItem( depotFile->Text() ); DoHidden( 1, "File", depotFile->Text() ); if (fRequest.GetViewMode() == VM_WORKSPACE && clientFile) DoHidden( 1, "actionFile", clientFile->Text() ); else DoHidden( 1, "actionFile", depotFile->Text() ); if (headType) DoHidden( 1, "headType", headType->Text() ); } } void p4wResolvePane::End() { // // End the Files list if we had one. Other // choices have already been rendered. if( fGotOneFile ) { EndFiles(); // // Pathbrowser at the top directory level has only // one choice: all files in view, so hard-code it. } else if( !fIsFileBrowser && fRequest.GetPath() == "//" ) { DoListItem( "All files in //..." ); DoHidden( 0, "Files", "in" ); DoHidden( 0, "dirVal", "and subdirectories" ); // // Pathbrowser not at top directory: show options // of Files in this path and files in this path and // subdirectories } else if( !fIsFileBrowser ) { FilesIn( 1, 1, fRequest.GetPath().Text(), "All opened files", 1 ); } // // Draw the buttons BeginButtons(); DoHidden( 0, "formActions", "preview" ); DoHidden( 0, "formActions", "resolve" ); DoHidden( 0, "formActions", "redisplay" ); DoButton( "preview", "Preview Resolve" ); DoButton( "resolve", "Resolve" ); EndButtons(); // // End the pane. EndForm(); DoComment( "END RESOLVE PANE" ); } void p4wResolvePane::GetAction( StrBuf & actionURL ) { // // Constructs url used for the form ACTION value ConstructAction( AC_RESOLVEPROCESSOR, NULL, 1, actionURL ); } void p4wResolvePane::HandleError( Error *err ) { // // Override this because we want to ignore most fstat errors when invoked // from the path browser. If this was invoked from the file browser, output // the error and set the File variable in case user submits the form anyway. if( !fIsFileBrowser ) { DoHandleError( err, 1 ); } else { DoHandleError( err, 0 ); fGotOneFile = 1; DoHidden( 1, "File", fRequest.GetPath().Text() ); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 12234 | Matt Attaway |
Rejigger P4Web project in preparation for official sunsetting The bin directory contains the last official builds of P4Web from the Perforce download site. P4Web is soon to be completely sunsetted; these builds are here for folks who don't want to build their own. To better handle the archived builds the source code has been moved into a separate src directory. |
||
//guest/perforce_software/p4web/Panes/p4wResolvePane.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |