Infrastructure for current directory handling
[stgit] / stgit / commands / rm.py
index 2005005..59d098b 100644 (file)
@@ -30,6 +30,7 @@ usage = """%prog [options] <files...>
 Remove given files from the repository. The command doesn't remove the
 working copy of the file."""
 
 Remove given files from the repository. The command doesn't remove the
 working copy of the file."""
 
+directory = DirectoryHasRepository()
 options = [make_option('-f', '--force',
                        help = 'force removing even if the file exists',
                        action = 'store_true')]
 options = [make_option('-f', '--force',
                        help = 'force removing even if the file exists',
                        action = 'store_true')]
@@ -41,4 +42,7 @@ def func(parser, options, args):
     if len(args) < 1:
         parser.error('incorrect number of arguments')
 
     if len(args) < 1:
         parser.error('incorrect number of arguments')
 
+    if not crt_series.get_current():
+        raise CmdException, 'No patches applied'
+
     git.rm(args, options.force)
     git.rm(args, options.force)