comparison 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
comparison
equal deleted inserted replaced
3281:703e8398ac57 3282:3675fe74521d
30 nodes = [cl.node(r) for r in topublish] 30 nodes = [cl.node(r) for r in topublish]
31 repo._phasecache.advanceboundary(repo, tr, phases.public, nodes) 31 repo._phasecache.advanceboundary(repo, tr, phases.public, nodes)
32 32
33 def rejectuntopicedchangeset(repo, tr): 33 def rejectuntopicedchangeset(repo, tr):
34 """Reject the push if there are changeset without topic""" 34 """Reject the push if there are changeset without topic"""
35 if not tr.changes['revs']: # no new revs 35 if 'node' not in tr.hookargs: # no new revs
36 return 36 return
37
38 startnode = node.bin(tr.hookargs['node'])
37 39
38 mode = repo.ui.config('experimental', 'topic-mode.server', 'ignore') 40 mode = repo.ui.config('experimental', 'topic-mode.server', 'ignore')
39 41
40 revs = list(tr.changes['revs']) 42 untopiced = repo.revs('not public() and (%n:) - hidden() - topic()', startnode)
41 untopiced = repo.revs('not public() and (%ld:) - hidden() - topic()', revs)
42 if untopiced: 43 if untopiced:
43 num = len(untopiced) 44 num = len(untopiced)
44 fnode = repo[untopiced.first()].hex()[:10] 45 fnode = repo[untopiced.first()].hex()[:10]
45 if num == 1: 46 if num == 1:
46 msg = _("%s") % fnode 47 msg = _("%s") % fnode