Commits

Pierre-Yves David committed 4a039a8

stabilize: --continue support !!!

Based on graft one.

  • Participants
  • Parent commits d88c761
  • Branches default

Comments (0)

Files changed (2)

 
 @command('^stabilize|evolve|solve',
     [('n', 'dry-run', False, 'do not perform actions, print what to be done'),
-    ('A', 'any', False, 'stabilize any unstable changeset'),],
+    ('A', 'any', False, 'stabilize any unstable changeset'),
+    ('c', 'continue', False, 'continue an interrupted stabilized'), ],
     _('[OPTIONS]...'))
 def stabilize(ui, repo, **opts):
     """rebase an unstable changeset to make it stable again
     The working directory is updated to the rebased revision.
     """
 
+    contopt = opts['continue']
+    anyopt = opts['any']
+
+    if contopt:
+        if anyopt:
+            raise util.Abort('can not specify both "--any" and "--continue"')
+        graftcmd = commands.table['graft'][0]
+        return graftcmd(ui, repo, old_obsolete=True, **{'continue': True})
+
     obsolete = extensions.find('obsolete')
 
     orig = None
         try:
             relocate(repo, orig, target)
         except MergeFailure:
-            repo.ui.write_err(_('/!\\ stabilize failed                          /!\\\n'))
-            repo.ui.write_err(_('/!\\ Their is no "hg stabilize --continue"     /!\\\n'))
-            repo.ui.write_err(_('/!\\ use "hg up -C . ; hg stabilize --dry-run" /!\\\n'))
+            repo.opener.write('graftstate', orig.hex() + '\n')
+            repo.ui.write_err(_('stabilize failed!\n'))
+            repo.ui.write_err(_('fix conflict and run "hg stabilize --continue"\n'))
             raise
         finally:
             lock.release()

tests/test-stabilize-result.t

   41ad4fe8c79565a06c89f032ef0937b3cbd68a04 1447e1c4828d2347df8f858aa041305fa4cf7db1 0 {'date': '* *', 'user': 'test'} (glob)
   102a90ea7b4a3361e4082ed620918c261189a36a 1447e1c4828d2347df8f858aa041305fa4cf7db1 0 {'date': '* *', 'user': 'test'} (glob)
   cce2c55b896511e0b6e04173c9450ba822ebc740 0 {'date': '* *', 'user': 'test'} (glob)
+
+Test stabilize with conflict
+
+  $ ls
+  a
+  b
+  $ hg pdiff a
+  diff -r 07f494440405 a
+  --- a/a	* (glob)
+  +++ b/a	* (glob)
+  @@ -1,1 +1,2 @@
+   a
+  +a
+  $ echo 'newer a' >> a
+  $ hg ci -m 'newer a'
+  $ hg gdown
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  [4] changea
+  $ echo 'a' > a
+  $ hg amend
+  1 new unstables changesets
+  $ hg stabilize
+  move:[5] newer a
+  atop:[7] changea
+  merging a
+  warning: conflicts during merge.
+  merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
+  stabilize failed!
+  fix conflict and run "hg stabilize --continue"
+  abort: unresolved merge conflicts (see hg help resolve)
+  [255]
+  $ hg revert -r 'unstable()' a
+  $ hg diff
+  diff -r e8cc1b534401 a
+  --- a/a	* (glob)
+  +++ b/a	* (glob)
+  @@ -1,1 +1,3 @@
+   a
+  +a
+  +newer a
+  $ hg stabilize --continue
+  grafting revision 5
+  abort: unresolved merge conflicts (see hg help resolve)
+  [255]
+  $ hg resolve -m a
+  $ hg stabilize --continue
+  grafting revision 5