##// END OF EJS Templates
memfilectx: make changectx argument mandatory in constructor (API)...
Martin von Zweigbergk -
r35401:8a0cac20 default
parent child Browse files
Show More
@@ -376,7 +376,7 b' def synthesize(ui, repo, descpath, **opt'
376 376 dir = os.path.dirname(dir)
377 377
378 378 def filectxfn(repo, memctx, path):
379 return context.memfilectx(repo, path, files[path])
379 return context.memfilectx(repo, memctx, path, files[path])
380 380
381 381 ui.progress(_synthesizing, None)
382 382 message = 'synthesized wide repo with %d files' % (len(files),)
@@ -468,7 +468,7 b' def synthesize(ui, repo, descpath, **opt'
468 468 def filectxfn(repo, memctx, path):
469 469 if path not in changes:
470 470 return None
471 return context.memfilectx(repo, path, changes[path])
471 return context.memfilectx(repo, memctx, path, changes[path])
472 472 if not changes:
473 473 continue
474 474 if revs:
@@ -253,7 +253,7 b' class mercurial_sink(common.converter_si'
253 253 data = self._rewritetags(source, revmap, data)
254 254 if f == '.hgsubstate':
255 255 data = self._rewritesubstate(source, data)
256 return context.memfilectx(self.repo, f, data, 'l' in mode,
256 return context.memfilectx(self.repo, memctx, f, data, 'l' in mode,
257 257 'x' in mode, copies.get(f))
258 258
259 259 pl = []
@@ -401,7 +401,7 b' class mercurial_sink(common.converter_si'
401 401
402 402 data = "".join(newlines)
403 403 def getfilectx(repo, memctx, f):
404 return context.memfilectx(repo, f, data, False, False, None)
404 return context.memfilectx(repo, memctx, f, data, False, False, None)
405 405
406 406 self.ui.status(_("updating tags\n"))
407 407 date = "%s 0" % int(time.mktime(time.gmtime()))
@@ -602,7 +602,7 b' def collapse(repo, first, last, commitop'
602 602 if path in headmf:
603 603 fctx = last[path]
604 604 flags = fctx.flags()
605 mctx = context.memfilectx(repo,
605 mctx = context.memfilectx(repo, ctx,
606 606 fctx.path(), fctx.data(),
607 607 islink='l' in flags,
608 608 isexec='x' in flags,
@@ -261,7 +261,8 b' def _lfconvert_addchangeset(rsrc, rdst, '
261 261 # doesn't change after rename or copy
262 262 renamed = lfutil.standin(renamed[0])
263 263
264 return context.memfilectx(repo, f, lfiletohash[srcfname] + '\n',
264 return context.memfilectx(repo, memctx, f,
265 lfiletohash[srcfname] + '\n',
265 266 'l' in fctx.flags(), 'x' in fctx.flags(),
266 267 renamed)
267 268 else:
@@ -313,7 +314,7 b' def _getnormalcontext(repo, ctx, f, revm'
313 314 data = fctx.data()
314 315 if f == '.hgtags':
315 316 data = _converttags (repo.ui, revmap, data)
316 return context.memfilectx(repo, f, data, 'l' in fctx.flags(),
317 return context.memfilectx(repo, ctx, f, data, 'l' in fctx.flags(),
317 318 'x' in fctx.flags(), renamed)
318 319
319 320 # Remap tag data using a revision map
@@ -77,7 +77,7 b' def _commitfiltered(repo, ctx, match, al'
77 77 if path not in contentctx:
78 78 return None
79 79 fctx = contentctx[path]
80 mctx = context.memfilectx(repo, fctx.path(), fctx.data(),
80 mctx = context.memfilectx(repo, memctx, fctx.path(), fctx.data(),
81 81 fctx.islink(),
82 82 fctx.isexec(),
83 83 copied=copied.get(path))
@@ -3195,7 +3195,7 b' def amend(ui, repo, old, extra, pats, op'
3195 3195
3196 3196 fctx = wctx[path]
3197 3197 flags = fctx.flags()
3198 mctx = context.memfilectx(repo,
3198 mctx = context.memfilectx(repo, ctx_,
3199 3199 fctx.path(), fctx.data(),
3200 3200 islink='l' in flags,
3201 3201 isexec='x' in flags,
@@ -2204,12 +2204,11 b' class overlayworkingctx(committablectx):'
2204 2204 files = self._cache.keys()
2205 2205 def getfile(repo, memctx, path):
2206 2206 if self._cache[path]['exists']:
2207 return memfilectx(repo, path,
2207 return memfilectx(repo, memctx, path,
2208 2208 self._cache[path]['data'],
2209 2209 'l' in self._cache[path]['flags'],
2210 2210 'x' in self._cache[path]['flags'],
2211 self._cache[path]['copied'],
2212 memctx)
2211 self._cache[path]['copied'])
2213 2212 else:
2214 2213 # Returning None, but including the path in `files`, is
2215 2214 # necessary for memctx to register a deletion.
@@ -2389,9 +2388,9 b' def memfilefromctx(ctx):'
2389 2388 copied = fctx.renamed()
2390 2389 if copied:
2391 2390 copied = copied[0]
2392 return memfilectx(repo, path, fctx.data(),
2391 return memfilectx(repo, memctx, path, fctx.data(),
2393 2392 islink=fctx.islink(), isexec=fctx.isexec(),
2394 copied=copied, memctx=memctx)
2393 copied=copied)
2395 2394
2396 2395 return getfilectx
2397 2396
@@ -2405,9 +2404,8 b' def memfilefrompatch(patchstore):'
2405 2404 if data is None:
2406 2405 return None
2407 2406 islink, isexec = mode
2408 return memfilectx(repo, path, data, islink=islink,
2409 isexec=isexec, copied=copied,
2410 memctx=memctx)
2407 return memfilectx(repo, memctx, path, data, islink=islink,
2408 isexec=isexec, copied=copied)
2411 2409
2412 2410 return getfilectx
2413 2411
@@ -2539,8 +2537,8 b' class memfilectx(committablefilectx):'
2539 2537
2540 2538 See memctx and committablefilectx for more details.
2541 2539 """
2542 def __init__(self, repo, path, data, islink=False,
2543 isexec=False, copied=None, memctx=None):
2540 def __init__(self, repo, changectx, path, data, islink=False,
2541 isexec=False, copied=None):
2544 2542 """
2545 2543 path is the normalized file path relative to repository root.
2546 2544 data is the file content as a string.
@@ -2548,7 +2546,7 b' class memfilectx(committablefilectx):'
2548 2546 isexec is True if the file is executable.
2549 2547 copied is the source file path if current file was copied in the
2550 2548 revision being committed, or None."""
2551 super(memfilectx, self).__init__(repo, path, None, memctx)
2549 super(memfilectx, self).__init__(repo, path, None, changectx)
2552 2550 self._data = data
2553 2551 self._flags = (islink and 'l' or '') + (isexec and 'x' or '')
2554 2552 self._copied = None
@@ -225,7 +225,8 b' def debugbuilddag(ui, repo, text=None,'
225 225
226 226 def fctxfn(repo, cx, path):
227 227 if path in filecontent:
228 return context.memfilectx(repo, path, filecontent[path])
228 return context.memfilectx(repo, cx, path,
229 filecontent[path])
229 230 return None
230 231
231 232 if len(ps) == 0 or ps[0] < 0:
@@ -648,7 +648,8 b' verify pathauditor blocks evil filepaths'
648 648 > u = uimod.ui.load()
649 649 > r = hg.repository(u, '.')
650 650 > def filectxfn(repo, memctx, path):
651 > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned')
651 > return context.memfilectx(repo, memctx, path,
652 > '[hooks]\nupdate = echo owned')
652 653 > c = context.memctx(r, [r['tip'].node(), node.nullid],
653 654 > 'evil', [notrc], filectxfn, 0)
654 655 > r.commitctx(c)
@@ -673,7 +674,8 b' verify pathauditor blocks evil filepaths'
673 674 > u = uimod.ui.load()
674 675 > r = hg.repository(u, '.')
675 676 > def filectxfn(repo, memctx, path):
676 > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned')
677 > return context.memfilectx(repo, memctx, path,
678 > '[hooks]\nupdate = echo owned')
677 679 > c = context.memctx(r, [r['tip'].node(), node.nullid],
678 680 > 'evil', [notrc], filectxfn, 0)
679 681 > r.commitctx(c)
@@ -692,7 +694,8 b' verify pathauditor blocks evil filepaths'
692 694 > u = uimod.ui.load()
693 695 > r = hg.repository(u, '.')
694 696 > def filectxfn(repo, memctx, path):
695 > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned')
697 > return context.memfilectx(repo, memctx, path,
698 > '[hooks]\nupdate = echo owned')
696 699 > c = context.memctx(r, [r['tip'].node(), node.nullid],
697 700 > 'evil', [notrc], filectxfn, 0)
698 701 > r.commitctx(c)
@@ -32,7 +32,7 b' print("workingfilectx.date = (%d, %d)" %'
32 32 # test memctx with non-ASCII commit message
33 33
34 34 def filectxfn(repo, memctx, path):
35 return context.memfilectx(repo, "foo", "")
35 return context.memfilectx(repo, memctx, "foo", "")
36 36
37 37 ctx = context.memctx(repo, ['tip', None],
38 38 encoding.tolocal("Gr\xc3\xbcezi!"),
@@ -49,7 +49,7 b' def getfilectx(repo, memctx, f):'
49 49 data, flags = fctx.data(), fctx.flags()
50 50 if f == 'foo':
51 51 data += 'bar\n'
52 return context.memfilectx(repo, f, data, 'l' in flags, 'x' in flags)
52 return context.memfilectx(repo, memctx, f, data, 'l' in flags, 'x' in flags)
53 53
54 54 ctxa = repo.changectx(0)
55 55 ctxb = context.memctx(repo, [ctxa.node(), None], "test diff", ["foo"],
General Comments 0
You need to be logged in to leave comments. Login now