David Golub committed 7c8ecf0

shlib: call close() instead of rename() on Mercurial 2.0+ (fixes #1397)

The function rename() was renamed close() in the transition from Mercurial 1.9
to 2.0, breaking compatibility and causing the overlay server to crash when it
attempted to update thgstatus.

Comments (0)

Files changed (1)


                 s = dirstatus[dn]
                 f.write(s + dn + '\n')
                 ui.note("%s %s\n" % (s, dn))
-            f.rename()
+            if hasattr(f, 'rename'):
+                # On Mercurial 1.9 and earlier, there was a rename() function
+                # that served the purpose now served by close(), while close()
+                # served the purpose now served by discard().
+                f.rename()
+            else:
+                f.close()
         return update