Add --force option to new
authorCatalin Marinas <catalin.marinas@gmail.com>
Fri, 15 Jul 2005 14:31:17 +0000 (15:31 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Fri, 15 Jul 2005 14:31:17 +0000 (15:31 +0100)
This option creates a new patch even if there are local changes in the
tree. It is useful if one starts modifying the tree but forgot to create
a patch for it.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/commands/new.py

index c018195..c36e109 100644 (file)
@@ -29,6 +29,9 @@ usage = '%prog [options] <name>'
 
 options = [make_option('-m', '--message',
                        help = 'use MESSAGE as the patch description'),
+           make_option('--force',
+                       help = 'proceed even if there are local changes',
+                       action = 'store_true'),
            make_option('-a', '--author', metavar = '"NAME <EMAIL>"',
                        help = 'use "NAME <EMAIL>" as the author details'),
            make_option('--authname',
@@ -49,9 +52,10 @@ def func(parser, options, args):
     if len(args) != 1:
         parser.error('incorrect number of arguments')
 
-    check_local_changes()
-    check_conflicts()
-    check_head_top_equal()
+    if not options.force:
+        check_local_changes()
+        check_conflicts()
+        check_head_top_equal()
 
     if options.author:
         options.authname, options.authemail = name_email(options.author)