changeset 109:3647b4bed1a1

Fix httprepo.do_read in hg >= 1.7
author Patrick Mezard <pmezard@gmail.com>
date Thu, 18 Nov 2010 23:49:39 +0100
parents 5f20f2b657fd
children 18897318f6e1
files forest.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/forest.py	Thu Nov 18 23:36:35 2010 +0100
+++ b/forest.py	Thu Nov 18 23:49:39 2010 +0100
@@ -216,6 +216,13 @@
 
 localrepo.localrepository.forests = _localrepo_forests
 
+def repocall(repo, *args, **kwargs):
+    if hasattr(repo, '_call'):
+        # hg >= 1.7
+        callfn = repo._call
+    else:
+        callfn = repo.do_read
+    return callfn(*args, **kwargs)
 
 def _sshrepo_forests(self, walkhg):
     """Shim this function into mercurial.sshrepo.sshrepository so
@@ -228,7 +235,7 @@
         raise util.Abort(_("Remote forests cannot be cloned because the "
                            "other repository doesn't support the forest "
                            "extension."))
-    data = self.call("forests", walkhg=("", "True")[walkhg])
+    data = repocall(self, "forests", walkhg=("", "True")[walkhg])
     return data.splitlines()
 
 sshrepo.sshrepository.forests = _sshrepo_forests
@@ -280,7 +287,7 @@
         raise util.Abort(_("Remote forests cannot be cloned because the "
                            "other repository doesn't support the forest "
                            "extension."))
-    data = self.do_read("forests", walkhg=("", "True")[walkhg])
+    data = repocall(self, "forests", walkhg=("", "True")[walkhg])
     return data.splitlines()
 
 httprepo.httprepository.forests = _httprepo_forests