# HG changeset patch
# User Matt Mackall <mpm@selenic.com>
# Date 1374727904 18000
#      Wed Jul 24 23:51:44 2013 -0500
# Branch stable
# Node ID e5a5790a318589ee865e02624368c81e978135ec
# Parent  e9351f0d9a2ab6696322bd69194c82ec4359285a
rebase: add checkunfinished support (issue3955)

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -174,6 +174,7 @@
                 raise util.Abort(_('cannot specify both a '
                                    'revision and a source'))
 
+            cmdutil.checkunfinished(repo)
             cmdutil.bailifchanged(repo)
 
             if not destf:
@@ -798,3 +799,6 @@
     entry[1].append(('t', 'tool', '',
                      _("specify merge tool for rebase")))
     cmdutil.summaryhooks.add('rebase', summaryhook)
+    cmdutil.unfinishedstates.append(
+        ['rebasestate', False, _('rebase in progress'),
+         _("use 'hg rebase --continue' or 'hg rebase --abort'")])
diff --git a/tests/test-rebase-interruptions.t b/tests/test-rebase-interruptions.t
--- a/tests/test-rebase-interruptions.t
+++ b/tests/test-rebase-interruptions.t
@@ -66,11 +66,11 @@
 
 Force a commit on C during the interruption:
 
-  $ hg up -q -C 2
+  $ hg up -q -C 2 --config 'extensions.rebase=!'
 
   $ echo 'Extra' > Extra
   $ hg add Extra
-  $ hg ci -m 'Extra'
+  $ hg ci -m 'Extra' --config 'extensions.rebase=!'
 
 Force this commit onto secret phase
 
@@ -156,11 +156,11 @@
 
 Force a commit on B' during the interruption:
 
-  $ hg up -q -C 5
+  $ hg up -q -C 5 --config 'extensions.rebase=!'
 
   $ echo 'Extra' > Extra
   $ hg add Extra
-  $ hg ci -m 'Extra'
+  $ hg ci -m 'Extra' --config 'extensions.rebase=!'
 
   $ hg tglog
   @  6: 'Extra'
@@ -227,7 +227,7 @@
 
 Change phase on B and B'
 
-  $ hg up -q -C 5
+  $ hg up -q -C 5 --config 'extensions.rebase=!'
   $ hg phase --public 1
   $ hg phase --public 5
   $ hg phase --secret -f 2