2016-04-06 22:08:04 +03:00
|
|
|
#!/usr/bin/env python
|
2016-04-04 05:20:40 +03:00
|
|
|
from __future__ import absolute_import, print_function
|
2016-04-05 17:38:00 +03:00
|
|
|
|
|
|
|
from mercurial import (
|
|
|
|
commands,
|
|
|
|
localrepo,
|
|
|
|
ui as uimod,
|
2016-04-04 05:19:35 +03:00
|
|
|
)
|
2010-04-05 22:10:46 +04:00
|
|
|
|
2016-10-22 08:35:10 +03:00
|
|
|
u = uimod.ui.load()
|
2010-04-05 22:10:46 +04:00
|
|
|
|
2016-04-04 05:20:40 +03:00
|
|
|
print('% creating repo')
|
2016-04-05 17:38:00 +03:00
|
|
|
repo = localrepo.localrepository(u, '.', create=True)
|
2010-04-05 22:10:46 +04:00
|
|
|
|
|
|
|
f = open('test.py', 'w')
|
|
|
|
try:
|
|
|
|
f.write('foo\n')
|
|
|
|
finally:
|
|
|
|
f.close
|
|
|
|
|
2016-04-04 05:20:40 +03:00
|
|
|
print('% add and commit')
|
2016-04-05 17:38:00 +03:00
|
|
|
commands.add(u, repo, 'test.py')
|
|
|
|
commands.commit(u, repo, message='*')
|
|
|
|
commands.status(u, repo, clean=True)
|
2010-04-05 22:10:46 +04:00
|
|
|
|
|
|
|
|
2016-04-04 05:20:40 +03:00
|
|
|
print('% change')
|
2010-04-05 22:10:46 +04:00
|
|
|
f = open('test.py', 'w')
|
|
|
|
try:
|
|
|
|
f.write('bar\n')
|
|
|
|
finally:
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
# this would return clean instead of changed before the fix
|
2016-04-05 17:38:00 +03:00
|
|
|
commands.status(u, repo, clean=True, modified=True)
|