30 print("workingfilectx.date = (%d, %d)" % d) |
30 print("workingfilectx.date = (%d, %d)" % d) |
31 |
31 |
32 # test memctx with non-ASCII commit message |
32 # test memctx with non-ASCII commit message |
33 |
33 |
34 def filectxfn(repo, memctx, path): |
34 def filectxfn(repo, memctx, path): |
35 return context.memfilectx(repo, "foo", "") |
35 return context.memfilectx(repo, memctx, "foo", "") |
36 |
36 |
37 ctx = context.memctx(repo, ['tip', None], |
37 ctx = context.memctx(repo, ['tip', None], |
38 encoding.tolocal("Gr\xc3\xbcezi!"), |
38 encoding.tolocal("Gr\xc3\xbcezi!"), |
39 ["foo"], filectxfn) |
39 ["foo"], filectxfn) |
40 ctx.commit() |
40 ctx.commit() |
47 def getfilectx(repo, memctx, f): |
47 def getfilectx(repo, memctx, f): |
48 fctx = memctx.parents()[0][f] |
48 fctx = memctx.parents()[0][f] |
49 data, flags = fctx.data(), fctx.flags() |
49 data, flags = fctx.data(), fctx.flags() |
50 if f == 'foo': |
50 if f == 'foo': |
51 data += 'bar\n' |
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 ctxa = repo.changectx(0) |
54 ctxa = repo.changectx(0) |
55 ctxb = context.memctx(repo, [ctxa.node(), None], "test diff", ["foo"], |
55 ctxb = context.memctx(repo, [ctxa.node(), None], "test diff", ["foo"], |
56 getfilectx, ctxa.user(), ctxa.date()) |
56 getfilectx, ctxa.user(), ctxa.date()) |
57 |
57 |