##// END OF EJS Templates
import: use gpatch if present on system. patch is broken on solaris....
Vadim Gelfer -
r2071:67a0a385 default
parent child Browse files
Show More
@@ -71,10 +71,23 b' def filter(s, cmd):'
71 71 return fn(s, cmd[len(name):].lstrip())
72 72 return pipefilter(s, cmd)
73 73
74 def find_in_path(name, path, default=None):
75 '''find name in search path. path can be string (will be split
76 with os.pathsep), or iterable thing that returns strings. if name
77 found, return path to name. else return default.'''
78 if isinstance(path, str):
79 path = path.split(os.pathsep)
80 for p in path:
81 p_name = os.path.join(p, name)
82 if os.path.exists(p_name):
83 return p_name
84 return default
85
74 86 def patch(strip, patchname, ui):
75 87 """apply the patch <patchname> to the working directory.
76 88 a list of patched files is returned"""
77 fp = os.popen('patch -p%d < "%s"' % (strip, patchname))
89 patcher = find_in_path('gpatch', os.environ.get('PATH', ''), 'patch')
90 fp = os.popen('"%s" -p%d < "%s"' % (patcher, strip, patchname))
78 91 files = {}
79 92 for line in fp:
80 93 line = line.rstrip()
General Comments 0
You need to be logged in to leave comments. Login now