topic: check that exchange._checkpublish() exists before wrapping it stable
authorAnton Shestakov <av6@dwimlabs.net>
Wed, 08 Apr 2020 01:02:23 +0800
branchstable
changeset 5275 1a81bbc94d45
parent 5274 fa1324e58fcf
child 5277 9ed5f9c5d8ae
topic: check that exchange._checkpublish() exists before wrapping it
hgext3rd/topic/__init__.py
--- a/hgext3rd/topic/__init__.py	Thu Mar 12 02:08:39 2020 +0100
+++ b/hgext3rd/topic/__init__.py	Wed Apr 08 01:02:23 2020 +0800
@@ -382,7 +382,10 @@
     # Wrap changelog.add to drop empty topic
     extensions.wrapfunction(changelog.changelog, 'add', wrapadd)
     # Make exchange._checkpublish handle experimental.topic.publish-bare-branch
-    extensions.wrapfunction(exchange, '_checkpublish', flow.replacecheckpublish)
+    if util.safehasattr(exchange, '_checkpublish'):
+        # hg <= 4.8 (33d30fb1e4ae)
+        extensions.wrapfunction(exchange, '_checkpublish',
+                                flow.replacecheckpublish)
 
     server.setupserver(ui)