1002 ignorews=get('ignore_all_space', 'ignorews'), |
1002 ignorews=get('ignore_all_space', 'ignorews'), |
1003 ignorewsamount=get('ignore_space_change', 'ignorewsamount'), |
1003 ignorewsamount=get('ignore_space_change', 'ignorewsamount'), |
1004 ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines'), |
1004 ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines'), |
1005 context=get('unified', getter=ui.config)) |
1005 context=get('unified', getter=ui.config)) |
1006 |
1006 |
1007 def updatedir(ui, repo, patches): |
1007 def updatedir(ui, repo, patches, similarity=0): |
1008 '''Update dirstate after patch application according to metadata''' |
1008 '''Update dirstate after patch application according to metadata''' |
1009 if not patches: |
1009 if not patches: |
1010 return |
1010 return |
1011 copies = [] |
1011 copies = [] |
1012 removes = {} |
1012 removes = {} |
1026 elif gp.op == 'DELETE': |
1026 elif gp.op == 'DELETE': |
1027 removes[gp.path] = 1 |
1027 removes[gp.path] = 1 |
1028 for src, dst in copies: |
1028 for src, dst in copies: |
1029 repo.copy(src, dst) |
1029 repo.copy(src, dst) |
1030 removes = removes.keys() |
1030 removes = removes.keys() |
1031 if removes: |
1031 if (not similarity) and removes: |
1032 repo.remove(util.sort(removes), True) |
1032 repo.remove(util.sort(removes), True) |
1033 for f in patches: |
1033 for f in patches: |
1034 gp = patches[f] |
1034 gp = patches[f] |
1035 if gp and gp.mode: |
1035 if gp and gp.mode: |
1036 islink, isexec = gp.mode |
1036 islink, isexec = gp.mode |
1039 if gp.op == 'ADD' and not os.path.exists(dst): |
1039 if gp.op == 'ADD' and not os.path.exists(dst): |
1040 flags = (isexec and 'x' or '') + (islink and 'l' or '') |
1040 flags = (isexec and 'x' or '') + (islink and 'l' or '') |
1041 repo.wwrite(gp.path, '', flags) |
1041 repo.wwrite(gp.path, '', flags) |
1042 else: |
1042 else: |
1043 util.set_flags(dst, islink, isexec) |
1043 util.set_flags(dst, islink, isexec) |
1044 cmdutil.addremove(repo, cfiles) |
1044 cmdutil.addremove(repo, cfiles, similarity=similarity) |
1045 files = patches.keys() |
1045 files = patches.keys() |
1046 files.extend([r for r in removes if r not in files]) |
1046 files.extend([r for r in removes if r not in files]) |
1047 return util.sort(files) |
1047 return util.sort(files) |
1048 |
1048 |
1049 def externalpatch(patcher, args, patchname, ui, strip, cwd, files): |
1049 def externalpatch(patcher, args, patchname, ui, strip, cwd, files): |