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

Jelmer Vernooij jelmer at samba.org
Mon Nov 12 02:01:43 GMT 2007


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

------------------------------------------------------------
revno: 590
revision-id:jelmer at samba.org-20071112020141-td2hc8j31wphbnab
parent: jelmer at samba.org-20071112020105-ju2e7pjek6xne3ep
parent: jelmer at samba.org-20071111234001-90w12kvxrrgmlpgf
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: revprops
timestamp: Mon 2007-11-12 03:01:41 +0100
message:
  Merge upstream.
added:
  revspec.py                     revspec.py-20071106211507-q4fz2en91yrmjjl8-1
  tests/test_revspec.py          test_revspec.py-20071111183646-0wohlrzaevdsr9ia-1
modified:
  FAQ                            faq-20070910195147-p9u38s9wplds2d4o-1
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  README                         README-20051120210643-bd274a2fef9aed6a
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
  commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
  logwalker.py                   logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
  mapping.txt                    mapping.txt-20060625151311-9ghaqrm71ajq593n-1
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
  tests/__init__.py              __init__.py-20060508151940-e9f4d914801a2535
    ------------------------------------------------------------
    revno: 579.1.206
    revision-id:jelmer at samba.org-20071111234001-90w12kvxrrgmlpgf
    parent: jelmer at samba.org-20071105215901-08x3gskddm2gvztj
    parent: jelmer at samba.org-20071111191606-f3rvyrgoio1p75tf
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Mon 2007-11-12 00:40:01 +0100
    message:
      Merge upstream.
    added:
      revspec.py                     revspec.py-20071106211507-q4fz2en91yrmjjl8-1
      tests/test_revspec.py          test_revspec.py-20071111183646-0wohlrzaevdsr9ia-1
    modified:
      NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
      README                         README-20051120210643-bd274a2fef9aed6a
      __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
      mapping.txt                    mapping.txt-20060625151311-9ghaqrm71ajq593n-1
      tests/__init__.py              __init__.py-20060508151940-e9f4d914801a2535
        ------------------------------------------------------------
        revno: 579.1.205.1.3
        revision-id:jelmer at samba.org-20071111191606-f3rvyrgoio1p75tf
        parent: jelmer at samba.org-20071111174448-7eer6jy2q9t0tm98
        parent: jelmer at samba.org-20071111191540-2h3pnau7nmj0ocr3
        committer: Jelmer Vernooij <jelmer at samba.org>
        branch nick: 0.4
        timestamp: Sun 2007-11-11 20:16:06 +0100
        message:
          Merge revision specifier support.
        added:
          revspec.py                     revspec.py-20071106211507-q4fz2en91yrmjjl8-1
          tests/test_revspec.py          test_revspec.py-20071111183646-0wohlrzaevdsr9ia-1
        modified:
          NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
          __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
          tests/__init__.py              __init__.py-20060508151940-e9f4d914801a2535
            ------------------------------------------------------------
            revno: 579.1.205.2.2
            revision-id:jelmer at samba.org-20071111191540-2h3pnau7nmj0ocr3
            parent: jelmer at samba.org-20071106211748-ey87ehmncudxo8o6
            committer: Jelmer Vernooij <jelmer at samba.org>
            branch nick: revspec
            timestamp: Sun 2007-11-11 20:15:40 +0100
            message:
              Add revision specifier support.
            added:
              tests/test_revspec.py          test_revspec.py-20071111183646-0wohlrzaevdsr9ia-1
            modified:
              NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
              README                         README-20051120210643-bd274a2fef9aed6a
              __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
              mapping.txt                    mapping.txt-20060625151311-9ghaqrm71ajq593n-1
              revspec.py                     revspec.py-20071106211507-q4fz2en91yrmjjl8-1
              tests/__init__.py              __init__.py-20060508151940-e9f4d914801a2535
            ------------------------------------------------------------
            revno: 579.1.205.2.1
            revision-id:jelmer at samba.org-20071106211748-ey87ehmncudxo8o6
            parent: jelmer at samba.org-20071105215901-08x3gskddm2gvztj
            committer: Jelmer Vernooij <jelmer at samba.org>
            branch nick: revspec
            timestamp: Tue 2007-11-06 22:17:48 +0100
            message:
              Start working on revspec.
            added:
              revspec.py                     revspec.py-20071106211507-q4fz2en91yrmjjl8-1
        ------------------------------------------------------------
        revno: 579.1.205.1.2
        revision-id:jelmer at samba.org-20071111174448-7eer6jy2q9t0tm98
        parent: jelmer at samba.org-20071111174053-w89kva36qxviiqa2
        parent: jelmer at samba.org-20070805002307-8ugwip3gb6a9jvrk
        committer: Jelmer Vernooij <jelmer at samba.org>
        branch nick: 0.4
        timestamp: Sun 2007-11-11 18:44:48 +0100
        message:
          Merge replay branch.
            ------------------------------------------------------------
            revno: 402.1.40.1.2
            revision-id:jelmer at samba.org-20070805002307-8ugwip3gb6a9jvrk
            parent: jelmer at samba.org-20070403232158-vo06rjr59iuvpw8o
            committer: Jelmer Vernooij <jelmer at samba.org>
            branch nick: replay
            timestamp: Sun 2007-08-05 02:23:07 +0200
            message:
              Improve formatting.
            modified:
              transport.py                   transport.py-20060406231150-b3472d06b3a0818d
            ------------------------------------------------------------
            revno: 402.1.40.1.1
            revision-id:jelmer at samba.org-20070403232158-vo06rjr59iuvpw8o
            parent: jelmer at samba.org-20070403203246-0tnykd16qpi4uy3n
            committer: Jelmer Vernooij <jelmer at samba.org>
            branch nick: replay
            timestamp: Wed 2007-04-04 01:21:58 +0200
            message:
              Add replay function.
            modified:
              transport.py                   transport.py-20060406231150-b3472d06b3a0818d
        ------------------------------------------------------------
        revno: 579.1.205.1.1
        revision-id:jelmer at samba.org-20071111174053-w89kva36qxviiqa2
        parent: jelmer at samba.org-20071105215901-08x3gskddm2gvztj
        committer: Jelmer Vernooij <jelmer at samba.org>
        branch nick: 0.4
        timestamp: Sun 2007-11-11 18:40:53 +0100
        message:
          documentation fixes
        modified:
          README                         README-20051120210643-bd274a2fef9aed6a
          mapping.txt                    mapping.txt-20060625151311-9ghaqrm71ajq593n-1
    ------------------------------------------------------------
    revno: 579.1.205
    revision-id:jelmer at samba.org-20071105215901-08x3gskddm2gvztj
    parent: jelmer at samba.org-20071105151122-u2mixizsofnyx5n0
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Mon 2007-11-05 22:59:01 +0100
    message:
      Implement custom get_parents() - avoids a lot of get_revision() calls.
    modified:
      FAQ                            faq-20070910195147-p9u38s9wplds2d4o-1
      commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
      repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
    ------------------------------------------------------------
    revno: 579.1.204
    revision-id:jelmer at samba.org-20071105151122-u2mixizsofnyx5n0
    parent: jelmer at samba.org-20071105135214-1ka981pdv23k47db
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Mon 2007-11-05 16:11:22 +0100
    message:
      Get rid of now obsolete 'revision' table in cache.
    modified:
      AUTHORS                        AUTHORS-20060508114718-4c90c0062645106d
      logwalker.py                   logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
=== added file 'revspec.py'
--- a/revspec.py	1970-01-01 00:00:00 +0000
+++ b/revspec.py	2007-11-11 19:15:40 +0000
@@ -0,0 +1,37 @@
+# Copyright (C) 2007 Jelmer Vernooij <jelmer at samba.org>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+"""Custom revision specifier for Subversion."""
+
+from bzrlib.errors import InvalidRevisionSpec
+from bzrlib.revisionspec import RevisionSpec, RevisionInfo
+
+class RevisionSpec_svn(RevisionSpec):
+    """Selects a revision using a Subversion revision number."""
+    
+    prefix = 'svn:'
+
+    def _match_on(self, branch, revs):
+        loc = self.spec.find(':')
+        try:
+            return RevisionInfo.from_revision_id(branch, branch.generate_revision_id(int(self.spec[loc+1:])), branch.revision_history())
+        except ValueError:
+            raise InvalidRevisionSpec(self.user_spec, branch)
+
+    def needs_branch(self):
+        return True
+
+    def get_branch(self):
+        return None

=== added file 'tests/test_revspec.py'
--- a/tests/test_revspec.py	1970-01-01 00:00:00 +0000
+++ b/tests/test_revspec.py	2007-11-11 19:15:40 +0000
@@ -0,0 +1,65 @@
+# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer at samba.org>
+ 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""
+Tests for revision specificiers.
+"""
+
+from bzrlib.branch import Branch
+from bzrlib.errors import InvalidRevisionSpec
+from bzrlib.revisionspec import RevisionSpec, RevisionInfo
+from bzrlib.tests import TestCase
+
+from tests import TestCaseWithSubversionRepository
+
+
+class TestRevSpec(TestCase):
+    def test_present(self):
+        self.assertIsNot(None, RevisionSpec.from_string("svn:foo"))
+
+    def test_needs_branch(self):
+        self.assertTrue(RevisionSpec.from_string("svn:foo").needs_branch())
+
+    def test_get_branch(self):
+        self.assertIs(None, RevisionSpec.from_string("svn:foo").get_branch())
+
+
+class TestRevSpecsBySubversion(TestCaseWithSubversionRepository):
+    def test_by_single_revno(self):
+        revspec = RevisionSpec.from_string("svn:2")
+        repos_url = self.make_client("a", "dc")
+        self.build_tree({"dc/foo": "foo"})
+        self.client_add("dc/foo")
+        self.client_commit("dc", "msg")
+
+        self.build_tree({"dc/bar": "bar"})
+        self.client_add("dc/bar")
+        self.client_commit("dc", "msg2")
+
+        branch = Branch.open(repos_url)
+        revinfo = revspec._match_on(branch, None)
+
+        self.assertEquals(RevisionInfo.from_revision_id(branch, branch.last_revision(), branch.revision_history()), revinfo)
+
+    def test_invalid_revnum(self):
+        revspec = RevisionSpec.from_string("svn:foo")
+        repos_url = self.make_client("a", "dc")
+        self.build_tree({"dc/bar": "bar"})
+        self.client_add("dc/bar")
+        self.client_commit("dc", "msg2")
+
+        branch = Branch.open(repos_url)
+
+        self.assertRaises(InvalidRevisionSpec, revspec._match_on, branch, None)

=== modified file 'FAQ'
--- a/FAQ	2007-11-03 18:50:48 +0000
+++ b/FAQ	2007-11-05 21:59:01 +0000
@@ -1,3 +1,5 @@
+#FORMAT rst
+
 =================================================================
 Bazaar is using a lot of memory accessing a Subversion repository
 =================================================================
@@ -90,10 +92,10 @@
 You also need to enable support for this in bzr-svn by setting 
 override-svn-revprops to True in ~/.bazaar/bazaar.conf.
 
-==================================================================
-I converted my Subversion repository using svn-import, but now all 
-branches are empty!
-==================================================================
+======================================================================================
+I converted my Subversion repository using svn-import, but now all branches are empty!
+======================================================================================
+
 bzr-svn does not create working trees by default. If you need 
 the working trees, run "bzr checkout" in the branch or 
 specify --trees to svn-import.

=== modified file 'NEWS'
--- a/NEWS	2007-11-05 13:46:26 +0000
+++ b/NEWS	2007-11-11 23:40:01 +0000
@@ -1,5 +1,9 @@
 bzr-svn 0.4.5	UNRELEASED
 
+  IMPROVEMENTS
+
+   * Add revision specifier for "svn:" that accepts a single revision number. (#160605)
+
   INTERNALS
 
    * No longer store svn:author, svn:date and svn:log in the bzr-svn cache. 

=== modified file 'README'
--- a/README	2007-10-30 11:44:36 +0000
+++ b/README	2007-11-11 19:16:06 +0000
@@ -1,3 +1,5 @@
+#FORMAT rst
+
 ============
 Introduction
 ============

=== modified file '__init__.py'
--- a/__init__.py	2007-11-02 14:35:21 +0000
+++ b/__init__.py	2007-11-11 19:15:40 +0000
@@ -21,10 +21,12 @@
 from bzrlib.bzrdir import BzrDirFormat, format_registry
 from bzrlib.commands import Command, register_command, display_command, Option
 from bzrlib.help_topics import topic_registry
+from bzrlib.revisionspec import SPEC_TYPES
 from bzrlib.trace import warning
 from bzrlib.transport import register_lazy_transport, register_transport_proto
 
 import format
+import revspec
 
 # versions ending in 'exp' mean experimental mappings
 # versions ending in 'dev' mean development version
@@ -111,6 +113,7 @@
 format_registry.register("subversion-wc", format.SvnWorkingTreeDirFormat, 
                          "Subversion working copy. ", 
                          native=False, hidden=True)
+SPEC_TYPES.append(revspec.RevisionSpec_svn)
 
 versions_checked = False
 def lazy_check_versions():

=== modified file 'commit.py'
--- a/commit.py	2007-11-05 15:06:37 +0000
+++ b/commit.py	2007-11-12 02:01:41 +0000
@@ -561,7 +561,6 @@
                 accessed when the entry has a revision of None - that is when 
                 it is a candidate to commit.
         """
-        self.mutter("record entry %r, %r, %r" % (ie, path, content_summary))
         self.new_inventory.add(ie)
 
 

=== modified file 'logwalker.py'
--- a/logwalker.py	2007-11-05 13:46:26 +0000
+++ b/logwalker.py	2007-11-05 15:11:22 +0000
@@ -53,15 +53,13 @@
             self.db = cache_db
 
         self.db.executescript("""
-          create table if not exists revision(revno integer unique);
-          create unique index if not exists revision_revno on revision (revno);
           create table if not exists changed_path(rev integer, action text, path text, copyfrom_path text, copyfrom_rev integer);
           create index if not exists path_rev on changed_path(rev);
           create unique index if not exists path_rev_path on changed_path(rev, path);
           create unique index if not exists path_rev_path_action on changed_path(rev, path, action);
         """)
         self.db.commit()
-        self.saved_revnum = self.db.execute("SELECT MAX(revno) FROM revision").fetchone()[0]
+        self.saved_revnum = self.db.execute("SELECT MAX(rev) FROM changed_path").fetchone()[0]
         if self.saved_revnum is None:
             self.saved_revnum = 0
 
@@ -97,8 +95,6 @@
                      "replace into changed_path (rev, path, action, copyfrom_path, copyfrom_rev) values (?, ?, ?, ?, ?)", 
                      (rev, p.strip("/"), orig_paths[p].action, copyfrom_path, orig_paths[p].copyfrom_rev))
 
-            self.db.execute("replace into revision (revno) values (?)", (rev,))
-
             self.saved_revnum = rev
             if self.saved_revnum % 1000 == 0:
                 self.db.commit()

=== modified file 'mapping.txt'
--- a/mapping.txt	2007-08-25 22:59:32 +0000
+++ b/mapping.txt	2007-11-11 19:16:06 +0000
@@ -1,3 +1,5 @@
+#FORMAT rst
+
 This document specifies mapping between Subversion and Bazaar semantics.
 
 Revision: 4
@@ -73,7 +75,7 @@
 
 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 
+* 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-05 15:06:37 +0000
+++ b/repository.py	2007-11-12 02:01:41 +0000
@@ -595,6 +595,22 @@
             if revid is not None:
                 yield revid
 
+    def get_parents(self, revids):
+        parents_list = []
+        for revision_id in revids:
+            if revision_id == NULL_REVISION:
+                parents = []
+            else:
+                try:
+                    parents = self.revision_parents(revision_id)
+                except NoSuchRevision:
+                    parents = None
+                else:
+                    if len(parents) == 0:
+                        parents = [NULL_REVISION]
+            parents_list.append(parents)
+        return parents_list
+
     def revision_parents(self, revision_id, bzr_merges=None, svk_merges=None):
         """See Repository.revision_parents()."""
         parent_ids = []

=== modified file 'tests/__init__.py'
--- a/tests/__init__.py	2007-10-30 21:10:26 +0000
+++ b/tests/__init__.py	2007-11-11 19:15:40 +0000
@@ -291,6 +291,7 @@
             'test_radir',
             'test_repos', 
             'test_revids',
+            'test_revspec',
             'test_scheme', 
             'test_transport',
             'test_tree',




More information about the bazaar-commits mailing list