Mercurial > public > mercurial-scm > hg
comparison mercurial/patch.py @ 8209:a1a5a57efe90
replace util.sort with sorted built-in
This is marginally faster for small and moderately-sized lists
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 26 Apr 2009 16:50:44 -0500 |
parents | 388bb482024e |
children | 46293a0c7e9f |
comparison
equal
deleted
inserted
replaced
8208:32a2a1e244f1 | 8209:a1a5a57efe90 |
---|---|
1051 removes[gp.path] = 1 | 1051 removes[gp.path] = 1 |
1052 for src, dst in copies: | 1052 for src, dst in copies: |
1053 repo.copy(src, dst) | 1053 repo.copy(src, dst) |
1054 removes = removes.keys() | 1054 removes = removes.keys() |
1055 if (not similarity) and removes: | 1055 if (not similarity) and removes: |
1056 repo.remove(util.sort(removes), True) | 1056 repo.remove(sorted(removes), True) |
1057 for f in patches: | 1057 for f in patches: |
1058 gp = patches[f] | 1058 gp = patches[f] |
1059 if gp and gp.mode: | 1059 if gp and gp.mode: |
1060 islink, isexec = gp.mode | 1060 islink, isexec = gp.mode |
1061 dst = repo.wjoin(gp.path) | 1061 dst = repo.wjoin(gp.path) |
1066 elif gp.op != 'DELETE': | 1066 elif gp.op != 'DELETE': |
1067 util.set_flags(dst, islink, isexec) | 1067 util.set_flags(dst, islink, isexec) |
1068 cmdutil.addremove(repo, cfiles, similarity=similarity) | 1068 cmdutil.addremove(repo, cfiles, similarity=similarity) |
1069 files = patches.keys() | 1069 files = patches.keys() |
1070 files.extend([r for r in removes if r not in files]) | 1070 files.extend([r for r in removes if r not in files]) |
1071 return util.sort(files) | 1071 return sorted(files) |
1072 | 1072 |
1073 def externalpatch(patcher, args, patchname, ui, strip, cwd, files): | 1073 def externalpatch(patcher, args, patchname, ui, strip, cwd, files): |
1074 """use <patcher> to apply <patchname> to the working directory. | 1074 """use <patcher> to apply <patchname> to the working directory. |
1075 returns whether patch was applied with fuzz factor.""" | 1075 returns whether patch was applied with fuzz factor.""" |
1076 | 1076 |
1240 copy[v] = k | 1240 copy[v] = k |
1241 | 1241 |
1242 gone = {} | 1242 gone = {} |
1243 gitmode = {'l': '120000', 'x': '100755', '': '100644'} | 1243 gitmode = {'l': '120000', 'x': '100755', '': '100644'} |
1244 | 1244 |
1245 for f in util.sort(modified + added + removed): | 1245 for f in sorted(modified + added + removed): |
1246 to = None | 1246 to = None |
1247 tn = None | 1247 tn = None |
1248 dodiff = True | 1248 dodiff = True |
1249 header = [] | 1249 header = [] |
1250 if f in man1: | 1250 if f in man1: |