示例#1
0
#!/usr/bin/env python
from __future__ import absolute_import, print_function

from edenscm.mercurial import commands, localrepo, ui as uimod

u = uimod.ui.load()

u.write("% creating repo\n")
repo = localrepo.localrepository(u, ".", create=True)

f = open("test.py", "w")
try:
    f.write("foo\n")
finally:
    f.close

u.write("% add and commit\n")
commands.add(u, repo, "test.py")
commands.commit(u, repo, message="*")
commands.status(u, repo, clean=True)

u.write("% change\n")
f = open("test.py", "w")
try:
    f.write("bar\n")
finally:
    f.close()

# this would return clean instead of changed before the fix
commands.status(u, repo, clean=True, modified=True)
示例#2
0
with open(os.environ["HGRCPATH"], "a+") as f:
    f.write(b"[extensions]\n")
    f.write(b"treemanifest=!\n")

u = uimod.ui.load()
# hide outer repo
hg.peer(u, {}, ".", create=True)

# clone with symlink support
hg.clone(u, {}, BUNDLEPATH, "test0")

repo = hg.repository(u, "test0")

# wait a bit, or the status call wont update the dirstate
time.sleep(1)
commands.status(u, repo)


# now disable symlink support -- this is what os.symlink would do on a
# non-symlink file system
def symlink_failure(src, dst):
    raise OSError(1, "Operation not permitted")


os.symlink = symlink_failure
fscap.getfscap = lambda *args: None


def islink_failure(path):
    return False