changeset 361:cfdd4ec5230a

Merge fetch_history_at_paths() and revisions() in svn wrappers.
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Thu, 28 May 2009 09:54:41 +0200
parents 27e9fea5d114
children 705f33c0a323
files hgsubversion/svnwrap/svn_ctypes_wrapper.py hgsubversion/svnwrap/svn_swig_wrapper.py
diffstat 2 files changed, 7 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/svnwrap/svn_ctypes_wrapper.py
+++ b/hgsubversion/svnwrap/svn_ctypes_wrapper.py
@@ -78,7 +78,7 @@ class SubversionRepo(object):
         """
         raise NotImplementedError
 
-    def revisions(self, start=None, chunk_size=1000):
+    def revisions(self, paths=None, start=None, stop=None, chunk_size=1000):
         """Load the history of this repo.
 
         This is LAZY. It returns a generator, and fetches a small number
@@ -95,11 +95,6 @@ class SubversionRepo(object):
         # kind of tough cookies, sadly.
         raise NotImplementedError
 
-
-    def fetch_history_at_paths(self, paths, start=None, stop=None,
-                               chunk_size=1000):
-        raise NotImplementedError
-
     def get_replay(self, revision, editor, oldest_rev_i_have=0):
         raise NotImplementedError
 
--- a/hgsubversion/svnwrap/svn_swig_wrapper.py
+++ b/hgsubversion/svnwrap/svn_swig_wrapper.py
@@ -263,7 +263,7 @@ class SubversionRepo(object):
         head=self.HEAD
         for b in branches:
             b_path = 'branches/%s' %b
-            hist_gen = self.fetch_history_at_paths([b_path], stop=head)
+            hist_gen = self.revisions([b_path], stop=head)
             hist = hist_gen.next()
             source, source_rev = self._get_copy_source(b_path, cached_head=head)
             # This if statement guards against projects that have non-ancestral
@@ -313,7 +313,7 @@ class SubversionRepo(object):
         """
         if not cached_head:
             cached_head = self.HEAD
-        hist_gen = self.fetch_history_at_paths([path], stop=cached_head)
+        hist_gen = self.revisions([path], stop=cached_head)
         hist = hist_gen.next()
         if hist.paths[path].copyfrom_path is None:
             return None, None
@@ -349,7 +349,8 @@ class SubversionRepo(object):
         folders, props, junk = r
         return folders
 
-    def revisions(self, start=None, stop=None, chunk_size=_chunk_size):
+    def revisions(self, paths=None, start=None, stop=None,
+                  chunk_size=_chunk_size):
         """Load the history of this repo.
 
         This is LAZY. It returns a generator, and fetches a small number
@@ -358,13 +359,8 @@ class SubversionRepo(object):
         The reason this is lazy is so that you can use the same repo object
         to perform RA calls to get deltas.
         """
-        return self.fetch_history_at_paths([''], start=start, stop=stop,
-                                           chunk_size=chunk_size)
-
-    def fetch_history_at_paths(self, paths, start=None, stop=None,
-                               chunk_size=_chunk_size):
-        '''TODO: This method should be merged with self.revisions() as
-        they are now functionally equivalent.'''
+        if paths is None:
+            paths = ['']
         if not start:
             start = self.START
         if not stop: