Check whether the file exists in the fold command
authorCatalin Marinas <catalin.marinas@gmail.com>
Sun, 5 Feb 2006 10:31:27 +0000 (10:31 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Sun, 5 Feb 2006 10:31:27 +0000 (10:31 +0000)
This is to avoid an error reported by GIT.

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

index a9bb7fa..8b796ca 100644 (file)
@@ -60,7 +60,10 @@ def func(parser, options, args):
         raise CmdException, 'No patches applied'
 
     if filename:
-        print 'Folding patch "%s"...' % filename,
+        if os.path.exists(filename):
+            print 'Folding patch "%s"...' % filename,
+        else:
+            raise CmdException, 'No such file: %s' % filename
     else:
         print 'Folding patch from stdin...',
     sys.stdout.flush()