When Developers Build Software, They're Able to Keep Track of All The
Total Page:16
File Type:pdf, Size:1020Kb
< Day Day Up > Practical Perforce By Laura Wingerd ............................................... Publisher: O'Reilly Pub Date: November 2005 Print ISBN-10: 0-596-10185-6 Print ISBN-13: 978-0-59-610185-5 Pages: 358 Table of Contents | Index When developers build software, they're able to keep track of all the different versions and all the components they use with software configuration management (SCM) systems. One of the more popular SCM products is Perforce. Authored by Perforce's own VP of product technology, Practical Perforce is the ideal complement to the existing product manual, focusing less on the 'how" and more on the "why" and "when." The book is not only a helpful introduction to Perforce, it's an enlightening resource for those already familiar with this versatile SCM product. Whether you're a programmer, product manager, or build engineer, you stand to benefit from the many insider tips and ideas presented in this convenient guide. Practical Perforce is divided into two main parts. Part I offers a whirlwind technical tour, complete with careful descriptions of basic and advanced Perforce commands designed to give you a baseline knowledge. Part II describes the big picture-using Perforce in a collaborative software development. It outlines recommended best practices and quickly shows how to implement them with the Perforce operations introduced in Part I. Throughout the book, you'll learn how to maximize Perforce so it completes tasks like these in the most efficient manner possible: Keep track of changes as you conduct concurrent parallel work on files Log activity Generate reports on who did what when Compare, merge and branch files Store files and file configurations Restore lost bug fixes Recognizing the pitfalls and practices of an SCM system like Perforce is absolutely essential to producing good software. Now, with Practical Perforce, you have the edge you need to ensure success. < Day Day Up > < Day Day Up > Practical Perforce By Laura Wingerd ............................................... Publisher: O'Reilly Pub Date: November 2005 Print ISBN-10: 0-596-10185-6 Print ISBN-13: 978-0-59-610185-5 Pages: 358 Table of Contents | Index Preface What Is Perforce? The Perforce System in a Nutshell Why Perforce? About This Book What's Not In This Book Additional Reading Conventions Used in This Book Using Code Examples Safari® Enabled How to Contact Us Acknowledgements Chapter 1. Files in the Depot Section 1.1. The Perforce Filespec Syntax Section 1.2. Browsing Depot Files Section 1.3. File Types at a Glance Chapter 2. Working with Files Section 2.1. An Overview Section 2.2. Creating A Workspace Section 2.3. Synchronizing a Workspace Section 2.4. Local Syntax, Wildcard Expansion, and Special Characters Section 2.5. Working with Local Files Section 2.6. Working with Pending Changelists and Submitting Files Section 2.7. Removing and Restoring Files Section 2.8. Useful Recipes Chapter 3. Resolving and Merging Files Section 3.1. Resolving: When, What, and How Section 3.2. How Perforce Merges Text Files Section 3.3. Reconciling Structural Changes Section 3.4. Tips for Smoother Collaboration Section 3.5. The Arcana of Merging Chapter 4. Branching and Integration Section 4.1. The Classic Case for A Branch Section 4.2. Creating Branches Section 4.3. Integrating Changes from Branch to Branch Section 4.4. Reconciling Structural Changes Section 4.5. The Arcana of Integration Chapter 5. Labels and Jobs Section 5.1. Saving Important Configurations Section 5.2. Using Labels Section 5.3. Using Jobs Section 5.4. Jobs as Changelist Markers Chapter 6. Controlling and Automating Activity Section 6.1. Depot and File Access Section 6.2. Accessing Files in Other Domains Section 6.3. Saving and Restoring Specs Section 6.4. Change Notification and Change Monitoring Section 6.5. Scripting Tips Section 6.6. Behind-the-Scenes Version Control Chapter 7. How Software Evolves Section 7.1. The Story of Ace Engineering Section 7.2. The Mainline Model Section 7.3. Ace Engineering Revisited Section 7.4. Containerizing Chapter 8. Basic Codeline Management Section 8.1. Organizing Your Depot Section 8.2. General Care and Feeding of Codelines Section 8.3. Nightly Builds Section 8.4. Is Bug X Fixed in Codeline Y? Chapter 9. Release Codelines Section 9.1. Creating a Release Codeline Section 9.2. Working in a Release Codeline Section 9.3. Integrating Changes into the Mainline Section 9.4. Making a Release Section 9.5. Distributing Releases Section 9.6. Breaking the Rules Section 9.7. Retiring a Release Codeline Section 9.8. Task Branches and Patch Branches Chapter 10. Development Codelines Section 10.1. Creating A Development Codeline Section 10.2. Working in a Development Codeline Section 10.3. Keeping a Development Codeline Up to Date Section 10.4. Working with Third-Party Software Section 10.5. Delivering Completed Development Work Section 10.6. The Soft Codelines Chapter 11. Staging Streams and Web Content Section 11.1. Staging Web Content Section 11.2. Visual Content Development Section 11.3. Bug Fixes and Staging Streams Section 11.4. Major Web Development Appendix A. Setting Up a Perforce Test Environment Section A.1. Setup Section A.2. Connecting to Other Servers Section A.3. Getting Help Appendix B. Perforce Terminology and P4 Commands Bibliography Glossary About the Author Colophon Index < Day Day Up > < Day Day Up > Preface What Is Perforce? The Perforce System in a Nutshell Why Perforce? About This Book What's Not In This Book Additional Reading Conventions Used in This Book Using Code Examples Safari® Enabled How to Contact Us Acknowledgements < Day Day Up > < Day Day Up > What Is Perforce? If you've picked up this book simply because of its riveting title, you may be wondering what Perforce is. Perforce is a software configuration management (SCM) system. SCM systems are used by software developers to keep track of all the software they build and all the components that go into it. A good SCM system can explain the mysteries of software development and head off its disasters-mysteries like lost bug fixes, and disasters like botched file merges. In large-scale and commercial environments, good SCM is absolutely essential to producing good software. It's All Software and We're All Software Developers SCM was once concerned with files that computer programmers produced. Now it is concerned with files of all types that a business produces. Software, when viewed from the perspective of SCM, is any endeavor that calls a computer home. Documention, web content, spreadsheets, schematics, graphics, sound-it's all software. If it's stored in computer files and gets built, embedded, or packaged into a deliverable result, it's software. The term software developer may not sound like it applies to web content authors, graphic artists, test engineers, and technical writers, but for the purpose of this book, anyone whose work involves creating computer files from intellectual thought is a software developer. Perforce, like all SCM systems, keeps track of changes as people do concurrent, parallel work on files. It logs activity, reports who did what; compares, merges, and branches files; and stores files and file configurations. Some of Perforce's most salient features are: The depot Perforce stores files in a protected repository known as the depot. The depot is a centrally located, permanent archive of all file content submitted by users.[*] [*] The data format of the Perforce depot is not proprietary; it is, in fact, consistent with the RCS archive format. Because of this, there is a common misperception that Perforce is an RCS wrapper. It's not. Workspaces Perforce users work on files in workspaces, private disk areas of their own that contain copies of depot files. In this book we'll describe effective ways developers can use workspaces, and we'll also discuss how workspaces can be used to automate nightly builds, release packaging, web staging, and other software production tasks. Changelists Perforce changelists tie files changed together into single units of work. Every change to the depot can be traced to a changelist, and every changelist marks a known, reproducible state of the depot; the depot evolves as changelists are submitted. In the Perforce view of SCM, it is the changelist-not the file revision, nor the delta-that is the atomic transaction of software development. This book will discuss a variety of ways changelists can be used, including treating them as snapshots and using them to identify file dependencies. Filespecs and views The Perforce filespec syntax, and the views that use it, allow selection of files for Perforce operations. Filespecs can define not only the common file collections, like directories, but arbitrary collections of files that constitute codelines, modules, delivery streams, and other containers. They are the key to treating collections of files as versioned objects that can be inspected, rolled back, branched, labeled, compared, and merged at any version. Jobs In Perforce you can record externally defined tasks and states-bug reports, feature requests, and project milestones, for example-in objects it calls jobs. Jobs can be linked to changelists to provide a record of software changes related to tasks. Jobs are also the linchpin of any integration between Perforce and external systems, as we'll see in later chapters. Branching Perforce uses Inter-File Branching to model file variants. In the traditional version tree branching model used by most SCM systems, a file can be be branched and merged only into revisions of itself. In Perforce, any two files can have a branching relationship; branched files are peers, not offshoots, of their originals. A number of chapters in this book are dedicated to describing Perforce branching and its unexpectedly useful applications.