# HG changeset patch # User Pierre-Yves David # Date 1331213757 -3600 # Node ID 928f217c17016e7f1d977ba34f1fd8692723d12c # Parent f387658d6d22f8a33581a49e25a784dc17591599 stabilize: stabilize my topological branch only if not stated otherwize. diff -r f387658d6d22 -r 928f217c1701 hgext/evolve.py --- 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(): diff -r f387658d6d22 -r 928f217c1701 tests/test-evolve.t --- 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