Mercurial > hg
comparison tests/test-update-atomic.t @ 41347:40787a96fda7
py3: fix test-update-atomic.t
The .replace('o', '') hack on oct() return value is required because:
% python -c 'print(oct(10))'
012
% python3 -c 'print(oct(10))'
0o12
Differential Revision: https://phab.mercurial-scm.org/D5684
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 24 Jan 2019 15:03:00 -0500 |
parents | 593f6359681d |
children | 0a0927f7549d |
comparison
equal
deleted
inserted
replaced
41346:9448b2e4c9fa | 41347:40787a96fda7 |
---|---|
8 > import os | 8 > import os |
9 > from stat import ST_MODE | 9 > from stat import ST_MODE |
10 > | 10 > |
11 > for file_path in sys.argv[1:]: | 11 > for file_path in sys.argv[1:]: |
12 > file_stat = os.stat(file_path) | 12 > file_stat = os.stat(file_path) |
13 > octal_mode = oct(file_stat[ST_MODE] & 0o777) | 13 > octal_mode = oct(file_stat[ST_MODE] & 0o777).replace('o', '') |
14 > print("%s:%s" % (file_path, octal_mode)) | 14 > print("%s:%s" % (file_path, octal_mode)) |
15 > | 15 > |
16 > EOF | 16 > EOF |
17 | 17 |
18 $ hg init repo | 18 $ hg init repo |
19 $ cd repo | 19 $ cd repo |
20 | 20 |
21 $ cat > .hg/showwrites.py <<EOF | 21 $ cat > .hg/showwrites.py <<EOF |
22 > from __future__ import print_function | |
23 > from mercurial import pycompat | |
24 > from mercurial.utils import stringutil | |
22 > def uisetup(ui): | 25 > def uisetup(ui): |
23 > from mercurial import vfs | 26 > from mercurial import vfs |
24 > class newvfs(vfs.vfs): | 27 > class newvfs(vfs.vfs): |
25 > def __call__(self, *args, **kwargs): | 28 > def __call__(self, *args, **kwargs): |
26 > print('vfs open', args, sorted(list(kwargs.items()))) | 29 > print(pycompat.sysstr(stringutil.pprint( |
30 > ('vfs open', args, sorted(list(kwargs.items())))))) | |
27 > return super(newvfs, self).__call__(*args, **kwargs) | 31 > return super(newvfs, self).__call__(*args, **kwargs) |
28 > vfs.vfs = newvfs | 32 > vfs.vfs = newvfs |
29 > EOF | 33 > EOF |
30 | 34 |
31 $ for v in a1 a2 b1 b2 c ro; do echo $v > $v; done | 35 $ for v in a1 a2 b1 b2 c ro; do echo $v > $v; done |