tests/test-context.py
author Matt Mackall <mpm@selenic.com>
Thu, 26 Jun 2008 13:46:29 -0500
changeset 6740 b148e9099133
parent 6212 e75aab656f46
child 6747 f6c00b17387c
permissions -rw-r--r--
use repo.changectx(None) to get a workingctx
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4110
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     1
import os
6212
e75aab656f46 Remove unused imports
Joel Rosdahl <joel@rosdahl.net>
parents: 5094
diff changeset
     2
from mercurial import hg, ui
4110
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     3
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     4
u = ui.ui()
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     5
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     6
repo = hg.repository(u, 'test1', create=1)
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     7
os.chdir('test1')
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     8
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     9
# create 'foo' with fixed time stamp
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    10
f = file('foo', 'w')
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    11
f.write('foo\n')
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    12
f.close()
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    13
os.utime('foo', (1000, 1000))
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    14
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    15
# add+commit 'foo'
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    16
repo.add(['foo'])
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    17
repo.commit(text='commit1', date="0 0")
20af6a2f0b0e Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    18
6740
b148e9099133 use repo.changectx(None) to get a workingctx
Matt Mackall <mpm@selenic.com>
parents: 6212
diff changeset
    19
print "workingfilectx.date =", repo.changectx(None).filectx('foo').date()