Rev 591: Merge upstream. in file:///data/jelmer/bzr-svn/revprops/

Jelmer Vernooij jelmer at samba.org
Thu Nov 15 22:07:23 GMT 2007


At file:///data/jelmer/bzr-svn/revprops/

------------------------------------------------------------
revno: 591
revision-id:jelmer at samba.org-20071115220722-em1nrxf9nzpsl11o
parent: jelmer at samba.org-20071112020141-td2hc8j31wphbnab
parent: jelmer at samba.org-20071115215733-wirqr6dc6ooufd2p
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: revprops
timestamp: Thu 2007-11-15 23:07:22 +0100
message:
  Merge upstream.
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  README                         README-20051120210643-bd274a2fef9aed6a
  mapping.txt                    mapping.txt-20060625151311-9ghaqrm71ajq593n-1
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
  revspec.py                     revspec.py-20071106211507-q4fz2en91yrmjjl8-1
  tests/test_blackbox.py         test_blackbox.py-20070325150839-d10llf8arptpcfl6-1
  tests/test_checkout.py         test_checkout.py-20070101154110-eevkc29qj0q7udz5-1
  tests/test_repos.py            test_repos.py-20060508151940-ddc49a59257ca712
  tests/test_revspec.py          test_revspec.py-20071111183646-0wohlrzaevdsr9ia-1
  transport.py                   transport.py-20060406231150-b3472d06b3a0818d
    ------------------------------------------------------------
    revno: 579.1.213
    revision-id:jelmer at samba.org-20071115215733-wirqr6dc6ooufd2p
    parent: jelmer at samba.org-20071113232215-fjvnf2ul71iqjb1a
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Thu 2007-11-15 22:57:33 +0100
    message:
      Give proper error when revspec is used against non-svn branch.
    modified:
      README                         README-20051120210643-bd274a2fef9aed6a
      revspec.py                     revspec.py-20071106211507-q4fz2en91yrmjjl8-1
      tests/test_revspec.py          test_revspec.py-20071111183646-0wohlrzaevdsr9ia-1
    ------------------------------------------------------------
    revno: 579.1.212
    revision-id:jelmer at samba.org-20071113232215-fjvnf2ul71iqjb1a
    parent: jelmer at samba.org-20071113231302-w8h4md9l8djzw4l3
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Wed 2007-11-14 00:22:15 +0100
    message:
      Update NEWs.
    modified:
      NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
    ------------------------------------------------------------
    revno: 579.1.211
    revision-id:jelmer at samba.org-20071113231302-w8h4md9l8djzw4l3
    parent: jelmer at samba.org-20071113225251-09cfqjwokfm7gl1z
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Wed 2007-11-14 00:13:02 +0100
    message:
      Don't treat files as branches.
    modified:
      repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
    ------------------------------------------------------------
    revno: 579.1.210
    revision-id:jelmer at samba.org-20071113225251-09cfqjwokfm7gl1z
    parent: jelmer at samba.org-20071113224056-0wjg3ajo5eos4d1s
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Tue 2007-11-13 23:52:51 +0100
    message:
      Handle strange directory moves.
    modified:
      repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
      tests/test_repos.py            test_repos.py-20060508151940-ddc49a59257ca712
    ------------------------------------------------------------
    revno: 579.1.209
    revision-id:jelmer at samba.org-20071113224056-0wjg3ajo5eos4d1s
    parent: jelmer at samba.org-20071113191850-n0300pavw0juspeu
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Tue 2007-11-13 23:40:56 +0100
    message:
      Don't bail out if parent of file is moved, and file passes branch path test.
    modified:
      repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
      tests/test_repos.py            test_repos.py-20060508151940-ddc49a59257ca712
      transport.py                   transport.py-20060406231150-b3472d06b3a0818d
    ------------------------------------------------------------
    revno: 579.1.208
    revision-id:jelmer at samba.org-20071113191850-n0300pavw0juspeu
    parent: jelmer at samba.org-20071113173702-4mobk9ihzk07tt9a
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Tue 2007-11-13 20:18:50 +0100
    message:
      Fix formatting.
    modified:
      mapping.txt                    mapping.txt-20060625151311-9ghaqrm71ajq593n-1
    ------------------------------------------------------------
    revno: 579.1.207
    revision-id:jelmer at samba.org-20071113173702-4mobk9ihzk07tt9a
    parent: jelmer at samba.org-20071111234001-90w12kvxrrgmlpgf
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Tue 2007-11-13 18:37:02 +0100
    message:
      More tests.
    modified:
      tests/test_blackbox.py         test_blackbox.py-20070325150839-d10llf8arptpcfl6-1
      tests/test_checkout.py         test_checkout.py-20070101154110-eevkc29qj0q7udz5-1
=== modified file 'NEWS'
--- a/NEWS	2007-11-11 23:40:01 +0000
+++ b/NEWS	2007-11-13 23:22:15 +0000
@@ -8,12 +8,14 @@
 
    * No longer store svn:author, svn:date and svn:log in the bzr-svn cache. 
      This should make it easier to use bzr-specific revprops later on and 
-	 saves some disk space.
+     saves some disk space.
 
   BUG FIXES
 
    * Properly decode unicode commit messages. 
 
+   * Handle some corner cases when finding branches.
+
 bzr-svn 0.4.4	2007-11-02
 
   PERFORMANCE

=== modified file 'README'
--- a/README	2007-11-11 19:16:06 +0000
+++ b/README	2007-11-15 21:57:33 +0000
@@ -132,8 +132,7 @@
   information in Subversion, something which the Subversion folks are working 
   on at the moment (see https://svn.collab.net/repos/svn/branches/merge-tracking).
 
-  Might require cherry-picking support in Bazaar (or at least the ability 
-  to know about cherry picks). 
+  Requires tracking cherry-picking support in Bazaar:
    
   Spec at https://launchpad.net/products/bzr/+spec/bzr-cpick-data
 

=== modified file 'mapping.txt'
--- a/mapping.txt	2007-11-11 19:16:06 +0000
+++ b/mapping.txt	2007-11-13 19:18:50 +0000
@@ -3,6 +3,7 @@
 This document specifies mapping between Subversion and Bazaar semantics.
 
 Revision: 4
+
 Written by Jelmer Vernooij <jelmer at samba.org>
 
 ============
@@ -26,8 +27,7 @@
 - ListBranchingScheme: There is a list of branches. This branching 
   scheme is present in the code, but is never used automatically (yet).
 
-- SingleBranchingScheme: There is a single branch (path of that branch is also 
-	part of the scheme name).
+- SingleBranchingScheme: There is a single branch (path of that branch is also part of the scheme name).
 
 The branching scheme can be explicitly specified or automatically guessed. 
 
@@ -40,7 +40,7 @@
 
 However, this can lead to overlap in revision ids when a commit touches more 
 then one branch (something that is possible in SVN). This can be fixed by 
-including the branch path (trunk, branches/SAMBA_4_0, etc) in the 
+including the branch path (``trunk``, ``branches/SAMBA_4_0``, etc) in the 
 revision-id. Example revision id:
 
 ``svn-v3-trunk0:0c0555d6-39d7-0310-84fc-f1cc0bd64818:trunk:14323``
@@ -66,16 +66,17 @@
 
 To override the revision id this way, set the branch path file property:
 
-bzr:revision-id-v%d:%s (where %d is the current mapping version and %s is 
-					    the name of the branching scheme in use) 
+``bzr:revision-id-v%d:%s`` (where %d is the current mapping version and %s is 
+                            the name of the branching scheme in use) 
 
 to the bzr revision number following by a space and the revision id. This 
 property should only be honored for the revision in which it was set, as 
 subversion will not erase the property for subsequent commits.
 
 A (path,revnum) tuple is valid if:
-* path is valid according to the branching scheme
-* either path, revnum or one of its children was touched in the particular 
+
+- path is valid according to the branching scheme
+- either path, revnum or one of its children was touched in the particular 
   revision
 
 If possible, the Subversion revision property ``bzr:revision-id`` should be 

=== modified file 'repository.py'
--- a/repository.py	2007-11-12 02:01:41 +0000
+++ b/repository.py	2007-11-15 22:07:22 +0000
@@ -772,12 +772,15 @@
             for (branch, revno, _) in self.find_branches(scheme, last_revnum):
                 # Look at their bzr:revision-id-vX
                 revids = []
-                for line in self.branchprop_list.get_property(branch, revno, 
-                        SVN_PROP_BZR_REVISION_ID+str(scheme), "").splitlines():
-                    try:
-                        revids.append(parse_revid_property(line))
-                    except errors.InvalidPropertyValue, ie:
-                        mutter(str(ie))
+                try:
+                    for line in self.branchprop_list.get_property(branch, revno, 
+                            SVN_PROP_BZR_REVISION_ID+str(scheme), "").splitlines():
+                        try:
+                            revids.append(parse_revid_property(line))
+                        except errors.InvalidPropertyValue, ie:
+                            mutter(str(ie))
+                except SubversionException, (_, svn.core.SVN_ERR_FS_NOT_DIRECTORY):
+                    continue
 
                 # If there are any new entries that are not yet in the cache, 
                 # add them
@@ -1053,7 +1056,7 @@
                 paths = self._log.get_revision_paths(i)
                 for p in sorted(paths.keys()):
                     if scheme.is_branch(p) or scheme.is_tag(p):
-                        if paths[p][0] in ('R', 'D'):
+                        if paths[p][0] in ('R', 'D') and p in created_branches:
                             del created_branches[p]
                             j = self._log.find_latest_change(p, i-1, 
                                 include_parents=True, include_children=True)
@@ -1066,7 +1069,7 @@
                         if paths[p][0] in ('R', 'D'):
                             k = created_branches.keys()
                             for c in k:
-                                if c.startswith(p+"/"):
+                                if c.startswith(p+"/") and c in created_branches:
                                     del created_branches[c] 
                                     j = self._log.find_latest_change(c, i-1, 
                                             include_parents=True, 
@@ -1076,13 +1079,16 @@
                             parents = [p]
                             while parents:
                                 p = parents.pop()
-                                for c in self.transport.get_dir(p, i)[0].keys():
-                                    n = p+"/"+c
-                                    if scheme.is_branch(n) or scheme.is_tag(n):
-                                        created_branches[n] = i
-                                    elif (scheme.is_branch_parent(n) or 
-                                          scheme.is_tag_parent(n)):
-                                        parents.append(n)
+                                try:
+                                    for c in self.transport.get_dir(p, i)[0].keys():
+                                        n = p+"/"+c
+                                        if scheme.is_branch(n) or scheme.is_tag(n):
+                                            created_branches[n] = i
+                                        elif (scheme.is_branch_parent(n) or 
+                                              scheme.is_tag_parent(n)):
+                                            parents.append(n)
+                                except SubversionException, (_, svn.core.SVN_ERR_FS_NOT_DIRECTORY):
+                                    pass
         finally:
             pb.finished()
 

=== modified file 'revspec.py'
--- a/revspec.py	2007-11-11 19:15:40 +0000
+++ b/revspec.py	2007-11-15 21:57:33 +0000
@@ -15,16 +15,27 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 """Custom revision specifier for Subversion."""
 
-from bzrlib.errors import InvalidRevisionSpec
+from bzrlib.errors import BzrError, InvalidRevisionSpec
 from bzrlib.revisionspec import RevisionSpec, RevisionInfo
 
 class RevisionSpec_svn(RevisionSpec):
     """Selects a revision using a Subversion revision number."""
+
+    help_txt = """Selects a revision using a Subversion revision number (revno).
+
+    Subversion revision numbers are per-repository whereas Bazaar revision 
+    numbers are per-branch. This revision specifier allows specifying 
+    a Subversion revision number.
+
+    This only works directly against Subversion branches.
+    """
     
     prefix = 'svn:'
 
     def _match_on(self, branch, revs):
         loc = self.spec.find(':')
+        if not hasattr(branch.repository, 'uuid'):
+            raise BzrError("the svn: revisionspec can only be used with Subversion branches")
         try:
             return RevisionInfo.from_revision_id(branch, branch.generate_revision_id(int(self.spec[loc+1:])), branch.revision_history())
         except ValueError:

=== modified file 'tests/test_blackbox.py'
--- a/tests/test_blackbox.py	2007-09-26 11:45:50 +0000
+++ b/tests/test_blackbox.py	2007-11-13 17:37:02 +0000
@@ -210,3 +210,11 @@
         self.check_output(
                 "Repository branch (format: subversion)\nLocation:\n  shared repository: a\n  repository branch: a\n\nRelated branches:\n  parent branch: a\n", 'info a')
 
+    def test_lightweight_checkout_lightweight_checkout(self):
+        repos_url = self.make_client("a", "dc")
+        self.build_tree({'dc/foo': "test", 'dc/bla': "ha"})
+        self.client_add("dc/foo")
+        self.client_add("dc/bla")
+        self.client_commit("dc", "Msg")
+        self.run_bzr("checkout --lightweight dc de")
+

=== modified file 'tests/test_checkout.py'
--- a/tests/test_checkout.py	2007-10-29 16:37:13 +0000
+++ b/tests/test_checkout.py	2007-11-13 17:37:02 +0000
@@ -16,6 +16,7 @@
 
 """Checkout tests."""
 
+from bzrlib.branch import Branch
 from bzrlib.bzrdir import BzrDir
 from bzrlib.errors import NoRepositoryPresent, UninitializableFormat
 from bzrlib.tests import TestCase
@@ -79,3 +80,9 @@
         x = self.open_checkout_bzrdir("dc")
         self.assertFalse(x.needs_format_conversion(SvnWorkingTreeDirFormat()))
         
+    def test_checkout_checkout(self):
+        """Test making a checkout of a checkout."""
+        self.make_client("d", "dc")
+        x = Branch.open("dc")
+        x.create_checkout("de", lightweight=True)
+

=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py	2007-11-05 13:46:26 +0000
+++ b/tests/test_repos.py	2007-11-13 22:52:51 +0000
@@ -299,6 +299,34 @@
                           ("tags/brancha", 2, True)], 
                 list(repos.find_branches(TrunkBranchingScheme(), 2)))
 
+    def test_find_branches_file_moved_from_nobranch(self):
+        repos_url = self.make_client("a", "dc")
+        self.build_tree({
+            'dc/tmp/trunk': None,
+            'dc/bla/somefile': "contents"})
+        self.client_add("dc/tmp")
+        self.client_add("dc/bla")
+        self.client_commit("dc", "My Message")
+        self.client_copy("dc/bla", "dc/tmp/branches")
+        self.client_delete("dc/tmp/branches/somefile")
+        self.client_commit("dc", "My Message 2")
+
+        Repository.open(repos_url).find_branches(TrunkBranchingScheme(2))
+
+    def test_find_branches_deleted_from_nobranch(self):
+        repos_url = self.make_client("a", "dc")
+        self.build_tree({
+            'dc/tmp/trunk': None,
+            'dc/bla/somefile': "contents"})
+        self.client_add("dc/tmp")
+        self.client_add("dc/bla")
+        self.client_commit("dc", "My Message")
+        self.client_copy("dc/bla", "dc/tmp/branches")
+        self.client_delete("dc/tmp/branches/somefile")
+        self.client_commit("dc", "My Message 2")
+
+        Repository.open(repos_url).find_branches(TrunkBranchingScheme(1))
+
     def test_find_branches_moved_nobranch(self):
         repos_url = self.make_client("a", "dc")
         self.build_tree({

=== modified file 'tests/test_revspec.py'
--- a/tests/test_revspec.py	2007-11-11 19:15:40 +0000
+++ b/tests/test_revspec.py	2007-11-15 21:57:33 +0000
@@ -18,7 +18,8 @@
 """
 
 from bzrlib.branch import Branch
-from bzrlib.errors import InvalidRevisionSpec
+from bzrlib.bzrdir import BzrDir
+from bzrlib.errors import BzrError, InvalidRevisionSpec
 from bzrlib.revisionspec import RevisionSpec, RevisionInfo
 from bzrlib.tests import TestCase
 
@@ -63,3 +64,8 @@
         branch = Branch.open(repos_url)
 
         self.assertRaises(InvalidRevisionSpec, revspec._match_on, branch, None)
+
+    def test_non_svn_branch(self):
+        revspec = RevisionSpec.from_string("svn:0")
+        branch = BzrDir.create_standalone_workingtree("a").branch
+        self.assertRaises(BzrError, revspec._match_on, branch, None)

=== modified file 'transport.py'
--- a/transport.py	2007-11-11 17:44:48 +0000
+++ b/transport.py	2007-11-13 22:40:56 +0000
@@ -85,9 +85,10 @@
     """
     def convert(self, *args, **kwargs):
         self._mark_busy()
-        ret = unbound(self, *args, **kwargs)
-        self._unmark_busy()
-        return ret
+        try:
+            return unbound(self, *args, **kwargs)
+        finally:
+            self._unmark_busy()
 
     convert.__doc__ = unbound.__doc__
     convert.__name__ = unbound.__name__




More information about the bazaar-commits mailing list