stabilize: stabilize my topological branch only
if not stated otherwize.
--- a/hgext/evolve.py Thu Mar 08 14:15:53 2012 +0100
+++ b/hgext/evolve.py Thu Mar 08 14:35:57 2012 +0100
@@ -163,16 +163,34 @@
@command('^stabilize',
[
- ('n', 'dry-run', False, 'Do nothing but printing what should be done')
+ ('n', 'dry-run', False, 'Do nothing but printing what should be done'),
+ ('-A', 'any', False, 'Stabilize unstable change on any topological branch'),
],
'')
def stabilize(ui, repo, **opts):
- """move changeset out of they unstable state"""
+ """move changeset out of they unstable state
+
+ By default only works on changeset that will be rebase on ancestors of the
+ current working directory parent (included)"""
+
obsolete = extensions.find('obsolete')
- unstable = list(repo.set('unstable()'))
+
+ if opts['any']:
+ rvstargets = 'unstable()'
+ else:
+ rvstargets = 'unstable() and ((suspended() and obsancestors(::.))::)'
+
+ unstable = list(repo.set(rvstargets))
if not unstable:
- ui.write_err(_('no unstable changeset\n'))
- return 1
+ unstable = opts['any'] and () or list(repo.set('unstable()'))
+ if unstable:
+ ui.write_err(_('nothing to stabilize here\n'))
+ ui.status(_('(%i unstable changesets, do you want --any ?)\n')
+ % len(unstable))
+ return 2
+ else:
+ ui.write_err(_('no unstable changeset\n'))
+ return 1
node = unstable[0]
obs = node.parents()[0]
if not obs.obsolete():
--- a/tests/test-evolve.t Thu Mar 08 14:15:53 2012 +0100
+++ b/tests/test-evolve.t Thu Mar 08 14:35:57 2012 +0100
@@ -208,6 +208,17 @@
4 feature-B: another feature - test
1 : a nifty feature - test
0 : base - test
+ $ hg up -q 1
+ Working directory parent is obsolete
+ $ hg stabilize -n
+ nothing to stabilize here
+ (1 unstable changesets, do you want --any ?)
+ [2]
+ $ hg stabilize -n --any
+ move:[4] another feature
+ atop:[6] a nifty feature
+ hg rebase -Dr f8111a076f09 -d 23409eba69a0
+ $ hg up -q 6
$ hg stabilize -n
move:[4] another feature
atop:[6] a nifty feature