Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/commands.py @ 1285:1546c2aa6b30
Make 'hg import' platform independent.
- moved popen("patch ...") from commands.py to util.py
- files may not be single quoted in popen under windows: fixed
- patch returns the files quoted under windows. quotes need to
be stripped off: fixed
author | Volker Kleinfeld <Volker.Kleinfeld@gmx.de> |
---|---|
date | Tue, 20 Sep 2005 21:35:51 -0700 |
parents | 84df9951532a |
children | 4f08da74cae8 abcdf14449ea 332f225b835c |
comparison
equal
deleted
inserted
replaced
1284:59d07a6bd513 | 1285:1546c2aa6b30 |
---|---|
1171 message = "imported patch %s\n" % patch | 1171 message = "imported patch %s\n" % patch |
1172 else: | 1172 else: |
1173 message = "%s\n" % '\n'.join(message) | 1173 message = "%s\n" % '\n'.join(message) |
1174 ui.debug('message:\n%s\n' % message) | 1174 ui.debug('message:\n%s\n' % message) |
1175 | 1175 |
1176 f = os.popen("patch -p%d < '%s'" % (strip, pf)) | 1176 files = util.patch(strip, pf, ui) |
1177 files = [] | |
1178 for l in f.read().splitlines(): | |
1179 l.rstrip('\r\n'); | |
1180 ui.status("%s\n" % l) | |
1181 if l.startswith('patching file '): | |
1182 pf = l[14:] | |
1183 if pf not in files: | |
1184 files.append(pf) | |
1185 patcherr = f.close() | |
1186 if patcherr: | |
1187 raise util.Abort("patch failed") | |
1188 | 1177 |
1189 if len(files) > 0: | 1178 if len(files) > 0: |
1190 addremove(ui, repo, *files) | 1179 addremove(ui, repo, *files) |
1191 repo.commit(files, message, user) | 1180 repo.commit(files, message, user) |
1192 | 1181 |