Rev 3945: merge bzr.dev in file:///net/bigmamac/Volumes/home/vila/src/bzr/experimental/pb-http/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Jan 19 16:17:46 GMT 2009


At file:///net/bigmamac/Volumes/home/vila/src/bzr/experimental/pb-http/

------------------------------------------------------------
revno: 3945
revision-id: v.ladeuil+lp at free.fr-20090119161728-6caqo9h2dv51u3q3
parent: john at arbash-meinel.com-20090116190749-c9oqg2m8yrek0jnz
parent: v.ladeuil+lp at free.fr-20090119130947-1ldks301mpsymf8r
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: jam-fixes
timestamp: Mon 2009-01-19 17:17:28 +0100
message:
  merge bzr.dev
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
  bzrlib/progress.py             progress.py-20050610070202-df9faaab791964c0
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/tests/blackbox/test_upgrade.py test_upgrade.py-20060120060132-b41e5ed2f886ad28
  bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
  bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
  bzrlib/ui/__init__.py          ui.py-20050824083933-8cf663c763ba53a9
  bzrlib/upgrade.py              history2weaves.py-20050818063535-e7d319791c19a8b2
    ------------------------------------------------------------
    revno: 3943.2.3
    revision-id: v.ladeuil+lp at free.fr-20090119130947-1ldks301mpsymf8r
    parent: pqm at pqm.ubuntu.com-20090119102507-0ue83url4iguuol1
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: emacs-ui-fixes
    timestamp: Mon 2009-01-19 14:09:47 +0100
    message:
      Restore a working UI implementation suitable for emacs shells.
      
      * bzrlib/ui/__init__.py:
      (CLIUIFactory.prompt, CLIUIFactory.note): Default implementations.
      (SilentUIFactory.prompt): Override default implementation.
      (make_ui_for_terminal): Let user override automatic detection.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/ui/__init__.py          ui.py-20050824083933-8cf663c763ba53a9
    ------------------------------------------------------------
    revno: 3943.2.2
    revision-id: pqm at pqm.ubuntu.com-20090119102507-0ue83url4iguuol1
    parent: pqm at pqm.ubuntu.com-20090119030630-3xdyyi4xj69md8e4
    parent: mbp at sourcefrog.net-20090116075048-kcpmohmcxm9jlfwg
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2009-01-19 10:25:07 +0000
    message:
      (mbp) small refactorings of upgrade
    modified:
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/progress.py             progress.py-20050610070202-df9faaab791964c0
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/tests/blackbox/test_upgrade.py test_upgrade.py-20060120060132-b41e5ed2f886ad28
      bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
      bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
      bzrlib/upgrade.py              history2weaves.py-20050818063535-e7d319791c19a8b2
        ------------------------------------------------------------
        revno: 3943.3.5
        revision-id: mbp at sourcefrog.net-20090116075048-kcpmohmcxm9jlfwg
        parent: mbp at sourcefrog.net-20090116024935-3jp2s7dqelxvk1io
        committer: Martin Pool <mbp at sourcefrog.net>
        branch nick: hpss-upgrade
        timestamp: Fri 2009-01-16 18:50:48 +1100
        message:
          deprecate needs_format_conversion(format=None)
        modified:
          bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
          bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
          bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
          bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
        ------------------------------------------------------------
        revno: 3943.3.4
        revision-id: mbp at sourcefrog.net-20090116024935-3jp2s7dqelxvk1io
        parent: mbp at sourcefrog.net-20090116024337-7m8qst4klrx5pklz
        committer: Martin Pool <mbp at sourcefrog.net>
        branch nick: hpss-upgrade
        timestamp: Fri 2009-01-16 13:49:35 +1100
        message:
          Move backup progress indicators from upgrade.py into backup_bzrdir, and tweak text
        modified:
          bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
          bzrlib/tests/blackbox/test_upgrade.py test_upgrade.py-20060120060132-b41e5ed2f886ad28
          bzrlib/upgrade.py              history2weaves.py-20050818063535-e7d319791c19a8b2
        ------------------------------------------------------------
        revno: 3943.3.3
        revision-id: mbp at sourcefrog.net-20090116024337-7m8qst4klrx5pklz
        parent: mbp at sourcefrog.net-20090116021855-tpv7k2calih400cu
        committer: Martin Pool <mbp at sourcefrog.net>
        branch nick: hpss-upgrade
        timestamp: Fri 2009-01-16 13:43:37 +1100
        message:
          Don't do string interpolation if there are no arguments
        modified:
          bzrlib/progress.py             progress.py-20050610070202-df9faaab791964c0
        ------------------------------------------------------------
        revno: 3943.3.2
        revision-id: mbp at sourcefrog.net-20090116021855-tpv7k2calih400cu
        parent: mbp at sourcefrog.net-20090116020656-hyvtq0b4nu6mezqm
        committer: Martin Pool <mbp at sourcefrog.net>
        branch nick: hpss-upgrade
        timestamp: Fri 2009-01-16 13:18:55 +1100
        message:
          Small refactoring to upgrade
        modified:
          bzrlib/upgrade.py              history2weaves.py-20050818063535-e7d319791c19a8b2
        ------------------------------------------------------------
        revno: 3943.3.1
        revision-id: mbp at sourcefrog.net-20090116020656-hyvtq0b4nu6mezqm
        parent: pqm at pqm.ubuntu.com-20090115233242-4bxyn4zcj2a0ksfk
        committer: Martin Pool <mbp at sourcefrog.net>
        branch nick: hpss-upgrade
        timestamp: Fri 2009-01-16 13:06:56 +1100
        message:
          doc/import cleanups
        modified:
          bzrlib/upgrade.py              history2weaves.py-20050818063535-e7d319791c19a8b2
    ------------------------------------------------------------
    revno: 3943.2.1
    revision-id: pqm at pqm.ubuntu.com-20090119030630-3xdyyi4xj69md8e4
    parent: pqm at pqm.ubuntu.com-20090115233242-4bxyn4zcj2a0ksfk
    parent: ian.clatworthy at canonical.com-20090119022415-mo0mcfeiexfktgwt
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2009-01-19 03:06:30 +0000
    message:
      apply jam's log --short fix (Ian Clatworthy)
    modified:
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
    ------------------------------------------------------------
    revno: 3943.1.1
    revision-id: ian.clatworthy at canonical.com-20090119022415-mo0mcfeiexfktgwt
    parent: pqm at pqm.ubuntu.com-20090115233242-4bxyn4zcj2a0ksfk
    committer: Ian Clatworthy <ian.clatworthy at canonical.com>
    branch nick: ianc-integration
    timestamp: Mon 2009-01-19 12:24:15 +1000
    message:
      apply jam's log --short fix (Ian Clatworthy)
    modified:
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-01-15 22:51:27 +0000
+++ b/NEWS	2009-01-19 13:09:47 +0000
@@ -52,6 +52,13 @@
 
   INTERNALS:
 
+    * Default User Interface (UI) is CLIUIFactory when bzr runs in a dumb
+      terminal. It is sometimes desirable do override this default by forcing
+      bzr to use TextUIFactory. This can be achieved by setting the
+      BZR_USE_TEXT_UI environment variable (emacs shells, as opposed to
+      compile buffers, are such an example.
+      (Vincent Ladeuil)
+
     * ``TreeDelta.show()`` now accepts a ``filter`` parameter allowing log
       formatters to retrict the output.
       (Vincent Ladeuil)

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2009-01-08 19:48:48 +0000
+++ b/bzrlib/bzrdir.py	2009-01-16 07:50:48 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd
+# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -524,9 +524,22 @@
         
         :return: Tuple with old path name and new path name
         """
-        self.root_transport.copy_tree('.bzr', 'backup.bzr')
-        return (self.root_transport.abspath('.bzr'),
-                self.root_transport.abspath('backup.bzr'))
+        pb = ui.ui_factory.nested_progress_bar()
+        try:
+            # FIXME: bug 300001 -- the backup fails if the backup directory
+            # already exists, but it should instead either remove it or make
+            # a new backup directory.
+            #
+            # FIXME: bug 262450 -- the backup directory should have the same 
+            # permissions as the .bzr directory (probably a bug in copy_tree)
+            old_path = self.root_transport.abspath('.bzr')
+            new_path = self.root_transport.abspath('backup.bzr')
+            pb.note('making backup of %s' % (old_path,))
+            pb.note('  to %s' % (new_path,))
+            self.root_transport.copy_tree('.bzr', 'backup.bzr')
+            return (old_path, new_path)
+        finally:
+            pb.finished()
 
     def retire_bzrdir(self, limit=10000):
         """Permanently disable the bzrdir.
@@ -1308,6 +1321,8 @@
         # if the format is not the same as the system default,
         # an upgrade is needed.
         if format is None:
+            symbol_versioning.warn(symbol_versioning.deprecated_in((1, 13, 0))
+                % 'needs_format_conversion(format=None)')
             format = BzrDirFormat.get_default_format()
         return not isinstance(self._format, format.__class__)
 
@@ -1355,6 +1370,9 @@
 
     def needs_format_conversion(self, format=None):
         """Format 4 dirs are always in need of conversion."""
+        if format is None:
+            symbol_versioning.warn(symbol_versioning.deprecated_in((1, 13, 0))
+                % 'needs_format_conversion(format=None)')
         return True
 
     def open_repository(self):
@@ -1516,6 +1534,9 @@
     def needs_format_conversion(self, format=None):
         """See BzrDir.needs_format_conversion()."""
         if format is None:
+            symbol_versioning.warn(symbol_versioning.deprecated_in((1, 13, 0))
+                % 'needs_format_conversion(format=None)')
+        if format is None:
             format = BzrDirFormat.get_default_format()
         if not isinstance(self._format, format.__class__):
             # it is not a meta dir format, conversion is needed.

=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py	2009-01-15 14:05:13 +0000
+++ b/bzrlib/log.py	2009-01-19 02:24:15 +0000
@@ -620,7 +620,7 @@
     :return: an iterator of (revision_id, revno, merge_depth)
     (if there is no revno for a revision, None is supplied)
     """
-    if include_merges is False:
+    if not include_merges:
         revision_ids = mainline_revs[1:]
         if direction == 'reverse':
             revision_ids.reverse()

=== modified file 'bzrlib/progress.py'
--- a/bzrlib/progress.py	2008-12-17 08:18:14 +0000
+++ b/bzrlib/progress.py	2009-01-16 02:43:37 +0000
@@ -118,7 +118,10 @@
     def note(self, fmt_string, *args):
         """Record a note without disrupting the progress bar."""
         # XXX: shouldn't be here; put it in mutter or the ui instead
-        self.ui_factory.note(fmt_string % args)
+        if args:
+            self.ui_factory.note(fmt_string % args)
+        else:
+            self.ui_factory.note(fmt_string)
 
     def clear(self):
         # XXX: shouldn't be here; put it in mutter or the ui instead

=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2008-12-12 01:17:04 +0000
+++ b/bzrlib/remote.py	2009-01-16 07:50:48 +0000
@@ -230,6 +230,9 @@
 
     def needs_format_conversion(self, format=None):
         """Upgrading of remote bzrdirs is not supported yet."""
+        if format is None:
+            symbol_versioning.warn(symbol_versioning.deprecated_in((1, 13, 0))
+                % 'needs_format_conversion(format=None)')
         return False
 
     def clone(self, url, revision_id=None, force_new_repo=False,

=== modified file 'bzrlib/tests/blackbox/test_upgrade.py'
--- a/bzrlib/tests/blackbox/test_upgrade.py	2009-01-13 05:07:27 +0000
+++ b/bzrlib/tests/blackbox/test_upgrade.py	2009-01-16 02:49:35 +0000
@@ -106,10 +106,8 @@
         (out, err) = self.run_bzr(
             ['upgrade', '--format=metaweave', url])
         self.assertEqualDiff("""starting upgrade of %s
-making backup of tree history
-%s.bzr has been backed up to %sbackup.bzr
-if conversion fails, you can move this directory back to .bzr
-if it succeeds, you can remove this directory if you wish
+making backup of %s.bzr
+  to %sbackup.bzr
 starting upgrade from format 5 to 6
 adding prefixes to weaves
 adding prefixes to revision-store
@@ -130,10 +128,8 @@
         (out, err) = self.run_bzr(
             ['upgrade', '--format=knit', url])
         self.assertEqualDiff("""starting upgrade of %s
-making backup of tree history
-%s.bzr has been backed up to %sbackup.bzr
-if conversion fails, you can move this directory back to .bzr
-if it succeeds, you can remove this directory if you wish
+making backup of %s.bzr
+  to %sbackup.bzr
 starting repository conversion
 repository converted
 finished
@@ -169,10 +165,8 @@
         url = t.base
         out, err = self.run_bzr(['upgrade', '--format=knit', url])
         self.assertEqualDiff("""starting upgrade of %s
-making backup of tree history
-%s.bzr has been backed up to %sbackup.bzr
-if conversion fails, you can move this directory back to .bzr
-if it succeeds, you can remove this directory if you wish
+making backup of %s.bzr
+  to %sbackup.bzr
 starting upgrade from format 6 to metadir
 starting repository conversion
 repository converted

=== modified file 'bzrlib/tests/bzrdir_implementations/test_bzrdir.py'
--- a/bzrlib/tests/bzrdir_implementations/test_bzrdir.py	2008-12-05 02:42:39 +0000
+++ b/bzrlib/tests/bzrdir_implementations/test_bzrdir.py	2009-01-16 07:50:48 +0000
@@ -1476,7 +1476,8 @@
             # available
             self.assertTrue(isinstance(dir._format.get_converter(
                 format=dir._format), bzrdir.Converter))
-        dir.needs_format_conversion(None)
+        dir.needs_format_conversion(
+            bzrdir.BzrDirFormat.get_default_format())
 
     def test_backup_copies_existing(self):
         tree = self.make_branch_and_tree('test')

=== modified file 'bzrlib/tests/test_bzrdir.py'
--- a/bzrlib/tests/test_bzrdir.py	2009-01-09 05:29:09 +0000
+++ b/bzrlib/tests/test_bzrdir.py	2009-01-16 07:50:48 +0000
@@ -880,15 +880,10 @@
 
     def test_needs_conversion_different_working_tree(self):
         # meta1dirs need an conversion if any element is not the default.
-        old_format = bzrdir.BzrDirFormat.get_default_format()
-        # test with 
-        new_default = bzrdir.format_registry.make_bzrdir('dirstate')
-        bzrdir.BzrDirFormat._set_default_format(new_default)
-        try:
-            tree = self.make_branch_and_tree('tree', format='knit')
-            self.assertTrue(tree.bzrdir.needs_format_conversion())
-        finally:
-            bzrdir.BzrDirFormat._set_default_format(old_format)
+        new_format = bzrdir.format_registry.make_bzrdir('dirstate')
+        tree = self.make_branch_and_tree('tree', format='knit')
+        self.assertTrue(tree.bzrdir.needs_format_conversion(
+            new_format))
 
 
 class TestFormat5(TestCaseWithTransport):
@@ -915,16 +910,14 @@
         self.assertTrue(dir.can_convert_format())
     
     def test_needs_conversion(self):
-        # format 5 dirs need a conversion if they are not the default.
-        # and they start of not the default.
-        old_format = bzrdir.BzrDirFormat.get_default_format()
-        bzrdir.BzrDirFormat._set_default_format(bzrdir.BzrDirFormat5())
-        try:
-            dir = bzrdir.BzrDirFormat5().initialize(self.get_url())
-            self.assertFalse(dir.needs_format_conversion())
-        finally:
-            bzrdir.BzrDirFormat._set_default_format(old_format)
-        self.assertTrue(dir.needs_format_conversion())
+        # format 5 dirs need a conversion if they are not the default,
+        # and they aren't
+        dir = bzrdir.BzrDirFormat5().initialize(self.get_url())
+        # don't need to convert it to itself
+        self.assertFalse(dir.needs_format_conversion(bzrdir.BzrDirFormat5()))
+        # do need to convert it to the current default
+        self.assertTrue(dir.needs_format_conversion(
+            bzrdir.BzrDirFormat.get_default_format()))
 
 
 class TestFormat6(TestCaseWithTransport):
@@ -952,13 +945,9 @@
     
     def test_needs_conversion(self):
         # format 6 dirs need an conversion if they are not the default.
-        old_format = bzrdir.BzrDirFormat.get_default_format()
-        bzrdir.BzrDirFormat._set_default_format(bzrdir.BzrDirMetaFormat1())
-        try:
-            dir = bzrdir.BzrDirFormat6().initialize(self.get_url())
-            self.assertTrue(dir.needs_format_conversion())
-        finally:
-            bzrdir.BzrDirFormat._set_default_format(old_format)
+        dir = bzrdir.BzrDirFormat6().initialize(self.get_url())
+        self.assertTrue(dir.needs_format_conversion(
+            bzrdir.BzrDirFormat.get_default_format()))
 
 
 class NotBzrDir(bzrlib.bzrdir.BzrDir):

=== modified file 'bzrlib/ui/__init__.py'
--- a/bzrlib/ui/__init__.py	2009-01-16 19:07:49 +0000
+++ b/bzrlib/ui/__init__.py	2009-01-19 16:17:28 +0000
@@ -172,6 +172,11 @@
 
     def prompt(self, prompt):
         """Emit prompt on the CLI."""
+        self.stdout.write(prompt)
+
+    def note(self, msg):
+        """Write an already-formatted message."""
+        self.stdout.write(msg + '\n')
 
     def clear_term(self):
         pass
@@ -192,6 +197,9 @@
     def get_password(self, prompt='', **kwargs):
         return None
 
+    def prompt(self, prompt):
+        pass
+
     def note(self, msg):
         pass
 
@@ -221,7 +229,9 @@
     elif os.environ.get('TERM') in (None, 'dumb', ''):
         # e.g. emacs compile window
         cls = CLIUIFactory
-    else:
+    # User may know better, otherwise default to TextUIFactory
+    if (   os.environ.get('BZR_USE_TEXT_UI', None) is not None
+        or cls is None):
         from bzrlib.ui.text import TextUIFactory
         cls = TextUIFactory
     return cls(stdin=stdin, stdout=stdout, stderr=stderr)

=== modified file 'bzrlib/upgrade.py'
--- a/bzrlib/upgrade.py	2008-12-05 01:41:55 +0000
+++ b/bzrlib/upgrade.py	2009-01-16 02:49:35 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2008 Canonical Ltd
+# Copyright (C) 2005, 2008, 2009 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,10 +16,8 @@
 
 """bzr upgrade logic."""
 
-# change upgrade from .bzr to create a '.bzr-new', then do a bait and switch.
-
-
-from bzrlib.bzrdir import ConvertBzrDir4To5, ConvertBzrDir5To6, BzrDir, BzrDirFormat4, BzrDirFormat5, BzrDirFormat
+
+from bzrlib.bzrdir import BzrDir, BzrDirFormat
 import bzrlib.errors as errors
 from bzrlib.remote import RemoteBzrDir
 from bzrlib.transport import get_transport
@@ -29,6 +27,8 @@
 class Convert(object):
 
     def __init__(self, url, format):
+        if format is None:
+            format = BzrDirFormat.get_default_format()
         self.format = format
         self.bzrdir = BzrDir.open_unsupported(url)
         if isinstance(self.bzrdir, RemoteBzrDir):
@@ -61,24 +61,14 @@
         if not self.bzrdir.can_convert_format():
             raise errors.BzrError("cannot upgrade from bzrdir format %s" %
                            self.bzrdir._format)
-        if self.format is None:
-            target_format = BzrDirFormat.get_default_format()
-        else:
-            target_format = self.format
-        self.bzrdir.check_conversion_target(target_format)
+        self.bzrdir.check_conversion_target(self.format)
         self.pb.note('starting upgrade of %s', self.transport.base)
-        self._backup_control_dir()
+        self.bzrdir.backup_bzrdir()
         while self.bzrdir.needs_format_conversion(self.format):
             converter = self.bzrdir._format.get_converter(self.format)
             self.bzrdir = converter.convert(self.bzrdir, self.pb)
         self.pb.note("finished")
 
-    def _backup_control_dir(self):
-        self.pb.note('making backup of tree history')
-        old_path, new_path = self.bzrdir.backup_bzrdir()
-        self.pb.note('%s has been backed up to %s', old_path, new_path)
-        self.pb.note('if conversion fails, you can move this directory back to .bzr')
-        self.pb.note('if it succeeds, you can remove this directory if you wish')
 
 def upgrade(url, format=None):
     """Upgrade to format, or the default bzrdir format if not supplied."""



More information about the bazaar-commits mailing list