Przeglądaj źródła

Add backwards compatibility wrapper for RefsContainer._follow.

Jelmer Vernooij 8 lat temu
rodzic
commit
239ac80e96
1 zmienionych plików z 10 dodań i 0 usunięć
  1. 10 0
      dulwich/refs.py

+ 10 - 0
dulwich/refs.py

@@ -217,6 +217,16 @@ class RefsContainer(object):
                 raise KeyError(name)
         return refnames, contents
 
+    def _follow(self, name):
+        import warnings
+        warnings.warn(
+            "RefsContainer._follow is deprecated. Use RefsContainer.follow instead.",
+            DeprecationWarning)
+        refnames, contents = self.follow(name)
+        if not refnames:
+            return (None, contents)
+        return (refnames[-1], contents)
+
     def __contains__(self, refname):
         if self.read_ref(refname):
             return True