tests/test-status-inprocess.py
author timeless <timeless@mozdev.org>
Wed, 06 Apr 2016 19:08:04 +0000
changeset 28824 9d31582dd636
parent 28766 7f7cd44cd6d5
child 28843 2c7e6f363138
permissions -rwxr-xr-x
tests: use /usr/bin/env python for test-status-inprocess.py everyone else uses it, and the next commit will add a rule for it
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28824
9d31582dd636 tests: use /usr/bin/env python for test-status-inprocess.py
timeless <timeless@mozdev.org>
parents: 28766
diff changeset
     1
#!/usr/bin/env python
28766
7f7cd44cd6d5 py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28765
diff changeset
     2
from __future__ import absolute_import, print_function
28765
7779f9dfd938 py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 10905
diff changeset
     3
from mercurial.ui import (
7779f9dfd938 py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 10905
diff changeset
     4
    ui,
7779f9dfd938 py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 10905
diff changeset
     5
)
7779f9dfd938 py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 10905
diff changeset
     6
from mercurial.localrepo import (
7779f9dfd938 py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 10905
diff changeset
     7
    localrepository,
7779f9dfd938 py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 10905
diff changeset
     8
)
7779f9dfd938 py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 10905
diff changeset
     9
from mercurial.commands import (
7779f9dfd938 py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 10905
diff changeset
    10
    add,
7779f9dfd938 py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 10905
diff changeset
    11
    commit,
7779f9dfd938 py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 10905
diff changeset
    12
    status,
7779f9dfd938 py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 10905
diff changeset
    13
)
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    14
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    15
u = ui()
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    16
28766
7f7cd44cd6d5 py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28765
diff changeset
    17
print('% creating repo')
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    18
repo = localrepository(u, '.', create=True)
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    19
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    20
f = open('test.py', 'w')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    21
try:
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    22
    f.write('foo\n')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    23
finally:
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    24
    f.close
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    25
28766
7f7cd44cd6d5 py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28765
diff changeset
    26
print('% add and commit')
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    27
add(u, repo, 'test.py')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    28
commit(u, repo, message='*')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    29
status(u, repo, clean=True)
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    30
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    31
28766
7f7cd44cd6d5 py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28765
diff changeset
    32
print('% change')
10838
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    33
f = open('test.py', 'w')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    34
try:
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    35
    f.write('bar\n')
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    36
finally:
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    37
    f.close()
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    38
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    39
# this would return clean instead of changed before the fix
07dbafd3a0e2 add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff changeset
    40
status(u, repo, clean=True, modified=True)