Rev 1002: Move fetching of revision to a separate function. in file:///data/jelmer/bzr-svn/pyrex/

Jelmer Vernooij jelmer at samba.org
Tue Mar 18 01:11:15 GMT 2008


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

------------------------------------------------------------
revno: 1002
revision-id:jelmer at samba.org-20080318011112-xtwczpk6gepsw2ng
parent: jelmer at samba.org-20080317222817-ugp37qdqqff3bxx4
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: pyrex
timestamp: Tue 2008-03-18 02:11:12 +0100
message:
  Move fetching of revision to a separate function.
modified:
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  ra.pyx                         ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
=== modified file 'fetch.py'
--- a/fetch.py	2008-03-16 17:57:35 +0000
+++ b/fetch.py	2008-03-18 01:11:12 +0000
@@ -582,13 +582,36 @@
         """See InterRepository.copy_content."""
         self.fetch(revision_id, pb, find_ghosts=False)
 
-    def _fetch_replay(self, revids, pb=None):
-        """Copy a set of related revisions using ra_replay.
-
-        :param revids: Revision ids to copy.
-        :param pb: Optional progress bar
-        """
-        raise NotImplementedError(self._copy_revisions_replay)
+    def _fetch_revision(self, editor, transport, repos_root, parent_revid):
+        if parent_revid is None:
+            branch_url = urlutils.join(repos_root, 
+                                       editor.branch_path)
+            transport.reparent(branch_url)
+            assert transport.svn_url == branch_url.rstrip("/"), \
+                "Expected %r, got %r" % (transport.svn_url, branch_url)
+            reporter = transport.do_update(editor.revnum, True, 
+                                           editor)
+
+            # Report status of existing paths
+            reporter.set_path("", editor.revnum, True, None)
+        else:
+            (parent_branch, parent_revnum, mapping) = \
+                    self.source.lookup_revision_id(parent_revid)
+            transport.reparent(urlutils.join(repos_root, parent_branch))
+
+            if parent_branch != editor.branch_path:
+                reporter = transport.do_switch(editor.revnum, True, 
+                    urlutils.join(repos_root, editor.branch_path), 
+                    editor)
+            else:
+                reporter = transport.do_update(editor.revnum, True, editor)
+
+            # Report status of existing paths
+            reporter.set_path("", parent_revnum, False, None)
+
+        lock = transport.lock_read(".")
+        reporter.finish_report()
+        lock.unlock()
 
     def _fetch_switch(self, revids, pb=None, lhs_parent=None):
         """Copy a set of related revisions using ra_switch.
@@ -629,35 +652,7 @@
                 editor.start_revision(revid, parent_inv)
 
                 try:
-                    if parent_revid is None:
-                        branch_url = urlutils.join(repos_root, 
-                                                   editor.branch_path)
-                        transport.reparent(branch_url)
-                        assert transport.svn_url == branch_url.rstrip("/"), \
-                            "Expected %r, got %r" % (transport.svn_url, branch_url)
-                        reporter = transport.do_update(editor.revnum, True, 
-                                                       editor)
-
-                        # Report status of existing paths
-                        reporter.set_path("", editor.revnum, True, None)
-                    else:
-                        (parent_branch, parent_revnum, mapping) = \
-                                self.source.lookup_revision_id(parent_revid)
-                        transport.reparent(urlutils.join(repos_root, parent_branch))
-
-                        if parent_branch != editor.branch_path:
-                            reporter = transport.do_switch(editor.revnum, True, 
-                                urlutils.join(repos_root, editor.branch_path), 
-                                editor)
-                        else:
-                            reporter = transport.do_update(editor.revnum, True, editor)
-
-                        # Report status of existing paths
-                        reporter.set_path("", parent_revnum, False, None)
-
-                    lock = transport.lock_read(".")
-                    reporter.finish_report()
-                    lock.unlock()
+                    self._fetch_revision(editor, transport, repos_root, parent_revid)
                 except:
                     editor.abort()
                     raise

=== modified file 'ra.pyx'
--- a/ra.pyx	2008-03-17 22:28:17 +0000
+++ b/ra.pyx	2008-03-18 01:11:12 +0000
@@ -782,7 +782,7 @@
         ret.pool = temp_pool
         return ret
 
-    def replay(self, revision, low_water_mark, send_deltas, update_editor):
+    def replay(self, revision, low_water_mark, update_editor, send_deltas=True):
         cdef apr_pool_t *temp_pool
         temp_pool = Pool(self.pool)
         check_error(svn_ra_replay(self.ra, revision, low_water_mark,




More information about the bazaar-commits mailing list