comparison hg @ 69:ab03c7a52cf2

Minor changes to import so that we can successfully import Ingo's kernel history patchset.
author mpm@selenic.com
date Fri, 13 May 2005 18:22:08 -0800
parents 6fa994fe90fc
children ce080e8eccd7
comparison
equal deleted inserted replaced
68:6fa994fe90fc 69:ab03c7a52cf2
134 repo.commit(repo.current, args) 134 repo.commit(repo.current, args)
135 else: 135 else:
136 repo.commit(repo.current) 136 repo.commit(repo.current)
137 137
138 elif cmd == "import" or cmd == "patch": 138 elif cmd == "import" or cmd == "patch":
139 try:
140 import psyco
141 psyco.full()
142 except:
143 pass
144
139 ioptions = {} 145 ioptions = {}
140 opts = [('p', 'strip', 1, 'path strip'), 146 opts = [('p', 'strip', 1, 'path strip'),
141 ('b', 'base', "", 'base path'), 147 ('b', 'base', "", 'base path'),
142 ('q', 'quiet', "", 'silence diff') 148 ('q', 'quiet', "", 'silence diff')
143 ] 149 ]
152 ui.status("applying %s\n" % patch) 158 ui.status("applying %s\n" % patch)
153 pf = os.path.join(d, patch) 159 pf = os.path.join(d, patch)
154 160
155 text = "" 161 text = ""
156 for l in file(pf): 162 for l in file(pf):
157 if l[:3] == "---": break 163 if l[:4] == "--- ": break
158 text += l 164 text += l
159 165
160 if os.system("patch -p%d < %s %s" % (strip, pf, quiet)):
161 raise "patch failed!"
162 f = os.popen("lsdiff --strip %d %s" % (strip, pf)) 166 f = os.popen("lsdiff --strip %d %s" % (strip, pf))
163 files = filter(None, map(lambda x: x.rstrip(), f.read().splitlines())) 167 files = filter(None, map(lambda x: x.rstrip(), f.read().splitlines()))
164 f.close() 168 f.close()
169
170 if files:
171 if os.system("patch -p%d < %s %s" % (strip, pf, quiet)):
172 raise "patch failed!"
165 repo.commit(repo.current, files, text) 173 repo.commit(repo.current, files, text)
166 174
167 elif cmd == "status": 175 elif cmd == "status":
168 (c, a, d) = repo.diffdir(repo.root, repo.current) 176 (c, a, d) = repo.diffdir(repo.root, repo.current)
169 for f in c: print "C", f 177 for f in c: print "C", f