Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 35406:dffc35a5be9f
debugbuilddag: create filectx instance in 'filectxfn' callback
Same motivation is previous patch.
Differential Revision: https://phab.mercurial-scm.org/D1670
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sat, 09 Dec 2017 14:22:12 -0800 |
parents | 12055fb3ba30 |
children | 8a0cac20a1ad |
comparison
equal
deleted
inserted
replaced
35405:2123e7629ec0 | 35406:dffc35a5be9f |
---|---|
181 if type == 'n': | 181 if type == 'n': |
182 ui.note(('node %s\n' % str(data))) | 182 ui.note(('node %s\n' % str(data))) |
183 id, ps = data | 183 id, ps = data |
184 | 184 |
185 files = [] | 185 files = [] |
186 fctxs = {} | 186 filecontent = {} |
187 | 187 |
188 p2 = None | 188 p2 = None |
189 if mergeable_file: | 189 if mergeable_file: |
190 fn = "mf" | 190 fn = "mf" |
191 p1 = repo[ps[0]] | 191 p1 = repo[ps[0]] |
202 else: | 202 else: |
203 ml = initialmergedlines | 203 ml = initialmergedlines |
204 ml[id * linesperrev] += " r%i" % id | 204 ml[id * linesperrev] += " r%i" % id |
205 mergedtext = "\n".join(ml) | 205 mergedtext = "\n".join(ml) |
206 files.append(fn) | 206 files.append(fn) |
207 fctxs[fn] = context.memfilectx(repo, fn, mergedtext) | 207 filecontent[fn] = mergedtext |
208 | 208 |
209 if overwritten_file: | 209 if overwritten_file: |
210 fn = "of" | 210 fn = "of" |
211 files.append(fn) | 211 files.append(fn) |
212 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) | 212 filecontent[fn] = "r%i\n" % id |
213 | 213 |
214 if new_file: | 214 if new_file: |
215 fn = "nf%i" % id | 215 fn = "nf%i" % id |
216 files.append(fn) | 216 files.append(fn) |
217 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) | 217 filecontent[fn] = "r%i\n" % id |
218 if len(ps) > 1: | 218 if len(ps) > 1: |
219 if not p2: | 219 if not p2: |
220 p2 = repo[ps[1]] | 220 p2 = repo[ps[1]] |
221 for fn in p2: | 221 for fn in p2: |
222 if fn.startswith("nf"): | 222 if fn.startswith("nf"): |
223 files.append(fn) | 223 files.append(fn) |
224 fctxs[fn] = p2[fn] | 224 filecontent[fn] = p2[fn].data() |
225 | 225 |
226 def fctxfn(repo, cx, path): | 226 def fctxfn(repo, cx, path): |
227 return fctxs.get(path) | 227 if path in filecontent: |
228 return context.memfilectx(repo, path, filecontent[path]) | |
229 return None | |
228 | 230 |
229 if len(ps) == 0 or ps[0] < 0: | 231 if len(ps) == 0 or ps[0] < 0: |
230 pars = [None, None] | 232 pars = [None, None] |
231 elif len(ps) == 1: | 233 elif len(ps) == 1: |
232 pars = [nodeids[ps[0]], None] | 234 pars = [nodeids[ps[0]], None] |