Make error a bit more verbose when changing repository root.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 25 Oct 2007 11:21:39 +0000 (13:21 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 25 Oct 2007 11:21:39 +0000 (13:21 +0200)
NEWS
commit.py
errors.py
upgrade.py

diff --git a/NEWS b/NEWS
index 92e1599a0c5a84ac1d9bb1f1aa19ac5d92586dab..486a99ff8b4ac4d0e12859fa06271548b4c6851e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -34,7 +34,7 @@ bzr-svn 0.4.4 UNRELEASED
 
    * Fix compatibility with 0.92.
 
-   * Fix compatibility with packs.
+   * Fix compatibility with packs. (#139442)
 
    * Handle long file names with unicode characters correctly on 
      python2.4 (#129334)
index 47565df572a31d3119b2ee03319a61c234de59fa..521c6914125fe422ba0dd9eb11222ba7f62a718e 100644 (file)
--- a/commit.py
+++ b/commit.py
@@ -28,6 +28,7 @@ from bzrlib.revision import NULL_REVISION
 from bzrlib.trace import mutter
 
 from copy import deepcopy
+from errors import ChangesRootLHSHistory
 from repository import (SVN_PROP_BZR_ANCESTRY, SVN_PROP_BZR_FILEIDS,
                         SVN_PROP_SVK_MERGE, SVN_PROP_BZR_REVISION_INFO, 
                         SVN_PROP_BZR_REVISION_ID, revision_id_to_svk_feature,
@@ -399,7 +400,7 @@ class SvnCommitBuilder(RootCommitBuilder):
             name = "/".join(elements)
             if replace_existing:
                 if name == "":
-                    raise BzrError("changing lhs branch history not possible on repository root")
+                    raise ChangesRootLHSHistory()
                 self.mutter("removing branch dir %r" % name)
                 self.editor.delete_entry(name, -1, ret[-1])
             if base_path is not None:
@@ -452,9 +453,12 @@ class SvnCommitBuilder(RootCommitBuilder):
                     replace_existing = True
 
             # TODO: Accept create_prefix argument (#118787)
-            branch_batons = self.open_branch_batons(root, bp_parts,
-                existing_bp_parts, self.base_path, self.base_revnum, 
-                replace_existing)
+            try:
+                branch_batons = self.open_branch_batons(root, bp_parts,
+                    existing_bp_parts, self.base_path, self.base_revnum, 
+                    replace_existing)
+            except ChangesRootLHSHistory:
+                raise BzrError("Revision %r changes left hand side history. Use rebase and push again or push to a path inside the repository.")
 
             # Make sure the root id is stored properly
             if (self.old_inv.root is None or 
index c720354f3e3f2c3caa31be6a081df78e3b42be0b..aeb97df84922a78a1f5d8a9cdf54feaff569a69d 100644 (file)
--- a/errors.py
+++ b/errors.py
@@ -42,6 +42,10 @@ class NoSvnRepositoryPresent(NoRepositoryPresent):
         self.path = url
 
 
+class ChangesRootLHSHistory(BzrError):
+    _fmt = """changing lhs branch history not possible on repository root"""
+
+
 def convert_error(err):
     """Convert a Subversion exception to the matching BzrError.
 
index 567a765cec1afdbe4efc4bc90dd4c3c4330b6eda..09aa4c75e060d36690a743b556992aed7ca1e9c5 100644 (file)
@@ -19,7 +19,7 @@ from bzrlib.errors import BzrError, InvalidRevisionId
 from bzrlib.trace import info, mutter
 import bzrlib.ui as ui
 
-from errors import RebaseNotPresent, UpToDateMappings
+from errors import RebaseNotPresent
 from revids import (generate_svn_revision_id, parse_svn_revision_id, 
                     MAPPING_VERSION,  unescape_svn_path)
 from scheme import BranchingScheme, guess_scheme_from_branch_path