Rev 3681: (jam) Alert the user when --stacked changes the format. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Sep 2 23:09:04 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3681
revision-id: pqm at pqm.ubuntu.com-20080902220856-plj0mk673ygzwc1k
parent: pqm at pqm.ubuntu.com-20080902194610-1zzkeem0cm38snju
parent: john at arbash-meinel.com-20080902213804-yt0lemudi03eu4e0
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2008-09-02 23:08:56 +0100
message:
  (jam) Alert the user when --stacked changes the format.
modified:
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
    ------------------------------------------------------------
    revno: 3665.2.7
    revision-id: john at arbash-meinel.com-20080902213804-yt0lemudi03eu4e0
    parent: john at arbash-meinel.com-20080902213615-tcm28zy17l131n4u
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: jam-integration
    timestamp: Tue 2008-09-02 16:38:04 -0500
    message:
      Put the format in quotes, makes it easier to follow.
    modified:
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
    ------------------------------------------------------------
    revno: 3665.2.6
    revision-id: john at arbash-meinel.com-20080902213615-tcm28zy17l131n4u
    parent: john at arbash-meinel.com-20080902212759-pz26098ijspuknnl
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: jam-integration
    timestamp: Tue 2008-09-02 16:36:15 -0500
    message:
      Change the text a bit, and point to the explicit --1.6 or --1.6.1-rich-root bzrdir format.
    modified:
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
    ------------------------------------------------------------
    revno: 3665.2.5
    revision-id: john at arbash-meinel.com-20080902212759-pz26098ijspuknnl
    parent: john at arbash-meinel.com-20080902202633-l8y2dqsd1no2jegx
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: jam-integration
    timestamp: Tue 2008-09-02 16:27:59 -0500
    message:
      Test that we alert the user to the upgrade.
    modified:
      bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
    ------------------------------------------------------------
    revno: 3665.2.4
    revision-id: john at arbash-meinel.com-20080902202633-l8y2dqsd1no2jegx
    parent: john at arbash-meinel.com-20080829210816-3io9u83nt12ul2z2
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: jam-integration
    timestamp: Tue 2008-09-02 15:26:33 -0500
    message:
      Alert users when they end up upgrading their repository because of the --stacked parameter.
    modified:
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2008-09-02 15:28:44 +0000
+++ b/bzrlib/bzrdir.py	2008-09-02 22:08:56 +0000
@@ -1049,9 +1049,14 @@
             mutter("using %r for stacking" % (format._branch_format,))
             from bzrlib.repofmt import pack_repo
             if format.repository_format.rich_root_data:
+                bzrdir_format_name = '1.6.1-rich-root'
                 repo_format = pack_repo.RepositoryFormatKnitPack5RichRoot()
             else:
+                bzrdir_format_name = '1.6'
                 repo_format = pack_repo.RepositoryFormatKnitPack5()
+            note('Source format does not support stacking, using format:'
+                 ' \'%s\'\n  %s\n',
+                 bzrdir_format_name, repo_format.get_format_description())
             format.repository_format = repo_format
         return format
 

=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- a/bzrlib/tests/blackbox/test_branch.py	2008-07-25 05:32:45 +0000
+++ b/bzrlib/tests/blackbox/test_branch.py	2008-09-02 21:38:04 +0000
@@ -97,14 +97,15 @@
         target_stat = os.stat('target/file1')
         self.assertEqual(source_stat, target_stat)
 
+
 class TestBranchStacked(ExternalBase):
     """Tests for branch --stacked"""
 
     def check_shallow_branch(self, branch_revid, stacked_on):
         """Assert that the branch 'newbranch' has been published correctly.
-        
+
         :param stacked_on: url of a branch this one is stacked upon.
-        :param branch_revid: a revision id that should be the only 
+        :param branch_revid: a revision id that should be the only
             revision present in the stacked branch, and it should not be in
             the reference branch.
         """
@@ -218,6 +219,27 @@
         trunk = self.make_branch('trunk', format='pack-0.92')
         out, err = self.run_bzr(
             ['branch', '--stacked', 'trunk', 'shallow'])
+        # We should notify the user that we upgraded their format
+        self.assertEqualDiff(
+            'Source format does not support stacking, using format: \'1.6\'\n'
+            '  Packs 5 (adds stacking support, requires bzr 1.6)\n'
+            '\n'
+            'Created new stacked branch referring to %s.\n' % (trunk.base,),
+            err)
+
+    def test_branch_stacked_from_rich_root_non_stackable(self):
+        trunk = self.make_branch('trunk', format='rich-root-pack')
+        out, err = self.run_bzr(
+            ['branch', '--stacked', 'trunk', 'shallow'])
+        # We should notify the user that we upgraded their format
+        self.assertEqualDiff(
+            'Source format does not support stacking, using format:'
+            ' \'1.6.1-rich-root\'\n'
+            '  Packs 5 rich-root (adds stacking support, requires bzr 1.6.1)\n'
+            '\n'
+            'Created new stacked branch referring to %s.\n' % (trunk.base,),
+            err)
+
 
 
 class TestRemoteBranch(TestCaseWithSFTPServer):




More information about the bazaar-commits mailing list