Compat with mercurial 1.9.2
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Mon, 19 Sep 2011 01:55:35 +0200
changeset 83 97a5c943db19
parent 82 8108d566a8b5
child 84 c4cc5f3bcf12
Compat with mercurial 1.9.2
hgext/obsolete.py
hgext/states.py
--- a/hgext/obsolete.py	Mon Sep 19 01:11:10 2011 +0200
+++ b/hgext/obsolete.py	Mon Sep 19 01:55:35 2011 +0200
@@ -350,7 +350,10 @@
             f = self.opener('obsolete-relations', 'w', atomictemp=True)
             try:
                 _obsserialise(self._obssubrels, f)
-                f.rename()
+                try:
+                    f.rename()
+                except AttributeError: # old version
+                    f.close()
             finally:
                 f.close()
 
--- a/hgext/states.py	Mon Sep 19 01:11:10 2011 +0200
+++ b/hgext/states.py	Mon Sep 19 01:55:35 2011 +0200
@@ -636,7 +636,10 @@
     try:
         for h in heads:
             f.write(hex(h) + '\n')
-        f.rename()
+        try:
+            f.rename()
+        except AttributeError: # old version
+            f.close()
     finally:
         f.close()
 
@@ -852,7 +855,10 @@
             try:
                 for st in self._enabledstates:
                     f.write(st.name + '\n')
-                f.rename()
+                try:
+                    f.rename()
+                except AttributeError: # old version
+                    f.close()
             finally:
                 f.close()