1. Pierre-Yves David
  2. mutable-history

Commits

Pierre-Yves David  committed 928f217

stabilize: stabilize my topological branch only

if not stated otherwize.

  • Participants
  • Parent commits f387658
  • Branches default

Comments (0)

Files changed (2)

File hgext/evolve.py

View file
 
 @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():

File tests/test-evolve.t

View file
   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