changeset 47377:26127236b229

convert-bazaar: use breezy package instead of old bzr one Breezy is the most recent of the two, and works on Python 3 while being compatible with the (old) Bazaar file format. This patch contains a variety of unicode <-> bytes changes, API breakage fixing, restoring failing imports and changing the executable from `bzr` to `brz`. I recommend using the debian packages for `brz` and `python3-breezy` (3.1+), because the pip package seems to be haunted by radioactive dragons. Differential Revision: https://phab.mercurial-scm.org/D10513
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 26 Apr 2021 22:59:56 +0200
parents a1e91a87a7c8
children 777c3d231913
files contrib/import-checker.py hgext/convert/bzr.py tests/hghave.py tests/test-convert-bzr-114.t tests/test-convert-bzr-directories.t tests/test-convert-bzr-ghosts.t tests/test-convert-bzr-merges.t tests/test-convert-bzr-treeroot.t tests/test-convert-bzr.t
diffstat 9 files changed, 179 insertions(+), 185 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/import-checker.py	Wed Apr 21 10:58:21 2021 +0200
+++ b/contrib/import-checker.py	Mon Apr 26 22:59:56 2021 +0200
@@ -23,7 +23,7 @@
 # Whitelist of modules that symbols can be directly imported from.
 allowsymbolimports = (
     '__future__',
-    'bzrlib',
+    'breezy',
     'hgclient',
     'mercurial',
     'mercurial.hgweb.common',
--- a/hgext/convert/bzr.py	Wed Apr 21 10:58:21 2021 +0200
+++ b/hgext/convert/bzr.py	Mon Apr 26 22:59:56 2021 +0200
@@ -5,8 +5,9 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-# This module is for handling 'bzr', that was formerly known as Bazaar-NG;
-# it cannot access 'bar' repositories, but they were never used very much
+# This module is for handling Breezy imports or `brz`, but it's also compatible
+# with Bazaar or `bzr`, that was formerly known as Bazaar-NG;
+# it cannot access `bar` repositories, but they were never used very much.
 from __future__ import absolute_import
 
 import os
@@ -19,31 +20,32 @@
 )
 from . import common
 
+
 # these do not work with demandimport, blacklist
 demandimport.IGNORES.update(
     [
-        b'bzrlib.transactions',
-        b'bzrlib.urlutils',
+        b'breezy.transactions',
+        b'breezy.urlutils',
         b'ElementPath',
     ]
 )
 
 try:
     # bazaar imports
-    import bzrlib.bzrdir
-    import bzrlib.errors
-    import bzrlib.revision
-    import bzrlib.revisionspec
+    import breezy.bzr.bzrdir
+    import breezy.errors
+    import breezy.revision
+    import breezy.revisionspec
 
-    bzrdir = bzrlib.bzrdir
-    errors = bzrlib.errors
-    revision = bzrlib.revision
-    revisionspec = bzrlib.revisionspec
+    bzrdir = breezy.bzr.bzrdir
+    errors = breezy.errors
+    revision = breezy.revision
+    revisionspec = breezy.revisionspec
     revisionspec.RevisionSpec
 except ImportError:
     pass
 
-supportedkinds = (b'file', b'symlink')
+supportedkinds = ('file', 'symlink')
 
 
 class bzr_source(common.converter_source):
@@ -58,7 +60,7 @@
             )
 
         try:
-            # access bzrlib stuff
+            # access breezy stuff
             bzrdir
         except NameError:
             raise common.NoRepo(_(b'Bazaar modules could not be loaded'))
@@ -66,7 +68,8 @@
         path = os.path.abspath(path)
         self._checkrepotype(path)
         try:
-            self.sourcerepo = bzrdir.BzrDir.open(path).open_repository()
+            bzr_dir = bzrdir.BzrDir.open(path.decode())
+            self.sourcerepo = bzr_dir.open_repository()
         except errors.NoRepositoryPresent:
             raise common.NoRepo(
                 _(b'%s does not look like a Bazaar repository') % path
@@ -78,7 +81,7 @@
         # Lightweight checkouts detection is informational but probably
         # fragile at API level. It should not terminate the conversion.
         try:
-            dir = bzrdir.BzrDir.open_containing(path)[0]
+            dir = bzrdir.BzrDir.open_containing(path.decode())[0]
             try:
                 tree = dir.open_workingtree(recommend_upgrade=False)
                 branch = tree.branch
@@ -87,8 +90,8 @@
                 branch = dir.open_branch()
             if (
                 tree is not None
-                and tree.bzrdir.root_transport.base
-                != branch.bzrdir.root_transport.base
+                and tree.controldir.root_transport.base
+                != branch.controldir.root_transport.base
             ):
                 self.ui.warn(
                     _(
@@ -127,7 +130,8 @@
             revid = None
             for branch in self._bzrbranches():
                 try:
-                    r = revisionspec.RevisionSpec.from_string(self.revs[0])
+                    revspec = self.revs[0].decode()
+                    r = revisionspec.RevisionSpec.from_string(revspec)
                     info = r.in_history(branch)
                 except errors.BzrError:
                     pass
@@ -142,24 +146,26 @@
         return heads
 
     def getfile(self, name, rev):
+        name = name.decode()
         revtree = self.sourcerepo.revision_tree(rev)
-        fileid = revtree.path2id(name.decode(self.encoding or b'utf-8'))
-        kind = None
-        if fileid is not None:
-            kind = revtree.kind(fileid)
+
+        try:
+            kind = revtree.kind(name)
+        except breezy.errors.NoSuchFile:
+            return None, None
         if kind not in supportedkinds:
             # the file is not available anymore - was deleted
             return None, None
-        mode = self._modecache[(name, rev)]
-        if kind == b'symlink':
-            target = revtree.get_symlink_target(fileid)
+        mode = self._modecache[(name.encode(), rev)]
+        if kind == 'symlink':
+            target = revtree.get_symlink_target(name)
             if target is None:
                 raise error.Abort(
                     _(b'%s.%s symlink has no target') % (name, rev)
                 )
-            return target, mode
+            return target.encode(), mode
         else:
-            sio = revtree.get_file(fileid)
+            sio = revtree.get_file(name)
             return sio.read(), mode
 
     def getchanges(self, version, full):
@@ -184,15 +190,15 @@
             parents = self._filterghosts(rev.parent_ids)
             self._parentids[version] = parents
 
-        branch = self.recode(rev.properties.get(b'branch-nick', u'default'))
-        if branch == b'trunk':
-            branch = b'default'
+        branch = rev.properties.get('branch-nick', 'default')
+        if branch == 'trunk':
+            branch = 'default'
         return common.commit(
             parents=parents,
             date=b'%d %d' % (rev.timestamp, -rev.timezone),
             author=self.recode(rev.committer),
             desc=self.recode(rev.message),
-            branch=branch,
+            branch=branch.encode('utf8'),
             rev=version,
             saverev=self._saverev,
         )
@@ -234,35 +240,32 @@
 
         # Process the entries by reverse lexicographic name order to
         # handle nested renames correctly, most specific first.
+
+        def key(c):
+            return c.path[0] or c.path[1] or ""
+
         curchanges = sorted(
             current.iter_changes(origin),
-            key=lambda c: c[1][0] or c[1][1],
+            key=key,
             reverse=True,
         )
-        for (
-            fileid,
-            paths,
-            changed_content,
-            versioned,
-            parent,
-            name,
-            kind,
-            executable,
-        ) in curchanges:
-
+        for change in curchanges:
+            paths = change.path
+            kind = change.kind
+            executable = change.executable
             if paths[0] == u'' or paths[1] == u'':
                 # ignore changes to tree root
                 continue
 
             # bazaar tracks directories, mercurial does not, so
             # we have to rename the directory contents
-            if kind[1] == b'directory':
-                if kind[0] not in (None, b'directory'):
+            if kind[1] == 'directory':
+                if kind[0] not in (None, 'directory'):
                     # Replacing 'something' with a directory, record it
                     # so it can be removed.
                     changes.append((self.recode(paths[0]), revid))
 
-                if kind[0] == b'directory' and None not in paths:
+                if kind[0] == 'directory' and None not in paths:
                     renaming = paths[0] != paths[1]
                     # neither an add nor an delete - a move
                     # rename all directory contents manually
@@ -270,9 +273,9 @@
                     # get all child-entries of the directory
                     for name, entry in inventory.iter_entries(subdir):
                         # hg does not track directory renames
-                        if entry.kind == b'directory':
+                        if entry.kind == 'directory':
                             continue
-                        frompath = self.recode(paths[0] + b'/' + name)
+                        frompath = self.recode(paths[0] + '/' + name)
                         if frompath in seen:
                             # Already handled by a more specific change entry
                             # This is important when you have:
@@ -283,14 +286,14 @@
                         seen.add(frompath)
                         if not renaming:
                             continue
-                        topath = self.recode(paths[1] + b'/' + name)
+                        topath = self.recode(paths[1] + '/' + name)
                         # register the files as changed
                         changes.append((frompath, revid))
                         changes.append((topath, revid))
                         # add to mode cache
                         mode = (
                             (entry.executable and b'x')
-                            or (entry.kind == b'symlink' and b's')
+                            or (entry.kind == 'symlink' and b's')
                             or b''
                         )
                         self._modecache[(topath, revid)] = mode
@@ -320,7 +323,7 @@
 
             # populate the mode cache
             kind, executable = [e[1] for e in (kind, executable)]
-            mode = (executable and b'x') or (kind == b'symlink' and b'l') or b''
+            mode = (executable and b'x') or (kind == 'symlink' and b'l') or b''
             self._modecache[(topath, revid)] = mode
             changes.append((topath, revid))
 
--- a/tests/hghave.py	Wed Apr 21 10:58:21 2021 +0200
+++ b/tests/hghave.py	Mon Apr 26 22:59:56 2021 +0200
@@ -168,35 +168,25 @@
     return matchoutput('baz --version 2>&1', br'baz Bazaar version')
 
 
-@check("bzr", "Canonical's Bazaar client")
+@check("bzr", "Breezy library and executable version >= 3.1")
 def has_bzr():
     if not is_not_python2:
         return False
     try:
-        import bzrlib
-        import bzrlib.bzrdir
-        import bzrlib.errors
-        import bzrlib.revision
-        import bzrlib.revisionspec
+        # Test the Breezy python lib
+        import breezy
+        import breezy.bzr.bzrdir
+        import breezy.errors
+        import breezy.revision
+        import breezy.revisionspec
 
-        bzrlib.revisionspec.RevisionSpec
-        return bzrlib.__doc__ is not None
+        breezy.revisionspec.RevisionSpec
+        if breezy.__doc__ is None or breezy.version_info[:2] < (3, 1):
+            return False
     except (AttributeError, ImportError):
         return False
-
-
-@checkvers("bzr", "Canonical's Bazaar client >= %s", (1.14,))
-def has_bzr_range(v):
-    major, minor = v.split('rc')[0].split('.')[0:2]
-    try:
-        import bzrlib
-
-        return bzrlib.__doc__ is not None and bzrlib.version_info[:2] >= (
-            int(major),
-            int(minor),
-        )
-    except ImportError:
-        return False
+    # Test the executable
+    return matchoutput('brz --version 2>&1', br'Breezy \(brz\) ')
 
 
 @check("chg", "running with chg")
--- a/tests/test-convert-bzr-114.t	Wed Apr 21 10:58:21 2021 +0200
+++ b/tests/test-convert-bzr-114.t	Mon Apr 26 22:59:56 2021 +0200
@@ -1,4 +1,4 @@
-#require bzr bzr114
+#require bzr
 
   $ . "$TESTDIR/bzr-definitions"
 
@@ -9,18 +9,18 @@
 
   $ mkdir test-replace-file-with-dir
   $ cd test-replace-file-with-dir
-  $ bzr init -q source
+  $ brz init -q source
   $ cd source
   $ echo d > d
-  $ bzr add -q d
-  $ bzr commit -q -m 'add d file'
+  $ brz add -q d
+  $ brz commit -q -m 'add d file'
   $ rm d
   $ mkdir d
-  $ bzr add -q d
-  $ bzr commit -q -m 'replace with d dir'
+  $ brz add -q d
+  $ brz commit -q -m 'replace with d dir'
   $ echo a > d/a
-  $ bzr add -q d/a
-  $ bzr commit -q -m 'add d/a'
+  $ brz add -q d/a
+  $ brz commit -q -m 'add d/a'
   $ cd ..
   $ hg convert source source-hg
   initializing destination source-hg repository
--- a/tests/test-convert-bzr-directories.t	Wed Apr 21 10:58:21 2021 +0200
+++ b/tests/test-convert-bzr-directories.t	Mon Apr 26 22:59:56 2021 +0200
@@ -9,17 +9,17 @@
 
   $ mkdir test-empty
   $ cd test-empty
-  $ bzr init -q source
+  $ brz init -q source
   $ cd source
   $ echo content > a
-  $ bzr add -q a
-  $ bzr commit -q -m 'Initial add'
+  $ brz add -q a
+  $ brz commit -q -m 'Initial add'
   $ mkdir empty
-  $ bzr add -q empty
-  $ bzr commit -q -m 'Empty directory added'
+  $ brz add -q empty
+  $ brz commit -q -m 'Empty directory added'
   $ echo content > empty/something
-  $ bzr add -q empty/something
-  $ bzr commit -q -m 'Added file into directory'
+  $ brz add -q empty/something
+  $ brz commit -q -m 'Added file into directory'
   $ cd ..
   $ hg convert source source-hg
   initializing destination source-hg repository
@@ -42,15 +42,15 @@
 
   $ mkdir test-dir-rename
   $ cd test-dir-rename
-  $ bzr init -q source
+  $ brz init -q source
   $ cd source
   $ mkdir tpyo
   $ echo content > tpyo/something
-  $ bzr add -q tpyo
-  $ bzr commit -q -m 'Added directory'
-  $ bzr mv tpyo typo
+  $ brz add -q tpyo
+  $ brz commit -q -m 'Added directory'
+  $ brz mv tpyo typo
   tpyo => typo
-  $ bzr commit -q -m 'Oops, typo'
+  $ brz commit -q -m 'Oops, typo'
   $ cd ..
   $ hg convert source source-hg
   initializing destination source-hg repository
@@ -71,16 +71,16 @@
 
   $ mkdir test-nested-dir-rename
   $ cd test-nested-dir-rename
-  $ bzr init -q source
+  $ brz init -q source
   $ cd source
   $ mkdir -p firstlevel/secondlevel/thirdlevel
   $ echo content > firstlevel/secondlevel/file
   $ echo this_needs_to_be_there_too > firstlevel/secondlevel/thirdlevel/stuff
-  $ bzr add -q firstlevel
-  $ bzr commit -q -m 'Added nested directories'
-  $ bzr mv firstlevel/secondlevel secondlevel
+  $ brz add -q firstlevel
+  $ brz commit -q -m 'Added nested directories'
+  $ brz mv firstlevel/secondlevel secondlevel
   firstlevel/secondlevel => secondlevel
-  $ bzr commit -q -m 'Moved secondlevel one level up'
+  $ brz commit -q -m 'Moved secondlevel one level up'
   $ cd ..
   $ hg convert source source-hg
   initializing destination source-hg repository
@@ -99,14 +99,14 @@
 
   $ mkdir test-dir-remove
   $ cd test-dir-remove
-  $ bzr init -q source
+  $ brz init -q source
   $ cd source
   $ mkdir src
   $ echo content > src/sourcecode
-  $ bzr add -q src
-  $ bzr commit -q -m 'Added directory'
-  $ bzr rm -q src
-  $ bzr commit -q -m 'Removed directory'
+  $ brz add -q src
+  $ brz commit -q -m 'Added directory'
+  $ brz rm -q src
+  $ brz commit -q -m 'Removed directory'
   $ cd ..
   $ hg convert source source-hg
   initializing destination source-hg repository
@@ -126,19 +126,19 @@
 
   $ mkdir test-dir-replace
   $ cd test-dir-replace
-  $ bzr init -q source
+  $ brz init -q source
   $ cd source
   $ mkdir first second
   $ echo content > first/file
   $ echo morecontent > first/dummy
   $ echo othercontent > second/something
-  $ bzr add -q first second
-  $ bzr commit -q -m 'Initial layout'
-  $ bzr mv first/file second/file
+  $ brz add -q first second
+  $ brz commit -q -m 'Initial layout'
+  $ brz mv first/file second/file
   first/file => second/file
-  $ bzr mv first third
+  $ brz mv first third
   first => third
-  $ bzr commit -q -m 'Some conflicting moves'
+  $ brz commit -q -m 'Some conflicting moves'
   $ cd ..
   $ hg convert source source-hg
   initializing destination source-hg repository
@@ -158,27 +158,27 @@
 
   $ mkdir test-divergent-renames
   $ cd test-divergent-renames
-  $ bzr init -q source
+  $ brz init -q source
   $ cd source
   $ mkdir -p a/c
   $ echo a > a/fa
   $ echo c > a/c/fc
-  $ bzr add -q a
-  $ bzr commit -q -m 'Initial layout'
-  $ bzr mv a b
+  $ brz add -q a
+  $ brz commit -q -m 'Initial layout'
+  $ brz mv a b
   a => b
   $ mkdir a
-  $ bzr add a
+  $ brz add a
   add(ed|ing) a (re)
-  $ bzr mv b/c a/c
+  $ brz mv b/c a/c
   b/c => a/c
-  $ bzr status
+  $ brz status
   added:
     a/
   renamed:
     a/? => b/? (re)
     a/c/? => a/c/? (re)
-  $ bzr commit -q -m 'Divergent renames'
+  $ brz commit -q -m 'Divergent renames'
   $ cd ..
   $ hg convert source source-hg
   initializing destination source-hg repository
--- a/tests/test-convert-bzr-ghosts.t	Wed Apr 21 10:58:21 2021 +0200
+++ b/tests/test-convert-bzr-ghosts.t	Mon Apr 26 22:59:56 2021 +0200
@@ -3,11 +3,12 @@
   $ . "$TESTDIR/bzr-definitions"
   $ cat > ghostcreator.py <<EOF
   > import sys
-  > from bzrlib import workingtree
+  > from breezy import workingtree
+  > import breezy.bzr.bzrdir
   > wt = workingtree.WorkingTree.open('.')
   > 
   > message, ghostrev = sys.argv[1:]
-  > wt.set_parent_ids(wt.get_parent_ids() + [ghostrev])
+  > wt.set_parent_ids(wt.get_parent_ids() + [ghostrev.encode()])
   > wt.commit(message)
   > EOF
 
@@ -15,11 +16,11 @@
 
   $ mkdir test-ghost-revisions
   $ cd test-ghost-revisions
-  $ bzr init -q source
+  $ brz init -q source
   $ cd source
   $ echo content > somefile
-  $ bzr add -q somefile
-  $ bzr commit -q -m 'Initial layout setup'
+  $ brz add -q somefile
+  $ brz commit -q -m 'Initial layout setup'
   $ echo morecontent >> somefile
   $ "$PYTHON" ../../ghostcreator.py 'Commit with ghost revision' ghostrev
   $ cd ..
--- a/tests/test-convert-bzr-merges.t	Wed Apr 21 10:58:21 2021 +0200
+++ b/tests/test-convert-bzr-merges.t	Mon Apr 26 22:59:56 2021 +0200
@@ -10,37 +10,37 @@
 
   $ mkdir test-multimerge
   $ cd test-multimerge
-  $ bzr init -q source
+  $ brz init -q source
   $ cd source
   $ echo content > file
   $ echo text > rename_me
-  $ bzr add -q file rename_me
-  $ bzr commit -q -m 'Initial add' '--commit-time=2009-10-10 08:00:00 +0100'
+  $ brz add -q file rename_me
+  $ brz commit -q -m 'Initial add' '--commit-time=2009-10-10 08:00:00 +0100'
   $ cd ..
-  $ bzr branch -q source source-branch1
+  $ brz branch -q source source-branch1
   $ cd source-branch1
   $ echo morecontent >> file
   $ echo evenmorecontent > file-branch1
-  $ bzr add -q file-branch1
-  $ bzr commit -q -m 'Added branch1 file' '--commit-time=2009-10-10 08:00:01 +0100'
+  $ brz add -q file-branch1
+  $ brz commit -q -m 'Added branch1 file' '--commit-time=2009-10-10 08:00:01 +0100'
   $ cd ../source
   $ sleep 1
   $ echo content > file-parent
-  $ bzr add -q file-parent
-  $ bzr commit -q -m 'Added parent file' '--commit-time=2009-10-10 08:00:02 +0100'
+  $ brz add -q file-parent
+  $ brz commit -q -m 'Added parent file' '--commit-time=2009-10-10 08:00:02 +0100'
   $ cd ..
-  $ bzr branch -q source source-branch2
+  $ brz branch -q source source-branch2
   $ cd source-branch2
   $ echo somecontent > file-branch2
-  $ bzr add -q file-branch2
-  $ bzr mv -q rename_me renamed
+  $ brz add -q file-branch2
+  $ brz mv -q rename_me renamed
   $ echo change > renamed
-  $ bzr commit -q -m 'Added brach2 file' '--commit-time=2009-10-10 08:00:03 +0100'
+  $ brz commit -q -m 'Added brach2 file' '--commit-time=2009-10-10 08:00:03 +0100'
   $ sleep 1
   $ cd ../source
-  $ bzr merge -q ../source-branch1
-  $ bzr merge -q --force ../source-branch2
-  $ bzr commit -q -m 'Merged branches' '--commit-time=2009-10-10 08:00:04 +0100'
+  $ brz merge -q ../source-branch1
+  $ brz merge -q --force ../source-branch2
+  $ brz commit -q -m 'Merged branches' '--commit-time=2009-10-10 08:00:04 +0100'
   $ cd ..
 
 BUG: file-branch2 should not be added in rev 4, and the rename_me -> renamed
--- a/tests/test-convert-bzr-treeroot.t	Wed Apr 21 10:58:21 2021 +0200
+++ b/tests/test-convert-bzr-treeroot.t	Mon Apr 26 22:59:56 2021 +0200
@@ -3,11 +3,12 @@
   $ . "$TESTDIR/bzr-definitions"
   $ cat > treeset.py <<EOF
   > import sys
-  > from bzrlib import workingtree
+  > from breezy import workingtree
+  > import breezy.bzr.bzrdir
   > wt = workingtree.WorkingTree.open('.')
   > 
   > message, rootid = sys.argv[1:]
-  > wt.set_root_id('tree_root-%s' % rootid)
+  > wt.set_root_id(b'tree_root-%s' % rootid.encode())
   > wt.commit(message)
   > EOF
 
@@ -15,11 +16,11 @@
 
   $ mkdir test-change-treeroot-id
   $ cd test-change-treeroot-id
-  $ bzr init -q source
+  $ brz init -q source
   $ cd source
   $ echo content > file
-  $ bzr add -q file
-  $ bzr commit -q -m 'Initial add'
+  $ brz add -q file
+  $ brz commit -q -m 'Initial add'
   $ "$PYTHON" ../../treeset.py 'Changed root' new
   $ cd ..
   $ hg convert source source-hg
--- a/tests/test-convert-bzr.t	Wed Apr 21 10:58:21 2021 +0200
+++ b/tests/test-convert-bzr.t	Mon Apr 26 22:59:56 2021 +0200
@@ -6,7 +6,7 @@
 
   $ mkdir test-createandrename
   $ cd test-createandrename
-  $ bzr init -q source
+  $ brz init -q source
 
 test empty repo conversion (issue3233)
 
@@ -22,18 +22,18 @@
   $ echo a > a
   $ echo c > c
   $ echo e > e
-  $ bzr add -q a c e
-  $ bzr commit -q -m 'Initial add: a, c, e'
-  $ bzr mv a b
+  $ brz add -q a c e
+  $ brz commit -q -m 'Initial add: a, c, e'
+  $ brz mv a b
   a => b
-  $ bzr mv c d
+  $ brz mv c d
   c => d
-  $ bzr mv e f
+  $ brz mv e f
   e => f
   $ echo a2 >> a
   $ mkdir e
-  $ bzr add -q a e
-  $ bzr commit -q -m 'rename a into b, create a, rename c into d'
+  $ brz add -q a e
+  $ brz commit -q -m 'rename a into b, create a, rename c into d'
   $ cd ..
   $ hg convert source source-hg
   scanning source...
@@ -86,7 +86,7 @@
 
 convert from lightweight checkout
 
-  $ bzr checkout --lightweight source source-light
+  $ brz checkout --lightweight source source-light
   $ hg convert -s bzr source-light source-light-hg
   initializing destination source-light-hg repository
   warning: lightweight checkouts may cause conversion failures, try with a regular branch instead.
@@ -99,7 +99,7 @@
 compare timestamps
 
   $ cd source
-  $ bzr log | \
+  $ brz log | \
   >   sed '/timestamp/!d;s/.\{15\}\([0-9: -]\{16\}\):.. \(.[0-9]\{4\}\)/\1 \2/' \
   >   > ../bzr-timestamps
   $ cd ..
@@ -113,20 +113,21 @@
   $ cd test-merge
   $ cat > helper.py <<EOF
   > import sys
-  > from bzrlib import workingtree
+  > from breezy import workingtree
+  > import breezy.bzr.bzrdir
   > wt = workingtree.WorkingTree.open('.')
   > 
   > message, stamp = sys.argv[1:]
   > wt.commit(message, timestamp=int(stamp))
   > EOF
-  $ bzr init -q source
+  $ brz init -q source
   $ cd source
   $ echo content > a
   $ echo content2 > b
-  $ bzr add -q a b
-  $ bzr commit -q -m 'Initial add'
+  $ brz add -q a b
+  $ brz commit -q -m 'Initial add'
   $ cd ..
-  $ bzr branch -q source source-improve
+  $ brz branch -q source source-improve
   $ cd source
   $ echo more >> a
   $ "$PYTHON" ../helper.py 'Editing a' 100
@@ -134,8 +135,8 @@
   $ echo content3 >> b
   $ "$PYTHON" ../helper.py 'Editing b' 200
   $ cd ../source
-  $ bzr merge -q ../source-improve
-  $ bzr commit -q -m 'Merged improve branch'
+  $ brz merge -q ../source-improve
+  $ brz commit -q -m 'Merged improve branch'
   $ cd ..
   $ hg convert --datesort source source-hg
   initializing destination source-hg repository
@@ -163,7 +164,7 @@
 
   $ mkdir test-symlinks
   $ cd test-symlinks
-  $ bzr init -q source
+  $ brz init -q source
   $ cd source
   $ touch program
   $ chmod +x program
@@ -171,15 +172,15 @@
   $ mkdir d
   $ echo a > d/a
   $ ln -s a syma
-  $ bzr add -q altname program syma d/a
-  $ bzr commit -q -m 'Initial setup'
+  $ brz add -q altname program syma d/a
+  $ brz commit -q -m 'Initial setup'
   $ touch newprog
   $ chmod +x newprog
   $ rm altname
   $ ln -s newprog altname
   $ chmod -x program
-  $ bzr add -q newprog
-  $ bzr commit -q -m 'Symlink changed, x bits changed'
+  $ brz add -q newprog
+  $ brz commit -q -m 'Symlink changed, x bits changed'
   $ cd ..
   $ hg convert source source-hg
   initializing destination source-hg repository
@@ -215,30 +216,28 @@
 
 Multiple branches
 
-  $ bzr init-repo -q --no-trees repo
-  $ bzr init -q repo/trunk
-  $ bzr co repo/trunk repo-trunk
+  $ brz init-repo -q --no-trees repo
+  $ brz init -q repo/trunk
+  $ brz co repo/trunk repo-trunk
   $ cd repo-trunk
   $ echo a > a
-  $ bzr add -q a
-  $ bzr ci -qm adda
-  $ bzr tag trunk-tag
+  $ brz add -q a
+  $ brz ci -qm adda
+  $ brz tag trunk-tag
   Created tag trunk-tag.
-  $ bzr switch -b branch
+  $ brz switch -b branch
   Tree is up to date at revision 1.
   Switched to branch*repo/branch/ (glob)
-  $ sleep 1
   $ echo b > b
-  $ bzr add -q b
-  $ bzr ci -qm addb
-  $ bzr tag branch-tag
+  $ brz add -q b
+  $ brz ci -qm addb
+  $ brz tag branch-tag
   Created tag branch-tag.
-  $ bzr switch --force ../repo/trunk
+  $ brz switch --force ../repo/trunk
   Updated to revision 1.
   Switched to branch*/repo/trunk/ (glob)
-  $ sleep 1
   $ echo a >> a
-  $ bzr ci -qm changea
+  $ brz ci -qm changea
   $ cd ..
   $ hg convert --datesort repo repo-bzr
   initializing destination repo-bzr repository
@@ -269,13 +268,13 @@
 
 Nested repositories (issue3254)
 
-  $ bzr init-repo -q --no-trees repo/inner
-  $ bzr init -q repo/inner/trunk
-  $ bzr co repo/inner/trunk inner-trunk
+  $ brz init-repo -q --no-trees repo/inner
+  $ brz init -q repo/inner/trunk
+  $ brz co repo/inner/trunk inner-trunk
   $ cd inner-trunk
   $ echo b > b
-  $ bzr add -q b
-  $ bzr ci -qm addb
+  $ brz add -q b
+  $ brz ci -qm addb
   $ cd ..
   $ hg convert --datesort repo noinner-bzr
   initializing destination noinner-bzr repository