O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Bazaar Version Control

Book Description

Primarily written for those who are new to version control systems, this easy-to-follow guide to Bazaar will quickly make you an expert. From basic principles to creating plugins – it’s all here.

  • Gain an understanding of what version control is, and how you can benefit and effectively use it to collaborate with other people
  • Place any project under version control and track the history of changes easily
  • Understand all the core operations and the most common workflows through practical examples and clear explanations
  • Learn advanced workflows through a step-by-step approach covering increasingly complex topics and situations of collaboration

In Detail

Bazaar is a version control system that enables you to track your changes, browse the history of revisions, or revert to a previous state with ease. You can benefit greatly from the principles and practical uses of version control with Bazaar in any software project.

This book will walk you through the principles and basic and advanced operations of version control, taking a step-by-step approach covering increasingly complex topics and situations of collaboration. Packed with examples, the book aims to give you a thorough understanding of the subject in order to get you fully comfortable using this powerful, highly intuitive and consistent tool in any project and workflow thrown at you.

The book starts by introducing the fundamentals of version control to first-time users. After explaining the basic principles, we dive into action covering the various operations and workflows of version control using Bazaar. Topics are covered in increasing order of complexity from solo mode, peer-to-peer, centralized-style, and ultimately distributed-style. The book also covers advanced subjects such as integration with collaborative environments and other version control systems, as well as using Bazaar programmatically and creating plugins. This book will help you gain solid knowledge about version control and enable you to use Bazaar effectively in your projects.

Table of Contents

  1. Bazaar Version Control
    1. Table of Contents
    2. Bazaar Version Control
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
      7. Downloading the example code
      8. Errata
      9. Piracy
      10. Questions
    8. 1. Getting Started
      1. Version control systems
        1. Reverting a project to a previous state
        2. Viewing the log of changes
        3. Viewing the differences between revisions
        4. Branching and merging
        5. Acronyms related to version control
      2. Centralized version control systems (CVCS)
      3. Distributed version control systems (DVCS)
      4. What is Bazaar?
      5. Installing Bazaar and its plugins
        1. GNU/Linux
          1. Ubuntu, Debian, and derivatives
          2. Red Hat, Fedora, CentOS, and derivatives
          3. openSUSE and derivatives
          4. Installing Bazaar using pip
          5. Other installation methods
        2. Windows
        3. Mac OS X
        4. Bazaar in a shared hosting environment
      6. Interacting with Bazaar
        1. Using the command-line interface
        2. Using the graphical user interface
        3. Using the two user interfaces together
      7. Upgrading Bazaar to the latest version
      8. Uninstalling Bazaar
      9. Getting help
      10. Summary
    9. 2. Diving into Bazaar
      1. Understanding the core concepts
        1. Revision
        2. Repository
        3. Branch
        4. Working tree
        5. Putting the concepts together
        6. Storing Bazaar's data in the filesystem
      2. Introducing the user interfaces
        1. Using the command-line interface (CLI)
        2. Using Bazaar Explorer
      3. Configuring Bazaar
        1. Configuring the author information
        2. Configuring the default editor
        3. Other configuration options
      4. Performing the basic version control operations
        1. Putting a directory under version control
          1. Using the command line
          2. Using Bazaar Explorer
        2. Checking the status of files and directories
          1. Using the command line
          2. Using Bazaar Explorer
        3. Adding files to version control
          1. Using the command line
          2. Using Bazaar Explorer
        4. Recording a new revision
          1. Using the command line
          2. Using Bazaar Explorer
        5. Ignoring files
          1. Using the command line
          2. Using Bazaar Explorer
          3. Checkpoint
        6. Deleting files
          1. Using the command line
          2. Using Bazaar Explorer
        7. Undoing changes
          1. Using the command line
          2. Using Bazaar Explorer
        8. Editing files
          1. Using the command line
          2. Using Bazaar Explorer
        9. Viewing differences in changed files
          1. Using the command line
          2. Using Bazaar Explorer
          3. Checkpoint
        10. Renaming or moving files
          1. Using the command line
          2. Using Bazaar Explorer
          3. Checkpoint
        11. Viewing the revision history
          1. Using the command line
          2. Using Bazaar Explorer
        12. Restoring files from a past revision
          1. Using the command line
          2. Using Bazaar Explorer
        13. Putting it all together
          1. Making different kinds of changes
            1. Understanding the output the revert command
            2. Understanding the output of the status command
          2. Understanding the backup files created by Bazaar
          3. Understanding the .bzr directory
          4. How often to commit?
      5. Beyond the basics
        1. Mastering the command line
          1. Common flags
          2. Common behavior in all the commands
          3. Using shorter aliases of commands
          4. Quick reference card
        2. Using tags
        3. Specifying revisions
          1. Specifying a single revision
          2. Specifying a range of revisions
        4. Viewing differences between any two revisions
          1. Viewing differences between any revision and the working tree
          2. Viewing differences between any two revisions
          3. Viewing differences going from one revision to the next
        5. Cloning your project
      6. Summary
    10. 3. Using Branches
      1. What is a branch?
        1. A single branch with a linear history
        2. Multiple diverged branches
        3. Branches with non-linear history
        4. Unrelated branches
      2. What can you do with branches?
        1. Creating branches
        2. Comparing branches
        3. Merging branches
        4. Mirroring branches
      3. Why use more than one branch?
        1. Separating the development of new features
        2. Switching between tasks
        3. Experimenting with different approaches
        4. Maintaining multiple versions
      4. Understanding core terms and concepts
        1. trunk, master, and mainline
        2. The tip of a branch
        3. Source and target branches
        4. Parent branch
        5. Diverged branches and the base revision
        6. Storing branch data
      5. Using a shared repository
        1. Using the command line
        2. Using Bazaar Explorer
      6. Basic branching and merging
        1. Getting the example project
          1. Using the command line
          2. Using Bazaar Explorer
        2. Creating a feature branch
          1. Using the command line
          2. Using Bazaar Explorer
        3. Working on a branch
        4. Starting another branch
        5. Merging the bugfix branch
          1. Using the command line
          2. Using Bazaar Explorer
        6. Viewing merged revisions in the log
          1. Using the command line
          2. Using Bazaar Explorer
      7. Using the branch command
        1. Creating branches based on an older revision
          1. Using the command line
          2. Using Bazaar Explorer
      8. Viewing basic branch information
      9. Comparing branches
        1. Using the command line
          1. Viewing missing revisions between branches
          2. Viewing the differences between branches
        2. Using Bazaar Explorer
          1. Viewing the tree of branches
          2. Viewing missing revisions between branches
          3. Viewing the differences between branches
      10. Merging branches
        1. Performing a three-way merge
        2. Completing the merge
          1. Committing the merge
          2. Aborting the merge
        3. Resolving conflicts
          1. Resolving text conflicts
          2. Resolving content conflicts
          3. Redoing the merge
          4. Resolving other types of conflicts
        4. Merging a subset of revisions
          1. Merging up to a specific revision
          2. Merging a range of revisions
          3. Cherry-picking
        5. Understanding revision numbers
        6. Merging from multiple branches
      11. Mirroring branches
        1. Mirroring from another branch
        2. Mirroring from the current branch
      12. Summary
    11. 4. Using Bazaar in a Small Team
      1. Collaborating with others
        1. Working with remote branches
        2. Implementing simple workflows
      2. Sharing branches over the network
        1. Specifying remote branches
          1. Using URL parameters
          2. Using remote branches through a proxy
        2. Sharing branches using a distributed filesystem
        3. Sharing branches over SSH
          1. Using individual SSH accounts
          2. Using individual SSH accounts with SFTP
          3. Using a shared restricted SSH account
          4. Using SSH host aliases
          5. Using a different SSH client
        4. Sharing branches using bzr serve
        5. Sharing branches using inetd
        6. Sharing branches over HTTP or HTTPS
      3. Working with remote branches
        1. Working with remote branches directly
        2. Using local mirror branches
          1. Creating a local mirror
          2. Using a shared repository
          3. Updating a local mirror
        3. Using remote mirror branches
          1. Creating a remote mirror
          2. Using a shared repository
          3. Updating a remote mirror
        4. Using branches without a working tree
          1. Creating a local branch without a working tree
          2. Creating or removing the working tree
          3. Reconfiguring working trees in a shared repository
          4. Creating remote branches without a working tree
        5. Slicing and dicing branches
      4. Implementing simple workflows
        1. Using independent personal branches
          1. Merging from branches repeatedly
          2. Handling criss-cross merges
          3. Viewing the history from different perspectives
        2. Using feature branches and a common trunk
          1. Merging into a common remote trunk
          2. Merging feature branches in lock-step
          3. Doing "code reviews"
      5. Summary
    12. 5. Working with Bazaar in Centralized Mode
      1. The centralized mode
        1. Core operations
        2. The centralized workflow
          1. Checkout from the central branch
          2. Making changes
          3. Committing changes
          4. Updating from the server
          5. Handling conflicts during update
        3. Advantages
          1. Easy to understand
          2. Easy to synchronize efforts
          3. Widely used
        4. Disadvantages
          1. Single point of failure
          2. Administrative overhead of access control
          3. The update operation is not safe
          4. Unrelated changes interleaved in the revision history
      2. Using Bazaar in centralized mode
        1. Bound branches
        2. Creating a checkout
          1. Using the command line
          2. Using Bazaar Explorer
        3. Updating a checkout
          1. Using the command line
          2. Using Bazaar Explorer
          3. Visiting an older revision
        4. Committing a new revision
        5. Practical tips when working in centralized mode
      3. Working with bound branches
        1. Unbinding from the master branch
        2. Binding to a branch
        3. Using local commits
      4. Working with multiple branches
      5. Setting up a central server
        1. Using an SSH server
          1. Using the smart server over SSH
          2. Using individual SSH accounts
          3. Using a shared restricted SSH account
          4. Using SFTP
        2. Using bzr serve directly
        3. Using bzr serve over inetd
      6. Creating branches on the central server
        1. Creating a shared repository without working trees
        2. Reconfiguring a shared repository to not use working trees
        3. Removing an existing working tree
        4. Creating branches on the server without a working tree
      7. Practical use cases
        1. Working on branches using multiple computers
        2. Synchronizing backup branches
      8. Summary
    13. 6. Working with Bazaar in Distributed Mode
      1. The distributed mode in general
        1. Collaborators work independently
        2. The mainline branch is just a convention
        3. Collaborators write only to their own branches
        4. The distributed mode gives great flexibility
        5. Encouraging feature branches
        6. The revision history depends on the perspective
      2. The human gatekeeper workflow
        1. Overview
        2. Setting guidelines to accept merge proposals
        3. The role of the gatekeeper
        4. Creating a merge proposal
          1. Using a Bazaar hosting site
          2. Sharing the branch URL with the gatekeeper
          3. Sending a merge directive
            1. Creating a merge directive
            2. Merging from a merge directive
            3. Merge directives without revision content
        5. Rejecting a merge proposal
        6. Accepting a merge proposal
        7. Reusing a branch
        8. Commander/Lieutenant model
        9. Switching from the peer-to-peer workflow
      3. The automatic gatekeeper workflow
        1. Patch Queue Manager (PQM)
        2. Revision history graph
      4. The shared mainline workflow
        1. Updating the mainline using push operations
          1. Updating the mainline using a new local mirror
          2. Re-using an existing local mirror
        2. Updating the mainline using a bound branch
          1. Updating the mainline using a new checkout
          2. Reusing an existing checkout
      5. Choosing a distributed workflow
      6. Summary
    14. 7. Integrating Bazaar in CDE
      1. What is a CDE?
      2. Working with Launchpad
        1. Creating a Launchpad account
          1. Creating an account
            1. Configuring your Launchpad account
            2. Configuring SSH public keys
          2. Associating bzr with Launchpad
          3. Testing your setup
        2. Hosting personal branches
          1. Uploading personal branches
          2. Using personal branches
          3. Deleting branches
        3. Hosting a project
          1. Using the Sandbox site
          2. Creating a project
          3. Uploading project branches
          4. Viewing project branches
          5. Viewing your own branches
          6. Setting a focus branch
          7. Using series
          8. Viewing and editing branch details
        4. Using merge proposals
          1. Creating a merge proposal
          2. Viewing and editing a merge proposal
          3. Approving / rejecting a merge proposal
          4. Using the e-mail interface to handle a merge proposal
        5. Browsing the content of a branch
        6. Using the bug tracking system
          1. Reporting bugs
          2. Linking commits to bugs
        7. Useful tips when using Launchpad
          1. Deleting or renaming a project
          2. The karma system
          3. Hosting private projects
      3. Integrating Bazaar into Redmine
      4. Integrating Bazaar into Trac
        1. Enabling the plugin globally
        2. Enabling the plugin for one project only
        3. Browsing Bazaar branches
        4. Getting help
      5. Linking commits to bug trackers
        1. Configuring bug trackers in Bazaar
        2. Linking to public bug trackers
        3. Linking to Launchpad
        4. Linking to Bugzilla
        5. Linking to Trac
        6. Linking to other bug trackers
        7. Advanced integration with bug trackers
      6. Web-based repository browsing with Loggerhead
        1. Installing Loggerhead
        2. Running Loggerhead locally
        3. Running Loggerhead in production
      7. Summary
    15. 8. Using the Advanced Features of Bazaar
      1. Using aliases
      2. Undoing commits
      3. Shelving changes
        1. Putting changes "on a shelf"
        2. Listing and viewing shelved changes
        3. Restoring shelved changes
        4. Using shelves to revert partial changes in a file
        5. Using shelves to commit partial changes in a file
      4. Using lightweight checkouts
        1. Creating a lightweight checkout
        2. Converting a checkout to a lightweight checkout
        3. Converting a branch to a lightweight checkout
        4. Converting from a lightweight checkout
      5. Re-using a working tree
        1. Setting up the example
        2. Preparing to switch branches
        3. Switching to another branch using core commands
        4. Switching to another branch by using switch
        5. Using a lightweight checkout for switching branches
      6. Using stacked branches
      7. Signing revisions using GnuPG
        1. Configuring the signing key used by Bazaar
        2. Setting up a sample repository
        3. Verifying signatures
        4. Signing existing revisions
        5. Signing a range of commits
        6. Signing new commits automatically
      8. Configuring a hook to send an e-mail on commit
        1. Setting up the example
        2. Installing the email plugin
        3. Enabling commit emails
        4. Testing the configuration
        5. Customizing the plugin
      9. Summary
    16. 9. Using Bazaar Together with Other VCS
      1. Working with other VCS in general
        1. Working with foreign branches
        2. Installing plugins
          1. Installing plugins in Windows or Mac OS X
          2. Installing plugins in Linux
          3. Installing plugins using Pip
          4. Installing additional requirements
        3. Understanding the protocol overhead
        4. Using shared repositories
        5. Limitations
        6. Issues and crashes
      2. Using Bazaar with Subversion
        1. Installing bzr-svn
        2. Supported protocols and URL schemes
        3. Using the example Subversion repository
        4. Understanding branches in Subversion
        5. Branching or checkout from Subversion
        6. Preserving Subversion metadata
          1. Preserving original revision numbers
          2. Preserving versioned properties
          3. Preserving revision and file IDs
        7. Pulling or updating from Subversion
        8. Committing to Subversion
        9. Pushing to Subversion
        10. Merging Subversion branches
        11. Merging local branches into Subversion
        12. Binding and unbinding to Subversion locations
        13. Using lightweight checkouts
        14. Browsing the logs
        15. Limitations of bzr-svn
        16. Final remarks on bzr-svn
      3. Using Bazaar with Git
        1. Installing bzr-git
        2. Supported protocols and URL schemes
        3. Using the example Git repository
        4. Branching from git
        5. Preserving version control metadata
          1. Preserving Git revision ids
          2. Preserving merged branches and revisions
        6. Pulling from Git
        7. Pushing to Git
        8. Merging Git branches
        9. Merging local branches into Git
        10. Limitations of bzr-git
        11. Final remarks on bzr-git
      4. Migrating between version control systems
        1. Installing bzr-fastimport
        2. Exporting version control data
          1. Exporting Subversion data
          2. Exporting Git data
          3. Exporting Bazaar data
          4. Exporting other VCS data
        3. Importing version control data
        4. Querying fast-import files
        5. Filtering fast-import
      5. Summary
    17. 10. Programming Bazaar
      1. Using Bazaar programmatically
        1. Using bzrlib outside of bzr
        2. Accessing Bazaar objects
          1. Accessing branch data
          2. Accessing branch configuration values
          3. Accessing revision history
          4. Accessing the contents of a revision
          5. Formatting revision info using a log format
          6. More examples
        3. Locating BZRLIB
      2. Creating a plugin
        1. Using the example plugins
          1. Using the summary plugin
          2. Using the customlog plugin
          3. Using the appendlog plugin
        2. Naming the plugin
        3. Creating the plugin directory
        4. Implementing the plugin
        5. Writing the README file
        6. Creating __init__.py
          1. Setting help and documentation texts
          2. Declaring the API version
          3. Declaring the plugin version
          4. Verifying the loaded module name
          5. Registering new functionality
            1. Registering a new command
            2. Registering a new log format
            3. Registering a hook
            4. Registering other kinds of functionalities
          6. Registering a test suite
          7. Performance considerations
        7. Writing unit tests
        8. Creating setup.py
        9. Browsing existing plugins
        10. Registering your plugin
      3. Creating a hook
        1. Hook points, hook classes, and hook types
        2. Registering hooks
        3. Activating hooks
      4. References
      5. Summary
    18. Index