diff options
author | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-08-22 14:49:51 +0100 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-08-22 14:49:51 +0100 |
commit | a498da43c7fdb9f24b73680c02a4a3588cc62d9a (patch) | |
tree | daf8119dae1749b5165b68033a1b23a7375ce9ce /tests/test-context.py | |
download | mercurial-tarball-a498da43c7fdb9f24b73680c02a4a3588cc62d9a.tar.gz |
Tarball conversion
Diffstat (limited to 'tests/test-context.py')
-rw-r--r-- | tests/test-context.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test-context.py b/tests/test-context.py new file mode 100644 index 0000000..e54e526 --- /dev/null +++ b/tests/test-context.py @@ -0,0 +1,32 @@ +import os +from mercurial import hg, ui, context, encoding + +u = ui.ui() + +repo = hg.repository(u, 'test1', create=1) +os.chdir('test1') + +# create 'foo' with fixed time stamp +f = open('foo', 'w') +f.write('foo\n') +f.close() +os.utime('foo', (1000, 1000)) + +# add+commit 'foo' +repo[None].add(['foo']) +repo.commit(text='commit1', date="0 0") + +print "workingfilectx.date =", repo[None]['foo'].date() + +# test memctx with non-ASCII commit message + +def filectxfn(repo, memctx, path): + return context.memfilectx("foo", "") + +ctx = context.memctx(repo, ['tip', None], + encoding.tolocal("Gr\xc3\xbcezi!"), + ["foo"], filectxfn) +ctx.commit() +for enc in "ASCII", "Latin-1", "UTF-8": + encoding.encoding = enc + print "%-8s: %s" % (enc, repo["tip"].description()) |