Rev 3334: (robertc) Add errors needed for branch stacking support. (Robert in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Apr 4 07:00:01 BST 2008


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

------------------------------------------------------------
revno: 3334
revision-id:pqm at pqm.ubuntu.com-20080404055943-evqxhz3x63dz9wbt
parent: pqm at pqm.ubuntu.com-20080404040539-d5h9wmdw179euvm2
parent: robertc at robertcollins.net-20080302191122-1ka40w2ikhf621by
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2008-04-04 06:59:43 +0100
message:
  (robertc) Add errors needed for branch stacking support. (Robert
  	Collins)
modified:
  bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
  bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
    ------------------------------------------------------------
    revno: 3221.3.9
    revision-id:robertc at robertcollins.net-20080302191122-1ka40w2ikhf621by
    parent: robertc at robertcollins.net-20080227113225-xaryqdk37m9pys8j
    parent: robertc at robertcollins.net-20080228163138-79rgg8thdml9l2zd
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: errors
    timestamp: Mon 2008-03-03 06:11:22 +1100
    message:
      NEWS update.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3221.3.8
    revision-id:robertc at robertcollins.net-20080227113225-xaryqdk37m9pys8j
    parent: robertc at robertcollins.net-20080221225343-lp5xf6hl5g91088a
    parent: robertc at robertcollins.net-20080227022115-cmtkxjtvcp9qjn3r
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: errors
    timestamp: Wed 2008-02-27 22:32:25 +1100
    message:
      Merge bzr.dev.
    removed:
      index.txt                      index.txt-20071121073725-0corxykv5irjal00-1
    added:
      bzrlib/plugins/launchpad/test_lp_service.py test_lp_service.py-20080213034527-drf0ucr2x1js3onb-1
      tools/package_mf.py            package_mf.py-20080206141953-323gd0qb2z3tn5pc-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
      bzrlib/plugins/launchpad/__init__.py __init__.py-20060315182712-2d5feebd2a1032dc
      bzrlib/plugins/launchpad/test_lp_indirect.py test_lp_indirect.py-20070126002743-oyle362tzv9cd8mi-1
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
      bzrlib/tests/blackbox/test_checkout.py test_checkout.py-20060211231752-a5cde67cf70af854
      bzrlib/tests/blackbox/test_version.py test_version.py-20070312060045-ol7th9z035r3im3d-1
      bzrlib/tests/branch_implementations/test_commit.py test_commit.py-20070206022134-117z1i5b644p63r0-1
      bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
      bzrlib/tests/test_ssh_transport.py test_ssh_transport.p-20070105153201-f7iq2bosvgjbdgc3-1
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
      bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
      bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
      bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/transport/ftp.py        ftp.py-20051116161804-58dc9506548c2a53
      bzrlib/transport/memory.py     memory.py-20051016101338-cd008dbdf69f04fc
      bzrlib/transport/ssh.py        ssh.py-20060824042150-0s9787kng6zv1nwq-1
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
      tools/win32/bzr.iss.cog        bzr.iss.cog-20060622100836-b3yup582rt3y0nvm-5
    ------------------------------------------------------------
    revno: 3221.3.7
    revision-id:robertc at robertcollins.net-20080221225343-lp5xf6hl5g91088a
    parent: robertc at robertcollins.net-20080220002317-5bdinlaczri004x2
    parent: pqm at pqm.ubuntu.com-20080220014008-9appc9kw4rjg8v1k
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: errors
    timestamp: Fri 2008-02-22 09:53:43 +1100
    message:
      Merge bzr.dev.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
    ------------------------------------------------------------
    revno: 3221.3.6
    revision-id:robertc at robertcollins.net-20080220002317-5bdinlaczri004x2
    parent: robertc at robertcollins.net-20080219041134-03amd7siou1c8ugw
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: errors
    timestamp: Wed 2008-02-20 11:23:17 +1100
    message:
      Port across errors for shallow branch support.
    modified:
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2008-03-27 06:10:18 +0000
+++ b/bzrlib/errors.py	2008-04-04 05:59:43 +0000
@@ -185,6 +185,13 @@
     _fmt = "The tree builder is already building a tree."
 
 
+class BranchError(BzrError):
+    """Base class for concrete 'errors about a branch'."""
+
+    def __init__(self, branch):
+        BzrError.__init__(self, branch=branch)
+
+
 class BzrCheckError(InternalBzrError):
     
     _fmt = "Internal check failed: %(message)s"
@@ -305,6 +312,11 @@
         BzrError.__init__(self, repository=repository, file_id=file_id)
 
 
+class NotStacked(BranchError):
+
+    _fmt = "The branch '%(branch)s' is not stacked."
+
+
 class InventoryModified(InternalBzrError):
 
     _fmt = ("The current inventory for the tree %(tree)r has been modified,"
@@ -568,6 +580,28 @@
         PathError.__init__(self, url, extra=extra)
 
 
+class UnstackableBranchFormat(BzrError):
+
+    _fmt = ("The branch '%(url)s'(%(format)s) is not a stackable format. "
+        "You will need to upgrade the branch to permit branch stacking.")
+
+    def __init__(self, format, url):
+        BzrError.__init__(self)
+        self.format = format
+        self.url = url
+
+
+class UnstackableRepositoryFormat(BzrError):
+
+    _fmt = ("The repository '%(url)s'(%(format)s) is not a stackable format. "
+        "You will need to upgrade the repository to permit branch stacking.")
+
+    def __init__(self, format, url):
+        BzrError.__init__(self)
+        self.format = format
+        self.url = url
+
+
 class ReadError(PathError):
     
     _fmt = """Error reading from %(path)r."""
@@ -1175,13 +1209,10 @@
         self.bases = bases
 
 
-class NoCommits(BzrError):
+class NoCommits(BranchError):
 
     _fmt = "Branch %(branch)s has no commits."
 
-    def __init__(self, branch):
-        BzrError.__init__(self, branch=branch)
-
 
 class UnlistableStore(BzrError):
 

=== modified file 'bzrlib/tests/test_errors.py'
--- a/bzrlib/tests/test_errors.py	2008-03-27 06:10:18 +0000
+++ b/bzrlib/tests/test_errors.py	2008-04-04 05:59:43 +0000
@@ -175,6 +175,11 @@
                              " tree atree.", str(error))
         self.assertIsInstance(error, errors.NoSuchRevision)
 
+    def test_not_stacked(self):
+        error = errors.NotStacked('a branch')
+        self.assertEqualDiff("The branch 'a branch' is not stacked.",
+            str(error))
+
     def test_not_write_locked(self):
         error = errors.NotWriteLocked('a thing to repr')
         self.assertEqualDiff("'a thing to repr' is not write locked but needs "
@@ -210,6 +215,24 @@
             " of bzrlib.",
             str(error))
 
+    def test_unstackable_branch_format(self):
+        format = u'foo'
+        url = "/foo"
+        error = errors.UnstackableBranchFormat(format, url)
+        self.assertEqualDiff(
+            "The branch '/foo'(foo) is not a stackable format. "
+            "You will need to upgrade the branch to permit branch stacking.",
+            str(error))
+
+    def test_unstackable_repository_format(self):
+        format = u'foo'
+        url = "/foo"
+        error = errors.UnstackableRepositoryFormat(format, url)
+        self.assertEqualDiff(
+            "The repository '/foo'(foo) is not a stackable format. "
+            "You will need to upgrade the repository to permit branch stacking.",
+            str(error))
+
     def test_up_to_date(self):
         error = errors.UpToDateFormat(bzrdir.BzrDirFormat4())
         self.assertEqualDiff("The branch format Bazaar-NG branch, "




More information about the bazaar-commits mailing list