Mercurial > evolve
comparison hgext3rd/topic/stack.py @ 4434:432f2155d106
stack: handle external-children just like other states
This also fixes color labels: previously when external-children was combined
with another state, --color=debug would show something like:
[topic.stack.index topic.stack.index.current - external-children|s4]
Now there is a separate label for each state.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sat, 09 Mar 2019 12:54:00 +0800 |
parents | a19d8196b0c9 |
children | 7915aef191ff |
comparison
equal
deleted
inserted
replaced
4433:a19d8196b0c9 | 4434:432f2155d106 |
---|---|
319 # super crude initial version | 319 # super crude initial version |
320 for idx, isentry, ctx in entries[::-1]: | 320 for idx, isentry, ctx in entries[::-1]: |
321 | 321 |
322 symbol = None | 322 symbol = None |
323 states = [] | 323 states = [] |
324 msg = '' | |
325 iscurrentrevision = repo.revs('%d and parents()', ctx.rev()) | 324 iscurrentrevision = repo.revs('%d and parents()', ctx.rev()) |
326 if opts.get('children'): | 325 if opts.get('children'): |
327 expr = 'children(%d) and merge() - %ld' | 326 expr = 'children(%d) and merge() - %ld' |
328 revisions = repo.revs(expr, ctx.rev(), st.revs[1:]) | 327 revisions = repo.revs(expr, ctx.rev(), st.revs[1:]) |
329 if len(revisions) > 0: | 328 if len(revisions) > 0: |
330 msg = 'external-children' | 329 states.append('external-children') |
331 | 330 |
332 if iscurrentrevision: | 331 if iscurrentrevision: |
333 symbol = '@' | 332 symbol = '@' |
334 if msg: | 333 states.append('current') |
335 states.append('current - ' + msg) | |
336 else: | |
337 states.append('current') | |
338 | 334 |
339 if ctx.orphan(): | 335 if ctx.orphan(): |
340 symbol = '$' | 336 symbol = '$' |
341 if msg: | 337 states.append('orphan') |
342 states.append('orphan - ' + msg) | |
343 else: | |
344 states.append('orphan') | |
345 | 338 |
346 if not isentry: | 339 if not isentry: |
347 symbol = '^' | 340 symbol = '^' |
348 # "base" is kind of a "ghost" entry | 341 # "base" is kind of a "ghost" entry |
349 states.append('base') | 342 states.append('base') |
350 | 343 |
351 # none of the above if statments get executed | 344 # none of the above if statments get executed |
352 if not symbol: | 345 if not symbol: |
353 symbol = ':' | 346 symbol = ':' |
354 if msg: | 347 |
355 states.append(msg) | 348 if not states: |
356 else: | 349 states.append('clean') |
357 states.append('clean') | |
358 | 350 |
359 states.sort() | 351 states.sort() |
360 | 352 |
361 fm.startitem() | 353 fm.startitem() |
362 fm.data(isentry=isentry) | 354 fm.data(isentry=isentry) |