diff hgext3rd/topic/flow.py @ 3282:3675fe74521d

topic: use 'hookargs' over 'tr.changes' for flow control The 'tr.changes' attribute do not exists until 4.2.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 12 Dec 2017 02:16:58 +0100
parents 8a772f0c54d9
children 419801742d08
line wrap: on
line diff
--- 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]