chiark / gitweb /
Infrastructure for current directory handling
[stgit] / stgit / commands / rebase.py
index d132b60bce951d60b724e1fd767822074524fd4c..bbb3e1223470ae84911174ab503076e1dee7023a 100644 (file)
@@ -29,14 +29,12 @@ usage = """%prog [options] <new-base-id>
 Pop all patches from current stack, move the stack base to the given
 <new-base-id> and push the patches back."""
 
+directory = DirectoryHasRepository()
 options = [make_option('-n', '--nopush',
                        help = 'do not push the patches back after rebasing',
                        action = 'store_true'),
            make_option('-m', '--merged',
                        help = 'check for patches merged upstream',
-                       action = 'store_true'),
-           make_option('--force',
-                       help = 'force rebase even if the stack based was moved by (un)commits',
                        action = 'store_true')]
 
 def func(parser, options, args):
@@ -52,7 +50,11 @@ def func(parser, options, args):
     check_conflicts()
     check_head_top_equal()
 
-    applied = prepare_rebase(real_rebase=True, force=options.force)
+    # ensure an exception is raised before popping on non-existent target
+    if git_id(args[0]) == None:
+        raise GitException, 'Unknown revision: %s' % args[0]
+        
+    applied = prepare_rebase()
     rebase(args[0])
     post_rebase(applied, options.nopush, options.merged)