Mercurial > evolve
comparison hgext3rd/topic/stack.py @ 4652:b72cd597a887
stack: check if stack is empty more pythonically
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Wed, 08 May 2019 16:00:34 +0800 |
parents | 55c347b4874f |
children | fd4f422b0b57 |
comparison
equal
deleted
inserted
replaced
4651:55c347b4874f | 4652:b72cd597a887 |
---|---|
246 label = 'topic' | 246 label = 'topic' |
247 if topic == repo.currenttopic: | 247 if topic == repo.currenttopic: |
248 label = 'topic.active' | 248 label = 'topic.active' |
249 | 249 |
250 st = stack(repo, branch, topic) | 250 st = stack(repo, branch, topic) |
251 empty = False | |
252 if st.changesetcount == 0: | |
253 empty = True | |
254 if topic is not None: | 251 if topic is not None: |
255 fm.plain(_('### topic: %s') | 252 fm.plain(_('### topic: %s') |
256 % ui.label(topic, label), | 253 % ui.label(topic, label), |
257 label='topic.stack.summary.topic') | 254 label='topic.stack.summary.topic') |
258 | 255 |
279 elif st.behindcount: | 276 elif st.behindcount: |
280 fm.plain(', ') | 277 fm.plain(', ') |
281 fm.plain('%d behind' % st.behindcount, label='topic.stack.summary.behindcount') | 278 fm.plain('%d behind' % st.behindcount, label='topic.stack.summary.behindcount') |
282 fm.plain('\n') | 279 fm.plain('\n') |
283 | 280 |
284 if empty: | 281 if not st: |
285 fm.plain(_("(stack is empty)\n")) | 282 fm.plain(_("(stack is empty)\n")) |
286 | 283 |
287 st = stack(repo, branch=branch, topic=topic) | 284 st = stack(repo, branch=branch, topic=topic) |
288 for idx, r in enumerate(st, 0): | 285 for idx, r in enumerate(st, 0): |
289 ctx = repo[r] | 286 ctx = repo[r] |