##// END OF EJS Templates
debian: switch to using debhelper and dh_python2 to build debs...
debian: switch to using debhelper and dh_python2 to build debs This is a much larger commit than I'd like, but I honestly don't see a good way to break it up and leave things working. Summary: We now use debian/rules with debhelper to build our debs. This is much more standard, and means we use dh_python2 to do things like handle leaving .pyc files out of the built debs. The resulting package is split into mercurial and mercurial-common, with the former being the hg stub and all the native .sos, and the latter being basically everything else. builddeb and dockerdeb are updated to use the new system. The old way (using dpkg by hand) breaks with the above changes because debian/control no longer contains a version string (that's now guessed from the phony changelog.) Tests are updated to assert that the right files end up in the right debs.

File last commit:

r24180:d8e0c591 default
r26148:7f49efca default
Show More
test-context.py
138 lines | 4.1 KiB | text/x-python | PythonLexer
Thomas Arendsen Hein
Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
r4110 import os
Martin Geisler
changelog: convert user and desc from local encoding early...
r14379 from mercurial import hg, ui, context, encoding
Thomas Arendsen Hein
Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
r4110
u = ui.ui()
repo = hg.repository(u, 'test1', create=1)
os.chdir('test1')
# create 'foo' with fixed time stamp
FUJIWARA Katsunori
tests: open file in binary mode to use POSIX end-of-line style anywhere...
r23060 f = open('foo', 'wb')
Thomas Arendsen Hein
Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
r4110 f.write('foo\n')
f.close()
os.utime('foo', (1000, 1000))
# add+commit 'foo'
Dirkjan Ochtman
move working dir/dirstate methods from localrepo to workingctx
r11303 repo[None].add(['foo'])
Thomas Arendsen Hein
Fixed workingfilectx.date() (found by Thomas Waldmann) with test.
r4110 repo.commit(text='commit1', date="0 0")
Matt Mackall
use repo[changeid] to get a changectx
r6747 print "workingfilectx.date =", repo[None]['foo'].date()
Martin Geisler
changelog: convert user and desc from local encoding early...
r14379
# test memctx with non-ASCII commit message
def filectxfn(repo, memctx, path):
Sean Farley
memfilectx: call super.__init__ instead of duplicating code...
r21689 return context.memfilectx(repo, "foo", "")
Martin Geisler
changelog: convert user and desc from local encoding early...
r14379
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())
Sean Farley
test-context: add test for memctx status
r21836
# test performing a status
def getfilectx(repo, memctx, f):
fctx = memctx.parents()[0][f]
data, flags = fctx.data(), fctx.flags()
if f == 'foo':
data += 'bar\n'
return context.memfilectx(repo, f, data, 'l' in flags, 'x' in flags)
ctxa = repo.changectx(0)
Sean Farley
test-context: add test for performing a diff on a memctx...
r21837 ctxb = context.memctx(repo, [ctxa.node(), None], "test diff", ["foo"],
getfilectx, ctxa.user(), ctxa.date())
Sean Farley
test-context: add test for memctx status
r21836
print ctxb.status(ctxa)
Sean Farley
test-context: add test for performing a diff on a memctx...
r21837
# test performing a diff on a memctx
for d in ctxb.diff(ctxa, git=True):
print d
FUJIWARA Katsunori
context: cache self._status correctly at workingctx.status...
r23700
Mads Kiilerich
spelling: fixes from proofreading of spell checker issues
r24180 # test safeness and correctness of "ctx.status()"
FUJIWARA Katsunori
context: cache self._status correctly at workingctx.status...
r23700 print '= checking context.status():'
# ancestor "wcctx ~ 2"
actx2 = repo['.']
repo.wwrite('bar-m', 'bar-m\n', '')
repo.wwrite('bar-r', 'bar-r\n', '')
repo[None].add(['bar-m', 'bar-r'])
repo.commit(text='add bar-m, bar-r', date="0 0")
# ancestor "wcctx ~ 1"
actx1 = repo['.']
repo.wwrite('bar-m', 'bar-m bar-m\n', '')
repo.wwrite('bar-a', 'bar-a\n', '')
repo[None].add(['bar-a'])
repo[None].forget(['bar-r'])
# status at this point:
# M bar-m
# A bar-a
# R bar-r
# C foo
from mercurial import scmutil
print '== checking workingctx.status:'
wctx = repo[None]
print 'wctx._status=%s' % (str(wctx._status))
FUJIWARA Katsunori
context: make unknown/ignored/clean of cached status empty for equivalence...
r23709 print '=== with "pattern match":'
FUJIWARA Katsunori
context: cache self._status correctly at workingctx.status...
r23700 print actx1.status(other=wctx,
match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
print 'wctx._status=%s' % (str(wctx._status))
print actx2.status(other=wctx,
match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
print 'wctx._status=%s' % (str(wctx._status))
FUJIWARA Katsunori
context: make unknown/ignored/clean of cached status empty for equivalence...
r23709
print '=== with "always match" and "listclean=True":'
print actx1.status(other=wctx, listclean=True)
print 'wctx._status=%s' % (str(wctx._status))
print actx2.status(other=wctx, listclean=True)
print 'wctx._status=%s' % (str(wctx._status))
FUJIWARA Katsunori
context: avoid breaking already fixed self._status at ctx.status()...
r23711
print "== checking workingcommitctx.status:"
wcctx = context.workingcommitctx(repo,
scmutil.status(['bar-m'],
['bar-a'],
[],
[], [], [], []),
text='', date='0 0')
print 'wcctx._status=%s' % (str(wcctx._status))
print '=== with "always match":'
FUJIWARA Katsunori
context: override _dirstatestatus in workingcommitctx for correct matching...
r23712 print actx1.status(other=wcctx)
FUJIWARA Katsunori
context: avoid breaking already fixed self._status at ctx.status()...
r23711 print 'wcctx._status=%s' % (str(wcctx._status))
FUJIWARA Katsunori
context: override _dirstatestatus in workingcommitctx for correct matching...
r23712 print actx2.status(other=wcctx)
FUJIWARA Katsunori
context: avoid breaking already fixed self._status at ctx.status()...
r23711 print 'wcctx._status=%s' % (str(wcctx._status))
print '=== with "always match" and "listclean=True":'
FUJIWARA Katsunori
context: override _dirstatestatus in workingcommitctx for correct matching...
r23712 print actx1.status(other=wcctx, listclean=True)
print 'wcctx._status=%s' % (str(wcctx._status))
print actx2.status(other=wcctx, listclean=True)
print 'wcctx._status=%s' % (str(wcctx._status))
print '=== with "pattern match":'
print actx1.status(other=wcctx,
match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
FUJIWARA Katsunori
context: avoid breaking already fixed self._status at ctx.status()...
r23711 print 'wcctx._status=%s' % (str(wcctx._status))
FUJIWARA Katsunori
context: override _dirstatestatus in workingcommitctx for correct matching...
r23712 print actx2.status(other=wcctx,
match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
FUJIWARA Katsunori
context: avoid breaking already fixed self._status at ctx.status()...
r23711 print 'wcctx._status=%s' % (str(wcctx._status))
FUJIWARA Katsunori
context: override _dirstatestatus in workingcommitctx for correct matching...
r23712
print '=== with "pattern match" and "listclean=True":'
print actx1.status(other=wcctx,
match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
listclean=True)
print 'wcctx._status=%s' % (str(wcctx._status))
print actx2.status(other=wcctx,
match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
listclean=True)
print 'wcctx._status=%s' % (str(wcctx._status))