topic: use 'hookargs' over 'tr.changes' for flow control
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 12 Dec 2017 02:16:58 +0100
changeset 3282 3675fe74521d
parent 3281 703e8398ac57
child 3283 039c4b8dc3ed
topic: use 'hookargs' over 'tr.changes' for flow control The 'tr.changes' attribute do not exists until 4.2.
hgext3rd/topic/flow.py
--- a/hgext3rd/topic/flow.py	Tue Dec 12 01:27:12 2017 +0100
+++ b/hgext3rd/topic/flow.py	Tue Dec 12 02:16:58 2017 +0100
@@ -32,13 +32,14 @@
 
 def rejectuntopicedchangeset(repo, tr):
     """Reject the push if there are changeset without topic"""
-    if not tr.changes['revs']: # no new revs
+    if 'node' not in tr.hookargs: # no new revs
         return
 
+    startnode = node.bin(tr.hookargs['node'])
+
     mode = repo.ui.config('experimental', 'topic-mode.server', 'ignore')
 
-    revs = list(tr.changes['revs'])
-    untopiced = repo.revs('not public() and (%ld:) - hidden() - topic()', revs)
+    untopiced = repo.revs('not public() and (%n:) - hidden() - topic()', startnode)
     if untopiced:
         num = len(untopiced)
         fnode = repo[untopiced.first()].hex()[:10]