comparison mercurial/patch.py @ 6758:87c704ac92d4

Check that git patches only touch files under root
author Brendan Cully <brendan@kublai.com>
date Wed, 25 Jun 2008 14:13:20 -0700
parents f6c00b17387c
children 4faaa0535ea7
comparison
equal deleted inserted replaced
6757:55c71226eceb 6758:87c704ac92d4
1037 current_file, current_hunk = None, None 1037 current_file, current_hunk = None, None
1038 rejects += 1 1038 rejects += 1
1039 continue 1039 continue
1040 elif state == 'git': 1040 elif state == 'git':
1041 gitpatches = values 1041 gitpatches = values
1042 cwd = os.getcwd()
1042 for gp in gitpatches: 1043 for gp in gitpatches:
1043 if gp.op in ('COPY', 'RENAME'): 1044 if gp.op in ('COPY', 'RENAME'):
1044 copyfile(gp.oldpath, gp.path) 1045 src, dst = [util.canonpath(cwd, cwd, x)
1046 for x in [gp.oldpath, gp.path]]
1047 copyfile(src, dst)
1045 changed[gp.path] = (gp.op, gp) 1048 changed[gp.path] = (gp.op, gp)
1046 else: 1049 else:
1047 raise util.Abort(_('unsupported parser state: %s') % state) 1050 raise util.Abort(_('unsupported parser state: %s') % state)
1048 1051
1049 rejects += closefile() 1052 rejects += closefile()