Search code examples
bazaar

Bazaar -- remove ALL local changes


The bzr documentation states http://doc.bazaar.canonical.com/bzr-0.10/bzr_man.htm

bzr update: ... If you want to discard your local changes, you can just do a bzr revert instead of bzr commit after the update.


However this is not what I am getting. I have new files in my repo and all I want is to have the latest revision in my working directory and to have bzr status show anything as being changed.

Is this possible?


Solution

  • First of all, you're looking at an extremely old version of the doc. As of version 2.6 (current stable), the description of bzr update is longer, and very different:

    Description:
      This will perform a merge of the destination revision (the tip of the
      branch, or the specified revision) into the working tree, and then make
      that revision the basis revision for the working tree.
    
      You can use this to visit an older revision, or to update a working tree
      that is out of date from its branch.
    
      If there are any uncommitted changes in the tree, they will be carried
      across and remain as uncommitted changes after the update.  To discard
      these changes, use 'bzr revert'.  The uncommitted changes may conflict
      with the changes brought in by the change in basis revision.
    
      If the tree's branch is bound to a master branch, bzr will also update
      the branch from the master.
    
      You cannot update just a single file or directory, because each Bazaar
      working tree has just a single basis revision.  If you want to restore a
      file that has been removed locally, use 'bzr revert' instead of 'bzr
      update'.  If you want to restore a file to its state in a previous
      revision, use 'bzr revert' with a '-r' option, or use 'bzr cat' to write
      out the old content of that file to a new location.
    
      The 'dir' argument, if given, must be the location of the root of a
      working tree to update.  By default, the working tree that contains the
      current working directory is used.
    
    Aliases:  up
    See also: pull, status-flags, working-trees
    

    Your question is not very clear. When you're working in centralized mode, you have a working tree you created with bzr checkout, the bzr update command will bring in the new revisions that were added in the central repository.

    If your working tree was clean (bzr status showing no changes) before bzr update, then your working tree will be updated to the latest version (as it is on the central server), and your working tree will be still clean.

    If your working tree wasn't clean before bzr update, then Bazaar will try to merge the new revisions on the server into your working tree, and conflicts may happen. If the changes you had were exactly as what the new revisions changed, then you will end up with a clean working tree, which is extremely rare. Most commonly, if your working tree had changes before bzr update, it will most probably have changes after, and possibly conflicts too. The bzr status will tell you what they are. It's best to not have pending changes before running bzr update.