Rev 1759: Give proper error when tags can't be pushed. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Tue Nov 18 22:26:34 GMT 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/trunk

------------------------------------------------------------
revno: 1759
revision-id: jelmer at samba.org-20081118222630-eblzc2vymzhwmnw4
parent: jelmer at samba.org-20081118170305-37bo3sgmbufxr4kl
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2008-11-18 23:26:30 +0100
message:
  Give proper error when tags can't be pushed.
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  branch.py                      svnbranch.py-20051017135706-11c749eb0dab04a7
  mapping.py                     mapping.py-20080128201303-6cp01phc0dmc0kiv-1
  mapping3/__init__.py           __init__.py-20080502174630-9324zh25kka98vlw-1
=== modified file 'NEWS'
--- a/NEWS	2008-11-11 01:28:49 +0000
+++ b/NEWS	2008-11-18 22:26:30 +0000
@@ -7,6 +7,8 @@
 
    * Add --svn-override-revprops option to svn-push.
 
+   * Give proper error when tags can't be pushed. (#299490)
+
 bzr-svn 0.4.15	2008-11-10
 
   BUG FIXES

=== modified file 'branch.py'
--- a/branch.py	2008-11-11 01:28:49 +0000
+++ b/branch.py	2008-11-18 22:26:30 +0000
@@ -21,6 +21,7 @@
 from bzrlib.errors import (NoSuchFile, DivergedBranches, NoSuchRevision, 
                            NotBranchError, UnstackableBranchFormat)
 from bzrlib.revision import is_null, ensure_null
+from bzrlib.tag import DisabledTags
 from bzrlib.workingtree import WorkingTree
 
 from bzrlib.plugins.svn import core, wc
@@ -62,13 +63,13 @@
             look at; none for latest.
         """
         self.repository = repository
+        self._format = SvnBranchFormat()
+        self.mapping = self.repository.get_mapping()
         super(SvnBranch, self).__init__()
         assert isinstance(self.repository, SvnRepository)
         self.control_files = FakeControlFiles()
-        self._format = SvnBranchFormat()
         self._lock_mode = None
         self._lock_count = 0
-        self.mapping = self.repository.get_mapping()
         self.layout = self.repository.get_layout()
         self._branch_path = branch_path.strip("/")
         self.base = urlutils.join(self.repository.base, 
@@ -91,7 +92,10 @@
             raise NotSvnBranchPath(branch_path, mapping=self.mapping)
 
     def _make_tags(self):
-        return SubversionTags(self)
+        if self.supports_tags():
+            return SubversionTags(self)
+        else:
+            return DisabledTags(self)
 
     def set_branch_path(self, branch_path):
         """Change the branch path for this branch.
@@ -506,7 +510,7 @@
         return '%s(%r)' % (self.__class__.__name__, self.base)
 
     def supports_tags(self):
-        return self._format.supports_tags()
+        return self._format.supports_tags() and self.mapping.supports_tags()
 
     __repr__ = __str__
 

=== modified file 'mapping.py'
--- a/mapping.py	2008-11-09 18:33:14 +0000
+++ b/mapping.py	2008-11-18 22:26:30 +0000
@@ -419,6 +419,9 @@
     def unprefix(self, branch_path, repos_path):
         raise NotImplementedError(self.unprefix)
 
+    def supports_tags(self):
+        raise NotImplementedError(self.supports_tags)
+
 
 class BzrSvnMappingv1(BzrSvnMapping):
     """This was the initial version of the mappings as used by bzr-svn
@@ -446,6 +449,9 @@
     def __eq__(self, other):
         return type(self) == type(other)
 
+    def supports_tags(self):
+        return False
+
 
 class BzrSvnMappingv2(BzrSvnMapping):
     """The second version of the mappings as used in the 0.3.x series.
@@ -470,6 +476,9 @@
     def __eq__(self, other):
         return type(self) == type(other)
 
+    def supports_tags(self):
+        return False
+
 
 def parse_fileid_property(text):
     ret = {}

=== modified file 'mapping3/__init__.py'
--- a/mapping3/__init__.py	2008-11-09 20:01:34 +0000
+++ b/mapping3/__init__.py	2008-11-18 22:26:30 +0000
@@ -310,6 +310,13 @@
     def is_tag(self, tag_path):
         return self.scheme.is_tag(tag_path)
 
+    def supports_tags(self):
+        try:
+            self.scheme.get_tag_path("foo")
+            return True
+        except NotImplementedError:
+            return False
+
     @classmethod
     def _generate_revision_id(cls, uuid, revnum, path, scheme):
         assert isinstance(revnum, int)




More information about the bazaar-commits mailing list