Skip to content
Snippets Groups Projects
Commit 69fb9e41 authored by James Reynolds's avatar James Reynolds
Browse files

stack: add a --children flag to stack

If a commit in the stack has been merged outside the current topic, show a trailing status of (external-children)
parent f6298544
No related branches found
No related tags found
No related merge requests found
......@@ -8,8 +8,8 @@
* next: evolve aspiring children by default (use --no-evolve to skip)
* next: pick lower part of a split as destination
* compat: drop compatibility with Mercurial 4.3
i* topics: improve the message around topic changing
* topics: improve the message around topic changing
* stack: introduce a --children flag (see help for details)
8.3.2 --2017-11-27
-------------------
......
......@@ -721,6 +721,8 @@
return ret
@command('stack', [
('c', 'children', None,
_('display data about children outside of the stack'))
] + commands.formatteropts,
_('hg stack [TOPIC]'))
def cmdstack(ui, repo, topic='', **opts):
......
......@@ -329,4 +329,5 @@
symbol = None
states = []
msg = ''
iscurrentrevision = repo.revs('%d and parents()', ctx.rev())
......@@ -332,3 +333,13 @@
iscurrentrevision = repo.revs('%d and parents()', ctx.rev())
if opts.get('children'):
if branch:
t_msg = '-branch("%s")' % branch
if topic:
t_msg = '-topic("%s")' % topic
rev_msg = 'children(%s) and merge() %s'
revisions = repo.revs(rev_msg % (ctx.rev(), t_msg))
len_rev = len(revisions)
if len_rev > 0:
msg = 'external-children'
if iscurrentrevision:
......@@ -333,4 +344,3 @@
if iscurrentrevision:
states.append('current')
symbol = '@'
......@@ -336,4 +346,8 @@
symbol = '@'
if msg:
states.append('current - ' + msg)
else:
states.append('current')
if ctx.orphan():
symbol = '$'
......@@ -337,7 +351,10 @@
if ctx.orphan():
symbol = '$'
states.append('unstable')
if msg:
states.append('unstable - ' + msg)
else:
states.append('unstable')
if not isentry:
symbol = '^'
......@@ -347,7 +364,10 @@
# none of the above if statments get executed
if not symbol:
symbol = ':'
states.append('clean')
if msg:
states.append(msg)
else:
states.append('clean')
states.sort()
......
......@@ -229,5 +229,42 @@
s1: c_c
s0^ c_b (base)
merge case (displaying info about external)
-------------------------------------------
$ hg up default
0 files updated, 0 files merged, 4 files removed, 0 files unresolved
$ hg topics zzz
marked working directory as topic: zzz
$ echo zzz > zzz
$ hg add zzz
$ hg commit -m zzz_a
active topic 'zzz' grew its first changeset
(see 'hg help topics' for more information)
$ hg merge foo
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg commit -m "merged foo"
stack -m display data about child
$ hg stack foo
### topic: foo
### target: default (branch)
s4: c_f
s3: c_e
s2: c_d
s1: c_c
s0^ c_b (base)
$ hg stack foo --children
### topic: foo
### target: default (branch)
s4: c_f (external-children)
s3: c_e
s2: c_d
s1: c_c
s0^ c_b (base)
error case, nothing to list
......@@ -232,5 +269,12 @@
error case, nothing to list
$ hg strip --config extensions.strip= t1 --no-backup
0 files updated, 0 files merged, 5 files removed, 0 files unresolved
$ hg up foo
switching to topic foo
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg topic --clear
$ hg stack
### target: default (branch)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment