// // Copyright 2000 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wIntegPane: // Construct a form used to send an integrate command #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wHtml.h" #include "p4wIntegPane.h" p4wIntegPane::p4wIntegPane( p4wView & ParentView, p4wRequest & Request, int isFileBrowser, int branch ) : p4wRunPane( ParentView, Request ), fIsFileBrowser(isFileBrowser) { if( branch ) fIntegType = fromBranch; else if( isFileBrowser ) fIntegType = fromFile; else fIntegType = fromPath; } p4wIntegPane::~p4wIntegPane() { } // ------------------------------------- // Render functions. // void p4wIntegPane::Begin() { // // Fetch and build the ACTION value. StrBuf actionURL; GetAction( actionURL ); // // Begin the pane. DoComment( "BEGIN INTEG PANE" ); if( fRequest.GetCmd() == AC_INTEGRATEBRANCH ) BeginForm( "Integrate Using Branch:", actionURL ); else BeginForm( "Integrate:", actionURL ); // // Target (or source if reverse) path, file or branch p4wHtml htm(1); htm.beginTRow(); htm.beginCol(); htm.dListTag(); if( fIntegType == fromFile ) { htm.text( "Current file:" ); htm.dListVal(); htm.textField( "Path1", p4wStrBuf().EscapeHTML( fRequest.GetPath(), Unicode() ).Text(), 80 ); } else if(fIntegType == fromPath ) { htm.text( "Current path:" ); htm.dListVal(); htm.textField( "Path1", p4wStrBuf().EscapeHTML( fRequest.GetPath(), Unicode() ).Text(), 80 ); } else { const StrPtr *bv = fRequest.GetDynArg( "bv" ); htm.text( "Branch spec to use:" ); htm.dListVal(); if( bv ) htm.textField( "Branch", p4wStrBuf().EscapeHTML( *bv, Unicode() ).Text(), 40 ); else htm.textField( "Branch", NULL, 40 ); } // // Direction of integration & path htm.paragraph(); htm.dListTag(); if( fIntegType == fromFile ) { htm.text( " Direction to integrate changes:" ); htm.dListVal(); htm.radio( "DestDir", "to", 1 ); htm.label( "To", "to", "u" ); htm.label( " current file", "to" ); htm.dListVal(); htm.radio( "DestDir", "from" ); htm.label( "From", "from", "u" ); htm.label( " current file", "from" ); htm.paragraph(); htm.dListTag(); htm.radio( "Use", "p", 1 ); htm.label( "Integrate with this file:", "p" ); htm.dListVal(); htm.textField( "Path2", NULL, 80, 0, "setCheckedValue(document.forms['Run'].elements['Use'], 'p')" ); } else if( fIntegType == fromPath ) { htm.text( " Direction to integrate changes:" ); htm.dListVal(); htm.radio( "DestDir", "to", 1 ); htm.label( "To", "to", "u" ); htm.label( " files in current path", "to" ); htm.dListVal(); htm.radio( "DestDir", "from" ); htm.label( "From", "from", "u" ); htm.label( " files in current path", "from" ); htm.paragraph(); htm.dListTag(); htm.radio( "Use", "p", 1 ); htm.label( "Use corresponding path:", "p" ); htm.dListVal(); htm.textField( "Path2", NULL, 80, 0, "setCheckedValue(document.forms['Run'].elements['Use'], 'p')" ); } else { htm.radio( "Use", "b", 1 ); htm.label( "Integrate ", "b" ); htm.label( "all", "b", "u" ); htm.label( " files in branch spec in", "b" ); htm.radio( "Dir", "forward", 1 ); htm.label( "forward", "forward" ); htm.radio( "Dir", "reverse" ); htm.label( "reverse direction of mapping", "reverse" ); } htm.paragraph(); htm.dListTag(); htm.hline( NULL, NULL ); // // Option to use branch view if invoked on path, or path if invoked from // menu or branch view htm.paragraph(); htm.dListTag(); htm.text( "Advanced Options", "b" ); htm.paragraph(); // // Construct url to go to Branches StrBuf np; StrBuf bURL; p4wURL urlMaker; fRequest.UseNewBase( np, NULL, "path", "/" ); urlMaker.ConstructURL( bURL, np.Text(), AC_BRANCHES, NULL ); if( fIntegType == fromFile ) { htm.dListTag(); htm.radio( "Use", "b" ); htm.label( "Use branch spec: ", "b" ); htm.textField( "Branch", NULL, 40, 0, "setCheckedValue(document.forms['Run'].elements['Use'], 'b')" ); htm.text(" "); htm.beginSpan(0, "font-weight: normal"); htm.beginLink( bURL.Text() ); htm.text( "View available branch specs" ); htm.endLink(); htm.endSpan(); } else if( fIntegType == fromPath ) { htm.dListTag(); htm.radio( "Use", "b" ); htm.label( "Use branch spec: ", "b" ); htm.textField( "Branch", NULL, 40, 0, "setCheckedValue(document.forms['Run'].elements['Use'], 'b')" ); htm.text(" "); htm.beginSpan(0, "font-weight: normal"); htm.beginLink( bURL.Text() ); htm.text( "View available branch specs" ); htm.endLink(); htm.endSpan(); htm.dListVal(); htm.radio( "In", "p", 1, 0, "Inp" ); htm.label( "Integrate files in current path", "Inp" ); htm.dListVal(); htm.radio( "In", "all", 0, 0, "Inall" ); htm.label( "Integrate ", "Inall" ); htm.label( "all", "u", "Inall" ); htm.label( " files in branch spec in", "Inall" ); htm.radio( "Dir", "forward", 1 ); htm.label( "forward", "forward" ); htm.radio( "Dir", "reverse" ); htm.label( "reverse direction of mapping", "reverse" ); } else { htm.dListTag(); htm.radio( "Use", "p" ); htm.label( "Integrate files in path:", "p" ); htm.dListVal(); htm.textField( "Path1", p4wStrBuf().EscapeHTML( fRequest.GetPath(), Unicode() ).Text(), 80, 0, "setCheckedValue(document.forms['Run'].elements['Use'], 'p')" ); htm.dListVal(); htm.radio( "DestDir", "to", 1 ); htm.label( "Integrate ", "to" ); htm.label( "to", "to", "u" ); htm.label( " files in this path", "to" ); htm.dListVal(); htm.radio( "DestDir", "from" ); htm.label( "Integrate ", "from" ); htm.label( "from", "from", "u" ); htm.label( " files in this path", "from" ); } // // Option to limit integration to revision range htm.paragraph(); htm.dListTag(); htm.text( "Limit revision range, starting with " ); htm.textField( "Rev1", NULL, 20 ); htm.text( "and ending with " ); htm.textField( "Rev2", NULL, 20 ); // // Option to limit integration to files matching pattern if( fIntegType == fromPath || fIntegType == fromBranch ) { htm.paragraph(); htm.dListTag(); htm.text( "Limit integration to files that match pattern: " ); htm.textField( "Pattern", "...", 40 ); } // // Start dropdown with changelist choices htm.paragraph(); htm.dListTag(); htm.text( "Put opened files in changelist: " ); htm.beginSelect( "Changelist" ); htm.selectOpt(); htm.text( "default" ); fRequest << htm; } void p4wIntegPane::Render( StrDict * varList ) { // // Output any pending changelists belonging to this user/client // to the Changelist dropdown menu. StrPtr *noCase = fRequest.GetProtocol( "nocase" ); StrPtr *owner = varList->GetVar( "user" ); const char * client = varList->GetVar( "client" )->Text(); int notOwner = 0; if( ( noCase && owner->CCompare( fRequest.GetUser() ) ) || ( !noCase && owner->XCompare( fRequest.GetUser() ) ) ) notOwner = 1; if( notOwner || strcmp(client, fRequest.GetClient().Text())) return; DoOption( varList->GetVar( "change" )->Text() ); } void p4wIntegPane::RenderError( char *error, int escapeHTML ) { p4wHtml htm; htm.endSelect(); fRequest << htm; RenderErrorList( error, escapeHTML ); } void p4wIntegPane::End() { p4wHtml htm; // // End the Changelist select box if( !fPrintedError ) htm.endSelect(); // // Some options require checking protocol level const StrPtr *srv = fRequest.GetProtocol( "server2" ); int proto = 0; if( srv ) proto = srv->Atoi(); // // Advanced options flags htm.paragraph(); htm.dListTag(); htm.checkbox( "fl", "-i", 0, 0, "-i" ); htm.label( "Enable baseless merges", "-i" ); htm.text( " (-i)", 0, 0, "808080" ); htm.dListTag(); htm.checkbox( "fl", "-d", 0, 0, "-d" ); htm.label( "Permit deletes/re-adds", "-d" ); htm.text( " (-d)", 0, 0, "808080" ); // // -Ds & -Dt only supported for server 2003.2+ if( proto > 16 ) { htm.dListTag(); htm.checkbox( "fl", "-Dt", 0, 0, "-Dt" ); htm.label( "Re-branch source on top of deleted targets", "-Dt" ); htm.text( " (-Dt)", 0, 0, "808080" ); htm.dListTag(); htm.checkbox( "fl", "-Ds", 0, 0, "-Ds" ); htm.label( "Delete modified targets if source is deleted", "-Ds" ); htm.text( " (-Ds)", 0, 0, "808080" ); } htm.dListTag(); htm.checkbox( "fl", "-f", 0, 0, "-f" ); htm.label( "Force reintegration if previously integrated", "-f" ); htm.text( " (-f)", 0, 0, "808080" ); htm.dListTag(); htm.checkbox( "fl", "-v", 0, 0, "-v" ); htm.label( "Don't copy newly branched files to workspace", "-v" ); htm.text( " (-v)", 0, 0, "808080" ); htm.dListTag(); htm.checkbox( "fl", "-t", 0, 0, "-t" ); htm.label( "Change target filetype to match donor", "-t" ); htm.text( " (-t)", 0, 0, "808080" ); // // The rest of the options require checking protocol level. // Integrate -h option only available for server level 13+ if( proto > 12 ) { htm.dListTag(); htm.checkbox( "fl", "-h", 0, 0, "-h" ); htm.label( "Don't sync target files to head revision", "-h" ); htm.text( " (-h)", 0, 0, "808080" ); } // // Integrate -I option only available for server level 14+. // This feature was pulled from release r02.2! /* if( proto > 14 ) { fRequest << " <DT><INPUT TYPE=checkbox NAME=fl VALUE=\"-I\">"; fRequest << "Use indirect integration history to determine base"; fRequest << crlf; } */ // // Preview & Integrate buttons at bottom htm.paragraph(); htm.dListVal(); fRequest << htm; DoHidden( 0, "formActions", "preview" ); DoHidden( 0, "formActions", "integrate" ); DoHidden( 0, "integType", fIntegType ); DoButton( "preview", "Preview Integration" ); DoButton( "integrate", "Integrate" ); // // End the pane. htm.endCol(); htm.endTRow(); EndForm(); DoComment( "END INTEGRATE PANE" ); } void p4wIntegPane::GetAction( StrBuf & actionURL ) { // // Pass along branch view arg if set so that the Goto // menu will show Branch View as the default const StrPtr *bv = fRequest.GetDynArg( "bv" ); if( bv ) { StrBufDict args; args.SetVar( "bv", bv->Text() ); ConstructAction( AC_INTEGPROCESSOR, &args, 1, actionURL ); } else { ConstructAction( AC_INTEGPROCESSOR, NULL, 1, actionURL ); } }
# | 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/p4wIntegPane.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |