1 #!/usr/bin/env python |
1 #!/usr/bin/env python |
2 from __future__ import absolute_import, print_function |
2 from __future__ import absolute_import, print_function |
3 from mercurial.ui import ( |
3 |
4 ui, |
4 from mercurial import ( |
5 ) |
5 commands, |
6 from mercurial.localrepo import ( |
6 localrepo, |
7 localrepository, |
7 ui as uimod, |
8 ) |
|
9 from mercurial.commands import ( |
|
10 add, |
|
11 commit, |
|
12 status, |
|
13 ) |
8 ) |
14 |
9 |
15 u = ui() |
10 u = uimod.ui() |
16 |
11 |
17 print('% creating repo') |
12 print('% creating repo') |
18 repo = localrepository(u, '.', create=True) |
13 repo = localrepo.localrepository(u, '.', create=True) |
19 |
14 |
20 f = open('test.py', 'w') |
15 f = open('test.py', 'w') |
21 try: |
16 try: |
22 f.write('foo\n') |
17 f.write('foo\n') |
23 finally: |
18 finally: |
24 f.close |
19 f.close |
25 |
20 |
26 print('% add and commit') |
21 print('% add and commit') |
27 add(u, repo, 'test.py') |
22 commands.add(u, repo, 'test.py') |
28 commit(u, repo, message='*') |
23 commands.commit(u, repo, message='*') |
29 status(u, repo, clean=True) |
24 commands.status(u, repo, clean=True) |
30 |
25 |
31 |
26 |
32 print('% change') |
27 print('% change') |
33 f = open('test.py', 'w') |
28 f = open('test.py', 'w') |
34 try: |
29 try: |
35 f.write('bar\n') |
30 f.write('bar\n') |
36 finally: |
31 finally: |
37 f.close() |
32 f.close() |
38 |
33 |
39 # this would return clean instead of changed before the fix |
34 # this would return clean instead of changed before the fix |
40 status(u, repo, clean=True, modified=True) |
35 commands.status(u, repo, clean=True, modified=True) |