tests/test-context.py
changeset 23700 a4958cdb2202
parent 23060 4eaea93b3e5b
child 23709 33e5431684c0
equal deleted inserted replaced
23699:fe17a6fb220d 23700:a4958cdb2202
    48 
    48 
    49 # test performing a diff on a memctx
    49 # test performing a diff on a memctx
    50 
    50 
    51 for d in ctxb.diff(ctxa, git=True):
    51 for d in ctxb.diff(ctxa, git=True):
    52     print d
    52     print d
       
    53 
       
    54 # test safeness and correctness of "cxt.status()"
       
    55 print '= checking context.status():'
       
    56 
       
    57 # ancestor "wcctx ~ 2"
       
    58 actx2 = repo['.']
       
    59 
       
    60 repo.wwrite('bar-m', 'bar-m\n', '')
       
    61 repo.wwrite('bar-r', 'bar-r\n', '')
       
    62 repo[None].add(['bar-m', 'bar-r'])
       
    63 repo.commit(text='add bar-m, bar-r', date="0 0")
       
    64 
       
    65 # ancestor "wcctx ~ 1"
       
    66 actx1 = repo['.']
       
    67 
       
    68 repo.wwrite('bar-m', 'bar-m bar-m\n', '')
       
    69 repo.wwrite('bar-a', 'bar-a\n', '')
       
    70 repo[None].add(['bar-a'])
       
    71 repo[None].forget(['bar-r'])
       
    72 
       
    73 # status at this point:
       
    74 #   M bar-m
       
    75 #   A bar-a
       
    76 #   R bar-r
       
    77 #   C foo
       
    78 
       
    79 from mercurial import scmutil
       
    80 
       
    81 print '== checking workingctx.status:'
       
    82 
       
    83 wctx = repo[None]
       
    84 print 'wctx._status=%s' % (str(wctx._status))
       
    85 
       
    86 print actx1.status(other=wctx,
       
    87                    match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
       
    88 print 'wctx._status=%s' % (str(wctx._status))
       
    89 print actx2.status(other=wctx,
       
    90                    match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
       
    91 print 'wctx._status=%s' % (str(wctx._status))