Rev 398: Merge main branch in http://people.samba.org/bzr/jelmer/bzr-svn/ver3

Jelmer Vernooij jelmer at samba.org
Thu Jan 18 13:22:24 GMT 2007


------------------------------------------------------------
revno: 398
revision-id: jelmer at samba.org-20070118132026-brb5n5rbcm9k1mti
parent: jelmer at samba.org-20070115172815-93j1sk2ylwzh8tt9
parent: jelmer at samba.org-20070118131914-sspamg4fv9c9mpv5
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: ver3
timestamp: Thu 2007-01-18 14:20:26 +0100
message:
  Merge main branch
modified:
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
  checkout.py                    workingtree.py-20060306120941-b083cb0fdd4a69de
  convert.py                     svn2bzr.py-20051018015439-cb4563bff29e632d
  format.py                      format.py-20060406233823-b6fa009fe35dfde7
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
  scheme.py                      scheme.py-20060516195850-95181aae6b272f9e
  tests/test_scheme.py           test_scheme.py-20060621221855-va2xabhlxpmc9llx-1
  transport.py                   transport.py-20060406231150-b3472d06b3a0818d
    ------------------------------------------------------------
    revno: 389.1.16
    merged: jelmer at samba.org-20070118131914-sspamg4fv9c9mpv5
    parent: jelmer at samba.org-20070117140701-iu1fbunp0q8vb7i0
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: main
    timestamp: Thu 2007-01-18 14:19:14 +0100
    message:
      Distinguish between branches and tags
    ------------------------------------------------------------
    revno: 389.1.15
    merged: jelmer at samba.org-20070117140701-iu1fbunp0q8vb7i0
    parent: jelmer at samba.org-20070116101442-8ipstsewthjbimhp
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: main
    timestamp: Wed 2007-01-17 15:07:01 +0100
    message:
      Update for bzr.dev
    ------------------------------------------------------------
    revno: 389.1.14
    merged: jelmer at samba.org-20070116101442-8ipstsewthjbimhp
    parent: jelmer at samba.org-20070116013721-adqxlwj1dl5jo7as
    parent: jelmer at samba.org-20070115172815-93j1sk2ylwzh8tt9
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: main
    timestamp: Tue 2007-01-16 11:14:42 +0100
    message:
      Import version 3 changes.
    ------------------------------------------------------------
    revno: 389.1.13
    merged: jelmer at samba.org-20070116013721-adqxlwj1dl5jo7as
    parent: jelmer at samba.org-20070115133448-o4pcdn4dvzqu5u25
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: main
    timestamp: Tue 2007-01-16 02:37:21 +0100
    message:
      Remove debug call
=== modified file '__init__.py'
--- a/__init__.py	2007-01-08 17:39:06 +0000
+++ b/__init__.py	2007-01-17 14:07:01 +0000
@@ -23,7 +23,7 @@
 import bzrlib
 
 __version__ = '0.3.0'
-required_bzr_version = (0,14)
+required_bzr_version = (0,15)
 
 def check_bzrlib_version(desired):
     """Check that bzrlib is compatible.

=== modified file 'checkout.py'
--- a/checkout.py	2007-01-15 00:39:37 +0000
+++ b/checkout.py	2007-01-18 13:19:14 +0000
@@ -421,8 +421,6 @@
         return revid
 
     def add(self, files, ids=None):
-        import pdb
-        pdb.set_trace()
         if ids:
             ids = copy(ids)
             ids.reverse()
@@ -595,7 +593,7 @@
         self.branch_path = svn_url[len(bzr_to_svn_url(self.svn_root_transport.base)):]
         self.scheme = BranchingScheme.guess_scheme(self.branch_path)
         mutter('scheme for %r is %r' % (self.branch_path, self.scheme))
-        if not self.scheme.is_branch(self.branch_path):
+        if not self.scheme.is_branch(self.branch_path) and not self.scheme.is_tag(self.branch_path):
             raise NotBranchError(path=self.transport.base)
 
     def clone(self, path):

=== modified file 'convert.py'
--- a/convert.py	2007-01-10 05:24:56 +0000
+++ b/convert.py	2007-01-18 13:19:14 +0000
@@ -107,7 +107,7 @@
         if create_shared_repo:
             try:
                 target_repos = get_dir("").open_repository()
-                assert scheme.is_branch("") or target_repos.is_shared()
+                assert scheme.is_branch("") or scheme.is_tag("") or target_repos.is_shared()
             except NoRepositoryPresent:
                 target_repos = get_dir("").create_repository(shared=True)
             target_repos.set_make_working_trees(working_trees)

=== modified file 'format.py'
--- a/format.py	2007-01-01 00:59:21 +0000
+++ b/format.py	2007-01-18 13:19:14 +0000
@@ -53,6 +53,7 @@
             self.scheme = scheme
 
         if (not self.scheme.is_branch(self.branch_path) and 
+            not self.scheme.is_tag(self.branch_path) and 
                 self.branch_path != ""):
             raise NotBranchError(path=self.root_transport.base)
 
@@ -130,7 +131,8 @@
     def open_branch(self, unsupported=True):
         """See BzrDir.open_branch()."""
 
-        if not self.scheme.is_branch(self.branch_path):
+        if not self.scheme.is_branch(self.branch_path) and \
+           not self.scheme.is_tag(self.branch_path):
             raise NotBranchError(path=self.root_transport.base)
 
         repos = self.find_repository()

=== modified file 'repository.py'
--- a/repository.py	2007-01-10 03:59:17 +0000
+++ b/repository.py	2007-01-18 13:19:14 +0000
@@ -467,7 +467,8 @@
     def follow_branch(self, branch_path, revnum):
         assert branch_path is not None
         assert isinstance(revnum, int) and revnum >= 0
-        if not self.scheme.is_branch(branch_path):
+        if not self.scheme.is_branch(branch_path) and \
+           not self.scheme.is_tag(branch_path):
             raise errors.NotSvnBranchPath(branch_path, revnum)
         branch_path = branch_path.strip("/")
 
@@ -482,7 +483,8 @@
                 paths[branch_path][0] in ('R', 'A')):
                 if paths[branch_path][1] is None:
                     return
-                if not self.scheme.is_branch(paths[branch_path][1]):
+                if not self.scheme.is_branch(paths[branch_path][1]) and \
+                   not self.scheme.is_tag(paths[branch_path][1]):
                     # FIXME: if copyfrom_path is not a branch path, 
                     # should simulate a reverse "split" of a branch
                     # for now, just make it look like the branch ended here
@@ -494,14 +496,16 @@
 
     def follow_branch_history(self, branch_path, revnum):
         assert branch_path is not None
-        if not self.scheme.is_branch(branch_path):
+        if not self.scheme.is_branch(branch_path) and \
+           not self.scheme.is_tag(branch_path):
             raise errors.NotSvnBranchPath(branch_path, revnum)
 
         for (bp, paths, revnum) in self._log.follow_path(branch_path, revnum):
             # FIXME: what if one of the parents of branch_path was moved?
             if (paths.has_key(bp) and 
-                paths[bp][1] is not None and
-                not self.scheme.is_branch(paths[bp][1])):
+                paths[bp][1] is not None and 
+                not self.scheme.is_branch(paths[bp][1]) and
+                not self.scheme.is_tag(paths[bp][1])):
                 # FIXME: if copyfrom_path is not a branch path, 
                 # should simulate a reverse "split" of a branch
                 # for now, just make it look like the branch ended here
@@ -560,14 +564,14 @@
             names = paths.keys()
             names.sort()
             for p in names:
-                if self.scheme.is_branch(p):
+                if self.scheme.is_branch(p) or self.scheme.is_tag(p):
                     if paths[p][0] in ('R', 'D'):
                         del created_branches[p]
                         yield (p, i, False)
 
                     if paths[p][0] in ('A', 'R'): 
                         created_branches[p] = i
-                elif self.scheme.is_branch_parent(p):
+                elif self.scheme.is_branch_parent(p) or self.scheme.is_tag_parent(p):
                     if paths[p][0] in ('R', 'D'):
                         k = created_branches.keys()
                         for c in k:
@@ -580,9 +584,9 @@
                             p = parents.pop()
                             for c in self.transport.get_dir(p, i)[0].keys():
                                 n = p+"/"+c
-                                if self.scheme.is_branch(n):
+                                if self.scheme.is_branch(n) or self.scheme.is_tag(n):
                                     created_branches[n] = i
-                                elif self.scheme.is_branch_parent(n):
+                                elif self.scheme.is_branch_parent(n) or self.scheme.is_tag_parent(n):
                                     parents.append(n)
 
         for p in created_branches:

=== modified file 'scheme.py'
--- a/scheme.py	2007-01-14 04:11:21 +0000
+++ b/scheme.py	2007-01-18 13:19:14 +0000
@@ -67,8 +67,25 @@
         return None
 
     def is_branch_parent(self, path):
-        raise NotImplementedError
-                
+        """Check whether the specified path is the parent directory of branches.
+        The path may not be a branch itself.
+        
+        :param path: path to check
+        :returns: boolean
+        """
+        raise NotImplementedError
+
+    def is_tag_parent(self, path):
+        """Check whether the specified path is the parent directory of tags.
+        The path may not be a tag itself.
+        
+        :param path: path to check
+        :returns: boolean
+        """
+        raise NotImplementedError
+
+    def is_tag(self, path):
+        raise NotImplementedError
 
 class TrunkBranchingScheme(BranchingScheme):
     """Standard Subversion repository layout. Each project contains three 
@@ -83,8 +100,16 @@
         if len(parts) == self.level+1 and parts[self.level] == "trunk":
             return True
 
+        if len(parts) == self.level+2 and parts[self.level] == "branches":
+            return True
+
+        return False
+
+    def is_tag(self, path):
+        """See BranchingScheme.is_branch()."""
+        parts = path.strip("/").split("/")
         if len(parts) == self.level+2 and \
-           (parts[self.level] == "branches" or parts[self.level] == "tags"):
+           (parts[self.level] == "tags"):
             return True
 
         return False
@@ -114,6 +139,10 @@
             return True
         return self.is_branch(path+"/trunk")
 
+    def is_tag_parent(self, path):
+        parts = path.strip("/").split("/")
+        return self.is_tag(path+"/aname")
+
 class NoBranchingScheme(BranchingScheme):
     """Describes a scheme where there is just one branch, the 
     root of the repository."""
@@ -121,6 +150,9 @@
         """See BranchingScheme.is_branch()."""
         return path.strip("/") == ""
 
+    def is_tag(self, path):
+        return False
+
     def unprefix(self, path):
         """See BranchingScheme.unprefix()."""
         return ("", path.strip("/"))
@@ -131,6 +163,9 @@
     def is_branch_parent(self, path):
         return False
 
+    def is_tag_parent(self, path):
+        return False
+
 
 class ListBranchingScheme(BranchingScheme):
     def __init__(self, branch_list):
@@ -142,6 +177,10 @@
         for p in branch_list:
             self.branch_list.append(p.strip("/"))
 
+    def is_tag(self, path):
+        """See BranchingScheme.is_tag()."""
+        return False
+
     def is_branch(self, path):
         """See BranchingScheme.is_branch()."""
         return path.strip("/") in self.branch_list

=== modified file 'tests/test_scheme.py'
--- a/tests/test_scheme.py	2007-01-03 07:13:12 +0000
+++ b/tests/test_scheme.py	2007-01-18 13:19:14 +0000
@@ -24,10 +24,17 @@
     def test_is_branch(self):
         self.assertRaises(NotImplementedError, BranchingScheme().is_branch, "")
 
+    def test_is_tag(self):
+        self.assertRaises(NotImplementedError, BranchingScheme().is_tag, "")
+
     def test_is_branch_parent(self):
         self.assertRaises(NotImplementedError, 
                 BranchingScheme().is_branch_parent, "")
 
+    def test_is_tag_parent(self):
+        self.assertRaises(NotImplementedError, 
+                BranchingScheme().is_tag_parent, "")
+
     def test_unprefix(self):
         self.assertRaises(NotImplementedError, 
                 BranchingScheme().unprefix, "")
@@ -89,6 +96,12 @@
     def test_is_branch_dir_doubleslash(self):
         self.assertFalse(NoBranchingScheme().is_branch("//foo/bar"))
 
+    def test_is_tag_empty(self):
+        self.assertFalse(NoBranchingScheme().is_tag(""))
+
+    def test_is_tag_slash(self):
+        self.assertFalse(NoBranchingScheme().is_tag("/"))
+
     def test_unprefix(self):
         self.assertEqual(NoBranchingScheme().unprefix(""), ("", ""))
 
@@ -107,10 +120,26 @@
     def test_is_branch_parent_other(self):
         self.assertFalse(NoBranchingScheme().is_branch_parent("trunk/foo"))
 
+    def test_is_tag_parent_root(self):
+        self.assertFalse(NoBranchingScheme().is_tag_parent(""))
+
+    def test_is_tag_parent_other(self):
+        self.assertFalse(NoBranchingScheme().is_tag_parent("trunk/foo"))
+
+
 class ListScheme(TestCase):
     def setUp(self):
         self.scheme = ListBranchingScheme(["foo", "bar/bloe"])
 
+    def test_is_tag_empty(self):
+        self.assertFalse(self.scheme.is_tag(""))
+
+    def test_is_tag_sub(self):
+        self.assertFalse(self.scheme.is_tag("foo"))
+
+    def test_is_tag_tag(self):
+        self.assertFalse(self.scheme.is_tag("tags/foo"))
+
     def test_is_branch_empty(self):
         self.assertFalse(self.scheme.is_branch(""))
 
@@ -193,6 +222,9 @@
     def test_is_branch_trunk(self):
         self.assertTrue(TrunkBranchingScheme().is_branch("/trunk/"))
 
+    def test_is_branch_tag(self):
+        self.assertFalse(TrunkBranchingScheme().is_branch("tags/foo"))
+
     def test_is_branch_trunk_slashes(self):
         self.assertTrue(TrunkBranchingScheme().is_branch("////trunk"))
 
@@ -217,6 +249,21 @@
     def test_is_branch_branches(self):
         self.assertFalse(TrunkBranchingScheme().is_branch("/branches"))
 
+    def test_is_tag_empty(self):
+        self.assertFalse(TrunkBranchingScheme().is_tag(""))
+
+    def test_is_tag_sub(self):
+        self.assertFalse(TrunkBranchingScheme().is_tag("foo"))
+
+    def test_is_tag_tag(self):
+        self.assertTrue(TrunkBranchingScheme().is_tag("tags/foo"))
+
+    def test_is_tag_tag_slash(self):
+        self.assertTrue(TrunkBranchingScheme().is_tag("tags/branches/"))
+
+    def test_is_tag_nested(self):
+        self.assertFalse(TrunkBranchingScheme().is_tag("tags/foo/bla"))
+
     def test_is_branch_level(self):
         scheme = TrunkBranchingScheme(2)
         self.assertFalse(scheme.is_branch("/trunk/"))
@@ -304,15 +351,30 @@
     def test_is_branch_parent_root(self):
         self.assertTrue(TrunkBranchingScheme().is_branch_parent(""))
 
+    def test_is_tag_parent_root(self):
+        self.assertFalse(TrunkBranchingScheme().is_tag_parent(""))
+
     def test_is_branch_parent_branches(self):
         self.assertTrue(TrunkBranchingScheme().is_branch_parent("branches"))
 
+    def test_is_tagparent_branches(self):
+        self.assertFalse(TrunkBranchingScheme().is_tag_parent("branches"))
+
+    def test_is_tagparent_tags(self):
+        self.assertTrue(TrunkBranchingScheme().is_tag_parent("tags"))
+
+    def test_is_branch_parent_tags(self):
+        self.assertFalse(TrunkBranchingScheme().is_branch_parent("tags"))
+
     def test_is_branch_parent_trunk(self):
         self.assertFalse(TrunkBranchingScheme().is_branch_parent("trunk"))
 
     def test_is_branch_parent_level(self):
         self.assertTrue(TrunkBranchingScheme(1).is_branch_parent("anything"))
 
+    def test_is_tag_parent_level(self):
+        self.assertFalse(TrunkBranchingScheme(1).is_tag_parent("anything"))
+
     def test_is_branch_parent_level_root(self):
         self.assertTrue(TrunkBranchingScheme(1).is_branch_parent(""))
 
@@ -325,5 +387,8 @@
     def test_is_branch_parent_level_branches(self):
         self.assertTrue(TrunkBranchingScheme(1).is_branch_parent("anything/branches"))
 
+    def test_is_tag_parent_level_tags(self):
+        self.assertTrue(TrunkBranchingScheme(1).is_tag_parent("anything/tags"))
+
     def test_is_branch_parent_other(self):
         self.assertFalse(TrunkBranchingScheme().is_branch_parent("trunk/foo"))

=== modified file 'transport.py'
--- a/transport.py	2007-01-14 23:38:09 +0000
+++ b/transport.py	2007-01-17 14:07:01 +0000
@@ -94,7 +94,7 @@
     """Fake transport for Subversion-related namespaces.
     
     This implements just as much of Transport as is necessary 
-    to fool Bazaar-NG. """
+    to fool Bazaar. """
     def __init__(self, url=""):
         self.pool = Pool()
         self.is_locked = False




More information about the bazaar-commits mailing list