comparison mercurial/commands.py @ 355:3e18360a8912

hg import: better file accounting -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hg import: better file accounting From: Chris Mason <mason@suse.com> Change hg import to call hg addremove with the file list to make sure files added/deleted by the patch are properly accounted for. Instead of using lsdiff, the output of patch is parsed directly to find the file list. manifest hash: defed8cb90d6f976fb47949ac03dc4b88870ba77 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCsG1BywK+sNU5EO8RAvV9AJ9H25L5vdnZB1xpAakuN3tGuMfRfgCfdAgP 3xBc3S4F74/7DdS2GXRNhGw= =oXXT -----END PGP SIGNATURE-----
author mpm@selenic.com
date Wed, 15 Jun 2005 10:02:41 -0800
parents e3667e3a18ac
children ae96b7e1318d
comparison
equal deleted inserted replaced
354:e3667e3a18ac 355:3e18360a8912
438 text += l 438 text += l
439 439
440 # make sure text isn't empty 440 # make sure text isn't empty
441 if not text: text = "imported patch %s\n" % patch 441 if not text: text = "imported patch %s\n" % patch
442 442
443 f = os.popen("lsdiff --strip %d %s" % (strip, pf)) 443 f = os.popen("patch -p%d < %s" % (strip, pf))
444 files = filter(None, map(lambda x: x.rstrip(), f.read().splitlines())) 444 files = []
445 for l in f.read().splitlines():
446 l.rstrip('\r\n');
447 if not quiet:
448 print l
449 if l[:14] == 'patching file ':
450 files.append(l[14:])
445 f.close() 451 f.close()
446 452
447 if files: 453 if len(files) > 0:
448 if os.system("patch -p%d < %s %s" % (strip, pf, quiet)): 454 addremove(ui, repo, *files)
449 raise "patch failed!"
450 repo.commit(files, text) 455 repo.commit(files, text)
451 456
452 def pull(ui, repo, source="default"): 457 def pull(ui, repo, source="default"):
453 """pull changes from the specified source""" 458 """pull changes from the specified source"""
454 paths = {} 459 paths = {}