comparison mercurial/patch.py @ 7090:7b5c063b0b94

diff: pass contexts to status Allow status() to take contexts as well as nodes. This lets us avoid unpacking manifests multiple times and intelligently unpack manifests in revision order. Also, we can avoid unpacking manifests at all when there are no changes in the working directory.
author Matt Mackall <mpm@selenic.com>
date Sun, 12 Oct 2008 15:21:08 -0500
parents 63b5f4c73c98
children 4674706b5b95
comparison
equal deleted inserted replaced
7089:c57b30f1bc15 7090:7b5c063b0b94
1172 flctx = ctx.filectx(f, filelog=flcache.get(f)) 1172 flctx = ctx.filectx(f, filelog=flcache.get(f))
1173 if f not in flcache: 1173 if f not in flcache:
1174 flcache[f] = flctx._filelog 1174 flcache[f] = flctx._filelog
1175 return flctx 1175 return flctx
1176 1176
1177 # reading the data for node1 early allows it to play nicely
1178 # with repo.status and the revlog cache.
1179 ctx1 = repo[node1] 1177 ctx1 = repo[node1]
1180 # force manifest reading 1178 ctx2 = repo[node2]
1181 man1 = ctx1.manifest()
1182 date1 = util.datestr(ctx1.date())
1183 1179
1184 if not changes: 1180 if not changes:
1185 changes = repo.status(node1, node2, match=match) 1181 changes = repo.status(ctx1, ctx2, match=match)
1186 modified, added, removed = changes[:3] 1182 modified, added, removed = changes[:3]
1187 1183
1188 if not modified and not added and not removed: 1184 if not modified and not added and not removed:
1189 return 1185 return
1190 1186
1191 ctx2 = repo[node2] 1187 date1 = util.datestr(ctx1.date())
1188 man1 = ctx1.manifest()
1192 1189
1193 if repo.ui.quiet: 1190 if repo.ui.quiet:
1194 r = None 1191 r = None
1195 else: 1192 else:
1196 hexfunc = repo.ui.debugflag and hex or short 1193 hexfunc = repo.ui.debugflag and hex or short