Mercurial > hg
comparison tests/test-symlink-os-yes-fs-no.py @ 37935:630429dcc397
tests: port test-symlink-os-yes-fs-no.py to Python 3
# skip-blame just bytes/str changes
Differential Revision: https://phab.mercurial-scm.org/D3524
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 27 Apr 2018 13:27:18 -0400 |
parents | 5ac84b20f184 |
children | 2372284d9457 |
comparison
equal
deleted
inserted
replaced
37934:2d919ab6c5b4 | 37935:630429dcc397 |
---|---|
4 import sys | 4 import sys |
5 import time | 5 import time |
6 from mercurial import ( | 6 from mercurial import ( |
7 commands, | 7 commands, |
8 hg, | 8 hg, |
9 pycompat, | |
9 ui as uimod, | 10 ui as uimod, |
10 util, | 11 util, |
11 ) | 12 ) |
12 | 13 |
13 TESTDIR = os.environ["TESTDIR"] | 14 TESTDIR = os.environ["TESTDIR"] |
17 if not getattr(os, "symlink", False): | 18 if not getattr(os, "symlink", False): |
18 sys.exit(80) # SKIPPED_STATUS defined in run-tests.py | 19 sys.exit(80) # SKIPPED_STATUS defined in run-tests.py |
19 | 20 |
20 u = uimod.ui.load() | 21 u = uimod.ui.load() |
21 # hide outer repo | 22 # hide outer repo |
22 hg.peer(u, {}, '.', create=True) | 23 hg.peer(u, {}, b'.', create=True) |
23 | 24 |
24 # unbundle with symlink support | 25 # unbundle with symlink support |
25 hg.peer(u, {}, 'test0', create=True) | 26 hg.peer(u, {}, b'test0', create=True) |
26 | 27 |
27 repo = hg.repository(u, 'test0') | 28 repo = hg.repository(u, b'test0') |
28 commands.unbundle(u, repo, BUNDLEPATH, update=True) | 29 commands.unbundle(u, repo, pycompat.fsencode(BUNDLEPATH), update=True) |
29 | 30 |
30 # wait a bit, or the status call wont update the dirstate | 31 # wait a bit, or the status call wont update the dirstate |
31 time.sleep(1) | 32 time.sleep(1) |
32 commands.status(u, repo) | 33 commands.status(u, repo) |
33 | 34 |
40 return False | 41 return False |
41 os.path.islink = islink_failure | 42 os.path.islink = islink_failure |
42 | 43 |
43 # dereference links as if a Samba server has exported this to a | 44 # dereference links as if a Samba server has exported this to a |
44 # Windows client | 45 # Windows client |
45 for f in 'test0/a.lnk', 'test0/d/b.lnk': | 46 for f in b'test0/a.lnk', b'test0/d/b.lnk': |
46 os.unlink(f) | 47 os.unlink(f) |
47 fp = open(f, 'wb') | 48 fp = open(f, 'wb') |
48 fp.write(util.readfile(f[:-4])) | 49 fp.write(util.readfile(f[:-4])) |
49 fp.close() | 50 fp.close() |
50 | 51 |
51 # reload repository | 52 # reload repository |
52 u = uimod.ui.load() | 53 u = uimod.ui.load() |
53 repo = hg.repository(u, 'test0') | 54 repo = hg.repository(u, b'test0') |
54 commands.status(u, repo) | 55 commands.status(u, repo) |
55 | 56 |
56 # try unbundling a repo which contains symlinks | 57 # try unbundling a repo which contains symlinks |
57 u = uimod.ui.load() | 58 u = uimod.ui.load() |
58 | 59 |
59 repo = hg.repository(u, 'test1', create=True) | 60 repo = hg.repository(u, b'test1', create=True) |
60 commands.unbundle(u, repo, BUNDLEPATH, update=True) | 61 commands.unbundle(u, repo, pycompat.fsencode(BUNDLEPATH), update=True) |