comparison mercurial/patch.py @ 6762:f67d1468ac50

util: add sort helper
author Matt Mackall <mpm@selenic.com>
date Fri, 27 Jun 2008 18:28:45 -0500
parents 4faaa0535ea7
children b2c4be19d7b1
comparison
equal deleted inserted replaced
6761:cb981fc955fb 6762:f67d1468ac50
1092 removes[gp.path] = 1 1092 removes[gp.path] = 1
1093 for src, dst in copies: 1093 for src, dst in copies:
1094 repo.copy(src, dst) 1094 repo.copy(src, dst)
1095 removes = removes.keys() 1095 removes = removes.keys()
1096 if removes: 1096 if removes:
1097 removes.sort() 1097 repo.remove(util.sort(removes), True)
1098 repo.remove(removes, True)
1099 for f in patches: 1098 for f in patches:
1100 ctype, gp = patches[f] 1099 ctype, gp = patches[f]
1101 if gp and gp.mode: 1100 if gp and gp.mode:
1102 flags = '' 1101 flags = ''
1103 if gp.mode & 0100: 1102 if gp.mode & 0100:
1111 else: 1110 else:
1112 util.set_flags(dst, flags) 1111 util.set_flags(dst, flags)
1113 cmdutil.addremove(repo, cfiles) 1112 cmdutil.addremove(repo, cfiles)
1114 files = patches.keys() 1113 files = patches.keys()
1115 files.extend([r for r in removes if r not in files]) 1114 files.extend([r for r in removes if r not in files])
1116 files.sort() 1115 return util.sort(files)
1117
1118 return files
1119 1116
1120 def b85diff(to, tn): 1117 def b85diff(to, tn):
1121 '''print base85-encoded binary diff''' 1118 '''print base85-encoded binary diff'''
1122 def gitindex(text): 1119 def gitindex(text):
1123 if not text: 1120 if not text:
1206 if opts.git: 1203 if opts.git:
1207 copy, diverge = copies.copies(repo, ctx1, ctx2, repo[nullid]) 1204 copy, diverge = copies.copies(repo, ctx1, ctx2, repo[nullid])
1208 for k, v in copy.items(): 1205 for k, v in copy.items():
1209 copy[v] = k 1206 copy[v] = k
1210 1207
1211 all = modified + added + removed
1212 all.sort()
1213 gone = {} 1208 gone = {}
1214
1215 gitmode = {'l': '120000', 'x': '100755', '': '100644'} 1209 gitmode = {'l': '120000', 'x': '100755', '': '100644'}
1216 1210
1217 for f in all: 1211 for f in util.sort(modified + added + removed):
1218 to = None 1212 to = None
1219 tn = None 1213 tn = None
1220 dodiff = True 1214 dodiff = True
1221 header = [] 1215 header = []
1222 if f in man1: 1216 if f in man1: