Rev 586: Merge 0.4.4. in file:///data/jelmer/bzr-svn/revprops/

Jelmer Vernooij jelmer at samba.org
Sat Nov 3 16:57:55 GMT 2007


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

------------------------------------------------------------
revno: 586
revision-id:jelmer at samba.org-20071103165753-hjlzh40vohte7nmd
parent: jelmer at samba.org-20071031133928-5i0zvoxz2berig6a
parent: jelmer at samba.org-20071102143521-5bwaf2dkv1ar7ezp
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: revprops
timestamp: Sat 2007-11-03 17:57:53 +0100
message:
  Merge 0.4.4.
modified:
  AUTHORS                        AUTHORS-20060508114718-4c90c0062645106d
  FAQ                            faq-20070910195147-p9u38s9wplds2d4o-1
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
  commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
  convert.py                     svn2bzr.py-20051018015439-cb4563bff29e632d
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  setup.py                       setup.py-20060502115218-86950492da22353f
  tests/test_commit.py           test_commit.py-20060624213521-l5kcufywkh9mnilk-1
  tests/test_errors.py           test_errors.py-20070129114605-ban03f32t6ja14ez-1
    ------------------------------------------------------------
    revno: 579.1.199
    revision-id:jelmer at samba.org-20071102143521-5bwaf2dkv1ar7ezp
    parent: jelmer at samba.org-20071102142508-j03sdky59aw7e8m0
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Fri 2007-11-02 15:35:21 +0100
    message:
      Start working on 0.4.5.
    modified:
      NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
      __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
      setup.py                       setup.py-20060502115218-86950492da22353f
    ------------------------------------------------------------
    revno: 579.1.198
    tags: bzr-svn-0.4.4
    revision-id:jelmer at samba.org-20071102142508-j03sdky59aw7e8m0
    parent: jelmer at samba.org-20071102142306-zjoyips7zr9t7ukt
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Fri 2007-11-02 15:25:08 +0100
    message:
      Release 0.4.4.
    modified:
      NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
      __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
    ------------------------------------------------------------
    revno: 579.1.197
    revision-id:jelmer at samba.org-20071102142306-zjoyips7zr9t7ukt
    parent: jelmer at samba.org-20071101233145-0d0v61kpws32ylje
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Fri 2007-11-02 15:23:06 +0100
    message:
      Improve progress bars for svn-import.
    modified:
      NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
      convert.py                     svn2bzr.py-20051018015439-cb4563bff29e632d
      fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
    ------------------------------------------------------------
    revno: 579.1.196
    revision-id:jelmer at samba.org-20071101233145-0d0v61kpws32ylje
    parent: jelmer at samba.org-20071101215820-7i4lgnil4pq67zuf
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Fri 2007-11-02 00:31:45 +0100
    message:
      svn_txdelta_send_string is buggy, avoid it. (#59111).
    modified:
      NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
      commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
    ------------------------------------------------------------
    revno: 579.1.195
    revision-id:jelmer at samba.org-20071101215820-7i4lgnil4pq67zuf
    parent: jelmer at samba.org-20071101013304-mrhg7errku99vfh6
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Thu 2007-11-01 22:58:20 +0100
    message:
      Use standard interface as much as possible.
    modified:
      commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
    ------------------------------------------------------------
    revno: 579.1.194
    revision-id:jelmer at samba.org-20071101013304-mrhg7errku99vfh6
    parent: jelmer at samba.org-20071031221033-iykbqv260nv22ytt
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Thu 2007-11-01 02:33:04 +0100
    message:
      Fix tests.
    modified:
      tests/test_commit.py           test_commit.py-20060624213521-l5kcufywkh9mnilk-1
      tests/test_errors.py           test_errors.py-20070129114605-ban03f32t6ja14ez-1
    ------------------------------------------------------------
    revno: 579.1.193
    revision-id:jelmer at samba.org-20071031221033-iykbqv260nv22ytt
    parent: dato at net.com.org.es-20071031175552-mp9mnjzgeofa20zc
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Wed 2007-10-31 23:10:33 +0100
    message:
      update credits
    modified:
      AUTHORS                        AUTHORS-20060508114718-4c90c0062645106d
    ------------------------------------------------------------
    revno: 579.1.192
    revision-id:dato at net.com.org.es-20071031175552-mp9mnjzgeofa20zc
    parent: dato at net.com.org.es-20071031174224-1oba36ska0kdgw86
    committer: Adeodato Simó <dato at net.com.org.es>
    branch nick: override-svn-revprops.fixes
    timestamp: Wed 2007-10-31 18:55:52 +0100
    message:
      svn:date should be a UTC timestamp.
    modified:
      commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
    ------------------------------------------------------------
    revno: 579.1.191
    revision-id:dato at net.com.org.es-20071031174224-1oba36ska0kdgw86
    parent: jelmer at samba.org-20071030233541-gxqufien83m1v47t
    committer: Adeodato Simó <dato at net.com.org.es>
    branch nick: override-svn-revprops.fixes
    timestamp: Wed 2007-10-31 18:42:24 +0100
    message:
      Correct option name in the FAQ.
    modified:
      FAQ                            faq-20070910195147-p9u38s9wplds2d4o-1
=== modified file 'AUTHORS'
--- a/AUTHORS	2007-10-26 16:17:28 +0000
+++ b/AUTHORS	2007-10-31 22:10:33 +0000
@@ -2,9 +2,9 @@
 
 Thanks to David Allouche, Erik Bågfors, Andrew Bennetts, Aaron Bentley, 
 Max Bowser, Jerry Carter, Robert Collins, Wouter van Heyst, Michael Hudson, 
-David James, Jan Kneschke, Luká¿ Lalinský, Matthias Klose, Roland Mas,
+David James, Jan Kneschke, Lukás Lalinský, Matthias Klose, Roland Mas,
 John Arbash Meinel, Stefan Metzmacher, Andrew Mitchell, Gustavo Niemeyer, 
 Martin Pool, Garrett Rooney, Johan Rydberg, Peter Samuelson, Mark Shuttleworth, 
-Mikhail Sobolev and Reinhard Tartler for comments, code reviews, funding, 
-bug reports, testing, committing patches/bundles and generally keeping up 
+Adeodato Simó, Mikhail Sobolev and Reinhard Tartler for comments, code reviews, 
+funding, bug reports, testing, committing patches/bundles and generally keeping up 
 while I was asking annoying questions.

=== modified file 'FAQ'
--- a/FAQ	2007-10-30 22:08:13 +0000
+++ b/FAQ	2007-10-31 17:42:24 +0000
@@ -88,4 +88,4 @@
 more information about how to do this.
 
 You also need to enable support for this in bzr-svn by setting 
-pre-revprop-change to True in ~/.bazaar/bazaar.conf.
+override-svn-revprops to True in ~/.bazaar/bazaar.conf.

=== modified file 'NEWS'
--- a/NEWS	2007-10-30 23:35:41 +0000
+++ b/NEWS	2007-11-02 14:35:21 +0000
@@ -1,4 +1,6 @@
-bzr-svn 0.4.4	UNRELEASED
+bzr-svn 0.4.5	UNRELEASED
+
+bzr-svn 0.4.4	2007-11-02
 
   PERFORMANCE
 
@@ -71,6 +73,10 @@
 
    * Handle special characters in committer name correctly. (#158347)
 
+   * Avoid crashes on sending empty diffs over http/svn+SCHEME (#159111)
+
+   * Decent progress bar for "svn-import". (#127933)
+
   DOCUMENTATION
 
    * Add simple FAQ file. (#144388)

=== modified file '__init__.py'
--- a/__init__.py	2007-10-29 16:37:13 +0000
+++ b/__init__.py	2007-11-02 14:35:21 +0000
@@ -29,7 +29,7 @@
 # versions ending in 'exp' mean experimental mappings
 # versions ending in 'dev' mean development version
 # versions ending in 'final' mean release (well tested, etc)
-version_info = (0, 4, 4, 'dev', 0)
+version_info = (0, 4, 5, 'dev', 0)
 
 if version_info[3] == 'final':
     version_string = '%d.%d.%d' % version_info[:3]

=== modified file 'commit.py'
--- a/commit.py	2007-10-30 23:11:07 +0000
+++ b/commit.py	2007-11-01 23:31:45 +0000
@@ -28,6 +28,7 @@
 from bzrlib.trace import mutter
 
 from copy import deepcopy
+from cStringIO import StringIO
 from errors import ChangesRootLHSHistory, MissingPrefix, RevpropChangeFailed
 from repository import (SVN_PROP_BZR_ANCESTRY, SVN_PROP_BZR_FILEIDS,
                         SVN_PROP_SVK_MERGE, SVN_PROP_BZR_REVISION_INFO, 
@@ -54,19 +55,18 @@
     return []
 
 
-def set_svn_revprops(transport, revnum, author, timestamp, timezone):
+def set_svn_revprops(transport, revnum, author, timestamp):
     """Attempt to change the revision properties on the
     specified revision.
 
     :param transport: SvnRaTransport connected to target repository
     :param revnum: Revision number of revision to change metadata of.
     :param author: New author
-    :param timestamp: Timestamp
-    :param timezone: Timezone
+    :param timestamp: UTC timestamp
     """
     revprops = {
         svn.core.SVN_PROP_REVISION_AUTHOR: author,
-        svn.core.SVN_PROP_REVISION_DATE: svn_time_to_cstring(1000000*(timestamp+timezone))
+        svn.core.SVN_PROP_REVISION_DATE: svn_time_to_cstring(1000000*timestamp)
     }
     for (name, value) in revprops.items():
         try:
@@ -226,13 +226,11 @@
         :param baton: Baton under which the file is known to the editor.
         """
         assert baton is not None
-        if contents == "" and not file_id in self.old_inv:
-            # Don't send diff if a new file with empty contents is 
-            # added, because it created weird exceptions over svn+ssh:// 
-            # or https://
-            return
         (txdelta, txbaton) = self.editor.apply_textdelta(baton, None, self.pool)
-        svn.delta.svn_txdelta_send_string(contents, txdelta, txbaton, self.pool)
+        digest = svn.delta.svn_txdelta_send_stream(StringIO(contents), txdelta, txbaton, self.pool)
+        if 'validate' in debug.debug_flags:
+            from fetch import md5_strings
+            assert digest == md5_strings(contents)
 
     def _dir_process(self, path, file_id, baton):
         """Pass the changes to a directory to the commit editor.
@@ -258,9 +256,8 @@
                     self.new_inventory[child_ie.file_id].name != child_name):
                     self.mutter('removing %r(%r)' % (child_name, child_ie.file_id))
                     self.editor.delete_entry(
-                            urlutils.join(
-                                self.branch.get_branch_path(), path, child_name), 
-                            self.base_revnum, baton, self.pool)
+                        urlutils.join(self.branch.get_branch_path(), path, child_name), 
+                        self.base_revnum, baton, self.pool)
 
         # Loop over file children of file_id in self.new_inventory
         for child_name in self.new_inventory[file_id].children:
@@ -517,8 +514,7 @@
 
         if self.repository.get_config().get_override_svn_revprops():
             set_svn_revprops(self.repository.transport, 
-                             self.revnum, self._committer, 
-                             self._timestamp, self._timezone)
+                             self.revnum, self._committer, self._timestamp)
 
         return revid
 
@@ -542,8 +538,12 @@
         :param path: The path the entry is at in the tree.
         :param tree: The tree which contains this entry and should be used to 
         obtain content.
+        :param content_summary: Summary data from the tree about the paths
+                content - stat, length, exec, sha/link target. This is only
+                accessed when the entry has a revision of None - that is when 
+                it is a candidate to commit.
         """
-        assert self.new_inventory.root is not None or ie.parent_id is None
+        self.mutter("record entry %r, %r, %r" % (ie, path, content_summary))
         self.new_inventory.add(ie)
 
 
@@ -554,6 +554,10 @@
     :param old_tree: Original tree on top of which the delta should be applied
     :param new_tree: New tree that should be committed
     """
+    for path, ie in new_tree.inventory.iter_entries():
+        builder.record_entry_contents(ie.copy(), [old_tree.inventory], 
+                                      path, new_tree, None)
+    builder.finish_inventory()
     delta = new_tree.changes_from(old_tree)
     def touch_id(id):
         ie = builder.new_inventory[id]
@@ -591,11 +595,9 @@
         if old_parent_id in builder.new_inventory:
             touch_id(old_parent_id)
 
-    builder.finish_inventory()
-
 
 def push_new(target_repository, target_branch_path, source, 
-             stop_revision=None, validate=False):
+             stop_revision=None):
     """Push a revision into Subversion, creating a new branch.
 
     This will do a new commit in the target branch.
@@ -603,8 +605,6 @@
     :param target_branch_path: Path to create new branch at
     :param source: Branch to pull the revision from
     :param revision_id: Revision id of the revision to push
-    :param validate: Whether to check the committed revision matches 
-        the source revision.
     """
     assert isinstance(source, Branch)
     if stop_revision is None:
@@ -662,11 +662,10 @@
                 revnum, self.get_branch_path(revnum), 
                 str(self.repository.get_scheme()))
 
-    push(ImaginaryBranch(target_repository), source, start_revid, 
-         validate=validate)
-
-
-def push(target, source, revision_id, validate=False):
+    push(ImaginaryBranch(target_repository), source, start_revid)
+
+
+def push(target, source, revision_id):
     """Push a revision into Subversion.
 
     This will do a new commit in the target branch.
@@ -674,8 +673,6 @@
     :param target: Branch to push to
     :param source: Branch to pull the revision from
     :param revision_id: Revision id of the revision to push
-    :param validate: Whether to check the committed revision matches 
-        the source revision.
     """
     assert isinstance(source, Branch)
     rev = source.repository.get_revision(revision_id)
@@ -697,7 +694,6 @@
                                    rev.timezone, rev.committer, rev.properties, 
                                    revision_id, base_tree.inventory)
                              
-        builder.new_inventory = source.repository.get_inventory(revision_id)
         replay_delta(builder, base_tree, old_tree)
     finally:
         source.unlock()
@@ -710,7 +706,7 @@
     except ChangesRootLHSHistory:
         raise BzrError("Unable to push revision %r because it would change the ordering of existing revisions on the Subversion repository root. Use rebase and try again or push to a non-root path" % revision_id)
 
-    if validate:
+    if 'validate' in debug.debug_flags:
         crev = target.repository.get_revision(revision_id)
         ctree = target.repository.revision_tree(revision_id)
         treedelta = ctree.changes_from(old_tree)
@@ -771,7 +767,6 @@
                                    rev.timestamp, rev.timezone, rev.committer,
                                    rev.properties, revision_id, base_tree.inventory)
                              
-                builder.new_inventory = self.source.get_inventory(revision_id)
                 replay_delta(builder, base_tree, old_tree)
                 builder.commit(rev.message)
         finally:

=== modified file 'convert.py'
--- a/convert.py	2007-09-08 22:55:57 +0000
+++ b/convert.py	2007-11-02 14:23:06 +0000
@@ -19,6 +19,7 @@
 from bzrlib.branch import Branch
 from bzrlib.errors import (BzrError, NotBranchError, NoSuchFile, 
                            NoRepositoryPresent, NoSuchRevision)
+from bzrlib.repository import InterRepository
 from bzrlib.revision import ensure_null
 from bzrlib.transport import get_transport
 
@@ -122,8 +123,6 @@
         except NoRepositoryPresent:
             target_repos = get_dir("").create_repository(shared=True)
         target_repos.set_make_working_trees(working_trees)
-        if all:
-            source_repos.copy_content_into(target_repos)
 
     if filter_branch is None:
         filter_branch = lambda (bp, rev, exists): exists
@@ -132,13 +131,27 @@
             filter(filter_branch,
                    source_repos.find_branches(source_repos.get_scheme()))]
 
+    def is_dir((branch, revnum)):
+        return source_repos.transport.check_path(branch, revnum) == svn.core.svn_node_dir
+
+    existing_branches = filter(is_dir, existing_branches)
+
+    if create_shared_repo:
+        inter = InterRepository.get(source_repos, target_repos)
+
+        if all:
+            inter.fetch()
+        elif (target_repos.is_shared() and 
+              hasattr(inter, '_supports_branches') and 
+              inter._supports_branches):
+            inter.fetch(branches=[source_repos.generate_revision_id(revnum, branch, str(source_repos.get_scheme())) for (branch, revnum) in existing_branches])
+
+
     source_graph = source_repos.get_graph()
     pb = ui.ui_factory.nested_progress_bar()
     try:
         i = 0
         for (branch, revnum) in existing_branches:
-            if source_repos.transport.check_path(branch, revnum) == svn.core.svn_node_file:
-                continue
             pb.update("%s:%d" % (branch, revnum), i, len(existing_branches))
             revid = source_repos.generate_revision_id(revnum, branch, 
                                           str(source_repos.get_scheme()))

=== modified file 'fetch.py'
--- a/fetch.py	2007-10-30 23:11:07 +0000
+++ b/fetch.py	2007-11-02 14:23:06 +0000
@@ -449,6 +449,8 @@
 
     _matching_repo_format = SvnRepositoryFormat()
 
+    _supports_branches = True
+
     @staticmethod
     def _get_repo_format_to_test():
         return None
@@ -464,8 +466,22 @@
             (branch, revnum, scheme) = self.source.lookup_revision_id(revid)
             parents[revid] = self.source._mainline_revision_parent(branch, 
                                                revnum, scheme)
+        needed.reverse()
         return (needed, parents)
 
+    def _find_branches(self, branches, find_ghosts=False):
+        set_needed = set()
+        ret_needed = list()
+        ret_parents = dict()
+        for revid in branches:
+            (needed, parents) = self._find_until(revid, find_ghosts=find_ghosts)
+            for rev in needed:
+                if not rev in set_needed:
+                    ret_needed.append(rev)
+                    set_needed.add(rev)
+            ret_parents.update(parents)
+        return ret_needed, ret_parents
+
     def _find_until(self, revision_id, find_ghosts=False):
         """Find all missing revisions until revision_id
 
@@ -495,6 +511,7 @@
                 break
 
         parents[prev_revid] = None
+        needed.reverse()
         return (needed, parents)
 
     def copy_content(self, revision_id=None, pb=None):
@@ -533,7 +550,7 @@
         editor = revbuildklass(self.source, self.target)
 
         try:
-            for revid in reversed(revids):
+            for revid in revids:
                 pb.update('copying revision', num, len(revids))
 
                 parent_revid = lhs_parent[revid]
@@ -593,7 +610,8 @@
                 nested_pb.finished()
         self.source.transport.reparent_root()
 
-    def fetch(self, revision_id=None, pb=None, find_ghosts=False):
+    def fetch(self, revision_id=None, pb=None, find_ghosts=False, 
+              branches=None):
         """Fetch revisions. """
         if revision_id == NULL_REVISION:
             return
@@ -604,7 +622,10 @@
         # or self.target.add_inventory() each time
         self.target.lock_read()
         try:
-            if revision_id is None:
+            if branches is not None:
+                (needed, lhs_parent) = self._find_branches(branches, 
+                                                           find_ghosts)
+            elif revision_id is None:
                 (needed, lhs_parent) = self._find_all()
             else:
                 (needed, lhs_parent) = self._find_until(revision_id, 

=== modified file 'setup.py'
--- a/setup.py	2007-09-17 00:46:47 +0000
+++ b/setup.py	2007-11-02 14:35:21 +0000
@@ -5,7 +5,7 @@
 setup(name='bzr-svn',
       description='Support for Subversion branches in Bazaar',
       keywords='plugin bzr svn',
-      version='0.4.4',
+      version='0.4.5',
       url='http://bazaar-vcs.org/BzrForeignBranches/Subversion',
       download_url='http://bazaar-vcs.org/BzrSvn',
       license='GPL',

=== modified file 'tests/test_commit.py'
--- a/tests/test_commit.py	2007-10-30 22:08:13 +0000
+++ b/tests/test_commit.py	2007-11-01 01:33:04 +0000
@@ -557,7 +557,7 @@
         self.client_commit("dc", "My commit")
 
         transport = SvnRaTransport(repos_url)
-        set_svn_revprops(transport, 1, "Somebody", 473382000, 3600)
+        set_svn_revprops(transport, 1, "Somebody", 473385600)
 
         self.assertEquals(("Somebody", "1985-01-01T00:00:00.000000Z", "My commit"), 
                           self.client_log("dc")[1][1:])
@@ -570,4 +570,4 @@
 
         transport = SvnRaTransport(repos_url)
         self.assertRaises(RevpropChangeFailed, 
-            lambda: set_svn_revprops(transport, 1, "Somebody", 473382000, 3600))
+            lambda: set_svn_revprops(transport, 1, "Somebody", 473385600))

=== modified file 'tests/test_errors.py'
--- a/tests/test_errors.py	2007-10-30 23:35:41 +0000
+++ b/tests/test_errors.py	2007-11-01 01:33:04 +0000
@@ -29,7 +29,7 @@
     def test_decorator_unknown(self):
         @convert_svn_error
         def test_throws_svn():
-            raise SubversionException("foo", 100)
+            raise SubversionException("foo", 2000)
 
         self.assertRaises(SubversionException, test_throws_svn)
 




More information about the bazaar-commits mailing list