250 likes | 381 Views
PWB515 - Intro to Source Code Control in PB9. Paul A. Horan [TeamSybase] Sr. Architect - Video Communications, Inc. paulh@vcisolutions.com / (413) 272-7200 August 7, 2003. Mike Cobb PB Development Manager - Sybase. Michael.Cobb@sybase.com. Session Agenda. Audience Poll
E N D
PWB515 - Intro to Source Code Control in PB9 Paul A. Horan [TeamSybase]Sr. Architect - Video Communications, Inc.paulh@vcisolutions.com / (413) 272-7200August 7, 2003 Mike CobbPB Development Manager - Sybase.Michael.Cobb@sybase.com
Session Agenda • Audience Poll • Source Code Control Basics • Features and Requirements • How do they work? • How do they work for PowerBuilder developers? • Getting Started • Planning for a Successful Migration to PowerBuilder 9 • PB9 SCC Operations • New Workspace Properties dialog and System Tree status icons • New SCC Artifacts - .PBG, .PBC, .PRP files • Add/Remove/Checkout/Check in/Get Latest Version • Advanced Topics (time permitting) • OrcaScript • Using Work PBLs in PowerBuilder 9 • Branching and Merging
Audience Polling Who’s Using What? • Current Version of PowerBuilder in Use? • PB7 or earlier? • PB8.0.2 or earlier? • PB8.0.3? • PB9? • Source Code Control Providers? • PBNative • Merant - PVCS Version Manager • Microsoft – Visual SourceSafe • Borland – StarTeam • Rational – ClearCase • MKS – Source Integrity • Perforce • Open Source – CVS/Jalindi Igloo • Other?
Source Code Control Basics Features and Functions • Provide a Secure Repository for Digital Assets • Prevent Concurrent Editing of Object Source • Support Concurrent Editing of Object Source (what??) • Implement Revision/Version Tracking • “Time Travel” – easily recover to a previous configuration • Seamless integration with Development Tools • Optional Add-on Features: • Visual Difference/Merge Tools • Integrated Defect Tracking • Integrated Requirements Management • Integrated Change Management (Impact Assessment) • Dozens of Vendors – Choose a Tool based on your Needs! • http://www.cmcrossroads.com – Configuration Management portal
Source Code Control Basics How do they work? • Source files are registered into a repository on a network-based resource. • A user “checks out” a copy of a file to his local workspace. • A lock is placed on that file to prevent concurrent access. • The most recent version is copied to the user’s “working folder”. • The user edits the file locally. • The user “checks in” the revised file • A new “tip” revision is created. • The lock on the file is released. • Other users “get” this revision of the file to stay in sync. • Specific configurations can be “labeled” (at Build time, for example) for reference at a later time.
Build Label – “EBF 4038” Revision Label – “CR1234” Source Code Control Basics An example of basic Source Control operations File A File B File C File D File E File F
Source Code Control Basics What are the challenges facing PowerBuilder developers? THOSE DARN PBLS!!! • PB objects are NOT stored as ASCII text files. • Versioning the PBL itself is not practical. • SCC packages can’t “see” inside the PBLs to control at the object level. • Philosophical issues - too many PB developers view the PBL as the “repository”. WHAT WAS THE SOLUTION?? • Export and Archive the source files for all PB objects. • Use the Microsoft SCC API to integrate PB and any SCC tool.
C: \myWork.pbl SCC Repository w_main.srw \Main.pbl w_main T: \Main.pbl w_main C: \myWork.pbl \Main.pbl w_main Source Code Control Basics Architectural Differences between PB7.x and 8.0 • PB7 and earlier • Registered PBLs out on the network • SCC repository for archived source • SCC “metadata” stored in the PBL • Objects checked out “from” the registered PBL “to” the “work” PBL • Write locks on network PBLs resulted in file I/O errors during check in/out • Separate process to sync machines • Typical SCC Operation • w_main registered from T: drive • User A checks out from T: to C: • w_main is locked in SCC and PBL • User B sees checkout status chg • User A checks back into T: • w_main deleted from myWork.pbl • Both User A and B must now sync to T: User A User B
Source Code Control Basics Architectural Differences between PB7.x and 8.0 • PB8.0 & PB9 changes • No more “registered” PBLs on the LAN • Each developer has their own local copy • SCC “metadata” stored in the PBL • Objects checked out “in place” • “Work” PBL concept is not supported • Sync process (GLV) is a native operation • Typical SCC Operation • w_main registered to SCC repository • User A checks out w_main • User B sees status chg on next refresh • User A checks changes back into SCC • User B sees status chg to “out of sync” • User B performs a GLV to resynch User A C:\ Local Root folder SCC Repository w_main.srw \Main.pbl w_main User B D:\: \Main.pbl w_main
Getting Started with SCC in PB9 Planning for a Successful Migration • Re-evaluate your Folder Structures • Place fewer PBLs in each File System folder • All PBLs within a Workspace must exist on the same Drive letter. • Keep the Local Root Folder at the “top” of the folder hierarchy • Common or Shared PBLs – use at your own risk… • Workspaces and Targets • Workspace has a 1:1 relationship to SCC Project • One SCC Project can be accessed by many Workspaces • Workspace / Target configurations: • A single Workspace with multiple Targets? • One Target per Workspace? • Place Targets under Source Control or not? • Remember, Library Lists are now a property of the Target • Dedicate a single machine to the Build process • Write scheduled batch scripts to keep that machine synchronized
SCC Operations in PowerBuilder 9.0 Workspace Properties dialog • Source Control System • Lists all installed SCC Providers • User ID • Some SCC tools have authentication • Project • PBNative: Location of Project folder • 3rd-party: Provider-specific identifier • Local Root Directory • Where the .PBW lives • Can’t be changed… • Connect button • Enabled whenever anything changes • Re-establishes connection to Provider • Advanced… • Opens Provider’s Advanced dialog
SCC Operations in PowerBuilder 9.0 Workspace Properties dialog (cont.) • SCC Operation Logging • Checkbox enables/disables logging • File Name - Location of SCC log file • Append/Overwrite to file • Require comments on checkin • Use this instead of Provider’s option • This Project … work offline • Shows Connect prompt on startup • Delete PB-generated files • Cleans up exported .sr* files • Can slow down SCC operations • Perform diff on status update • Detects “out of sync” conditions • Suppress prompts… • Provider will often set files to readonly • Status Refresh Rate • Determines “freshness” tolerance
SCC Operations in PowerBuilder 9 New Library Painter/System Tree Icons + Green Plus sign • Object is NOT registered to SCC ● Green Solid Dot • Object is registered and available √ Green Checkmark • Object is checked out to me xRed X • Object is checked out to someone else Green Circular Arrow • Local copy of object is out of sync ? Light Blue Question mark • Sync status cannot be determined, because a “Diff” was not performed • Multiple Icons at Once??
SCC Operations in PowerBuilder 9 New File Types to support SCC Operation • .PBG Files • Stores Object-PBL relationship • One per PBL • Maintained Automatically by PB • Object Registration • PB checks out the PBG file • Adds entry for new object • Checks back in and increments the revision number. • Other Users performing a GLV will see new objects listed • Troubleshooting GLV • New Objects not showing up? • Look at .PBG file in SCC repository • Look at .PBG file on user’s machine • Force a checkin if necessary
SCC Operations in PowerBuilder 9 New File Types to support SCC Operation • .PBC Files • Off-line Status Cache • One per Workspace • Workspace context menu option • Workspace Initialization • PB loads initial status from .PBC file • As PBLs get expanded, invokes the async Refresh Status thread • Writes back to .PBC file upon workspace shutdown, or on demand • Working “OffLine” • Checkout objects while connected • Disconnect from SCC and detach • Can now edit objects, but can’t check in or out additional objects
SCC Operations in PowerBuilder 9 New File Types to support SCC Operation • .PRP Files • PBNative’s Locking/Sync mechanism • One per Registered Object • Naming convention is: classname.sr*.prp • Shows checkout status and user • Maintains current object version and last checkin date/time • This is your PBNative Repository: DO NOT TOUCH THESE FILES!!!
SCC Operations in PowerBuilder 9 Add to/Remove from Source Control… • For registering new objects • Available at the Workspace, Target, PBL, and Object level • Only shows the objects that are unregistered. • Exports the code for the objects, and adds them to the SCC provider • Updates any affected .PBG files • Other users will get these objects with their next Get Latest Version • Advanced Button • When supported, opens the SCC Provider’s Advanced “PUT” dialog. • Remove from Source Control… • Just the opposite of Add… • DELETES the object’s archive!
SCC Operations in PowerBuilder 9 Check Out/Check In/Undo Checkout… • Check Out • Gets and Imports the “tip” revision for each object selected • Locks the object(s) in repository • Check In • Exports revised source code and checks in that revised file • Unlocks the object(s) in repository • If “Require Comments…” is on, you get prompted to supply a comment • Undo Checkout • Gets and Imports the “tip” revision for each object selected • Unlocks the object(s) in repository • Available at any Tree level • Advanced… button • Provider-specific dialogs
SCC Operations in PowerBuilder 9 Get Latest Version… • Synchronization of Local Code • Gets and Imports the “tip” revisions for all objects that are considered “out of sync”. • GLV dialog shows ALL objects, but only “out of sync” objects are checked • TIP: Do NOT use the Select All button • You will be prompted to overwrite or ignore checked out objects • Available at any Tree level • Avoid large groups of objects at once • GLV of ancestor classes first • Rebuild will most likely be required • Advanced… button • Provider-specific dialogs • Get SPECIFIC Version
Advanced SCC Topics OrcaScript • Command-line processor for SCC operations • Write batch scripts and have them execute unattended • ORCASCR9.EXE <command_file.dat> • Simple Command structure • Compile and Deploy PB Targets • Refresh Local Source Code from SCC Repository • Incremental Refresh – Get Latest Version • Full Refresh – “Bootstrap Import” • Ignore or Overwrite Checked-out objects • Recreate Previous Code Configurations • Use your SCC package to “push” source code files into Local Root folders • Use OrcaScript to rebuild PBLs based on that specific configuration
Advanced SCC Topics Using a “Work” PBL • In PB8/9, objects are checked out “in place” • In PB5/6/7, a Work PBL was required! • In PB8 & 9, this is no longer supported. • It is possible to use a Work PBL, but it must be managed manually • Steps for creating and using a Work PBL • Create the work PBL in a separate folder under the Local Root • Place this PBL at the top of the Library List for the Target • Check objects out in their Home PBL (in place) • COPY the checked out object into the Work PBL (it should appear unregistered) • Edit and Debug the object in the Work PBL • When ready, MOVE the object back into its Home PBL • Check in the object from there
Advanced SCC Topics Concurrent Development - Branching and Merging • SCC Provider MUST support Branching • Typical Scenario: • Long-running Development Project is in progress • CRITICAL bug discovered in released Production codeline • The object that needs to be repaired is already checked out • Solution: Branching • Determine the configuration that will be the “branch point”. • Configure an SCC Project based on that code configuration, and set it to Branch whenever a revised object is checked in. • Create a second Workspace, and build the PBLs with that code configuration • Point the Workspace SCC properties to the “branch” SCC Project • Edit/Debug/Checkin code changes – these will create new tip revisions, but on the Branch, not the main Codeline (“the trunk”) • Use a Visual Diff/Merge tool to help in merging the changes back into the Trunk • Branching is HARD. Let the tools do their jobs.
Main Codeline Branch Merge SCC Released EBF Build 452.01 Advanced SCC Topics Branching and Merging – A Visual Example Build Labels: 452 480 525 559 Promotion States: Prod QA Beta Alpha EBF Codeline
Additional Resources • Newsgroups • sybase.public.powerbuilder.source_control • Sybase Developer Network • http://www.sybase.com/developer • Sybase CodeXchange • http://www.codexchange.sybase.com • Sample OrcaScript command files • New PB9 Books!! • Available here at TechWave – or on Amazon • Configuration Management portal • www.CMCrossroads.com
Questions and Comments Paul Horan [TeamSybase] Video Communications, Inc. Springfield, Mass paulh@VCISolutions.com Mike Cobb Sybase, Inc. Concord, Mass Michael.Cobb@sybase.com