changeset 50:0263ce8be574

Add -q option to import Make import complain if patching fails
author mpm@selenic.com
date Wed, 11 May 2005 14:06:34 -0800
parents 14bff5d8e526
children 0cbcdb855156
files hg
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hg	Wed May 11 13:56:22 2005 -0800
+++ b/hg	Wed May 11 14:06:34 2005 -0800
@@ -133,12 +133,15 @@
 elif cmd == "import" or cmd == "patch":
     ioptions = {}
     opts = [('p', 'strip', 1, 'path strip'),
-            ('b', 'base', "", 'base path')]
+            ('b', 'base', "", 'base path'),
+            ('q', 'quiet', "", 'silence diff')
+            ]
     
     args = fancyopts.fancyopts(args, opts, ioptions,
                               'hg import [options] <patch names>')
     d = ioptions["base"]
     strip = ioptions["strip"]
+    quiet = ioptions["quiet"] and "> /dev/null" or ""
 
     for patch in args:
         ui.status("applying %s\n" % patch)
@@ -149,7 +152,8 @@
             if l[:3] == "---": break
 	    text += l
 	    
-        os.system("patch -p%d < %s > /dev/null" % (strip, pf))
+        if os.system("patch -p%d < %s %s" % (strip, pf, quiet)):
+            raise "patch failed!"
         f = os.popen("lsdiff --strip %d %s" % (strip, pf))
         files = f.read().splitlines()
         f.close()