Mercurial > hg
annotate tests/test-update-atomic.t @ 47728:4d1ae9cba551
amend: use `update_file` instead of `normallookup`
This is the newer, more semantic API.
Differential Revision: https://phab.mercurial-scm.org/D11170
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 19 Jul 2021 01:18:23 +0200 |
parents | 1d075b857c90 |
children | 42d2b31cee0b |
rev | line source |
---|---|
44620
1bc345d488fd
tests: don't run test-update-atomic.t on chg
Pulkit Goyal <7895pulkit@gmail.com>
parents:
41358
diff
changeset
|
1 #require execbit unix-permissions no-chg |
41289
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
2 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
3 Checking that experimental.atomic-file works. |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
4 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
5 $ cat > $TESTTMP/show_mode.py <<EOF |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
6 > from __future__ import print_function |
41358
0a0927f7549d
tests: fix module-import warnings in test-update-atomic.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
41347
diff
changeset
|
7 > import os |
0a0927f7549d
tests: fix module-import warnings in test-update-atomic.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
41347
diff
changeset
|
8 > import stat |
41289
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
9 > import sys |
41358
0a0927f7549d
tests: fix module-import warnings in test-update-atomic.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
41347
diff
changeset
|
10 > ST_MODE = stat.ST_MODE |
41289
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
11 > |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
12 > for file_path in sys.argv[1:]: |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
13 > file_stat = os.stat(file_path) |
41347
40787a96fda7
py3: fix test-update-atomic.t
Augie Fackler <augie@google.com>
parents:
41289
diff
changeset
|
14 > octal_mode = oct(file_stat[ST_MODE] & 0o777).replace('o', '') |
41289
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
15 > print("%s:%s" % (file_path, octal_mode)) |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
16 > |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
17 > EOF |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
18 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
19 $ hg init repo |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
20 $ cd repo |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
21 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
22 $ cat > .hg/showwrites.py <<EOF |
41347
40787a96fda7
py3: fix test-update-atomic.t
Augie Fackler <augie@google.com>
parents:
41289
diff
changeset
|
23 > from __future__ import print_function |
40787a96fda7
py3: fix test-update-atomic.t
Augie Fackler <augie@google.com>
parents:
41289
diff
changeset
|
24 > from mercurial import pycompat |
40787a96fda7
py3: fix test-update-atomic.t
Augie Fackler <augie@google.com>
parents:
41289
diff
changeset
|
25 > from mercurial.utils import stringutil |
41289
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
26 > def uisetup(ui): |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
27 > from mercurial import vfs |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
28 > class newvfs(vfs.vfs): |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
29 > def __call__(self, *args, **kwargs): |
41347
40787a96fda7
py3: fix test-update-atomic.t
Augie Fackler <augie@google.com>
parents:
41289
diff
changeset
|
30 > print(pycompat.sysstr(stringutil.pprint( |
40787a96fda7
py3: fix test-update-atomic.t
Augie Fackler <augie@google.com>
parents:
41289
diff
changeset
|
31 > ('vfs open', args, sorted(list(kwargs.items())))))) |
41289
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
32 > return super(newvfs, self).__call__(*args, **kwargs) |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
33 > vfs.vfs = newvfs |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
34 > EOF |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
35 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
36 $ for v in a1 a2 b1 b2 c ro; do echo $v > $v; done |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
37 $ chmod +x b* |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
38 $ hg commit -Aqm _ |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
39 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
40 # We check that |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
41 # - the changes are actually atomic |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
42 # - that permissions are correct (all 4 cases of (executable before) * (executable after)) |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
43 # - that renames work, though they should be atomic anyway |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
44 # - that it works when source files are read-only (but directories are read-write still) |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
45 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
46 $ for v in a1 a2 b1 b2 ro; do echo changed-$v > $v; done |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
47 $ chmod -x *1; chmod +x *2 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
48 $ hg rename c d |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
49 $ hg commit -qm _ |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
50 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
51 Check behavior without update.atomic-file |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
52 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
53 $ hg update -r 0 -q |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
54 $ hg update -r 1 --config extensions.showwrites=.hg/showwrites.py 2>&1 | grep "a1'.*wb" |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
55 ('vfs open', ('a1', 'wb'), [('atomictemp', False), ('backgroundclose', True)]) |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
56 |
47063
1d075b857c90
tests: ensure `$PYTHON` is quoted for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
46226
diff
changeset
|
57 $ "$PYTHON" $TESTTMP/show_mode.py * |
41289
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
58 a1:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
59 a2:0755 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
60 b1:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
61 b2:0755 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
62 d:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
63 ro:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
64 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
65 Add a second revision for the ro file so we can test update when the file is |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
66 present or not |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
67 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
68 $ echo "ro" > ro |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
69 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
70 $ hg commit -qm _ |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
71 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
72 Check behavior without update.atomic-file first |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
73 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
74 $ hg update -C -r 0 -q |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
75 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
76 $ hg update -r 1 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
77 6 files updated, 0 files merged, 1 files removed, 0 files unresolved |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
78 |
47063
1d075b857c90
tests: ensure `$PYTHON` is quoted for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
46226
diff
changeset
|
79 $ "$PYTHON" $TESTTMP/show_mode.py * |
41289
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
80 a1:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
81 a2:0755 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
82 b1:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
83 b2:0755 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
84 d:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
85 ro:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
86 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
87 Manually reset the mode of the read-only file |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
88 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
89 $ chmod a-w ro |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
90 |
47063
1d075b857c90
tests: ensure `$PYTHON` is quoted for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
46226
diff
changeset
|
91 $ "$PYTHON" $TESTTMP/show_mode.py ro |
41289
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
92 ro:0444 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
93 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
94 Now the file is present, try to update and check the permissions of the file |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
95 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
96 $ hg up -r 2 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
97 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
98 |
47063
1d075b857c90
tests: ensure `$PYTHON` is quoted for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
46226
diff
changeset
|
99 $ "$PYTHON" $TESTTMP/show_mode.py ro |
41289
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
100 ro:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
101 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
102 # The file which was read-only is now writable in the default behavior |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
103 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
104 Check behavior with update.atomic-files |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
105 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
106 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
107 $ cat >> .hg/hgrc <<EOF |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
108 > [experimental] |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
109 > update.atomic-file = true |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
110 > EOF |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
111 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
112 $ hg update -C -r 0 -q |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
113 $ hg update -r 1 --config extensions.showwrites=.hg/showwrites.py 2>&1 | grep "a1'.*wb" |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
114 ('vfs open', ('a1', 'wb'), [('atomictemp', True), ('backgroundclose', True)]) |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
115 $ hg st -A --rev 1 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
116 C a1 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
117 C a2 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
118 C b1 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
119 C b2 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
120 C d |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
121 C ro |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
122 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
123 Check the file permission after update |
47063
1d075b857c90
tests: ensure `$PYTHON` is quoted for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
46226
diff
changeset
|
124 $ "$PYTHON" $TESTTMP/show_mode.py * |
41289
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
125 a1:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
126 a2:0755 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
127 b1:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
128 b2:0755 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
129 d:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
130 ro:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
131 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
132 Manually reset the mode of the read-only file |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
133 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
134 $ chmod a-w ro |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
135 |
47063
1d075b857c90
tests: ensure `$PYTHON` is quoted for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
46226
diff
changeset
|
136 $ "$PYTHON" $TESTTMP/show_mode.py ro |
41289
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
137 ro:0444 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
138 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
139 Now the file is present, try to update and check the permissions of the file |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
140 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
141 $ hg update -r 2 --traceback |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
142 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
143 |
47063
1d075b857c90
tests: ensure `$PYTHON` is quoted for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
46226
diff
changeset
|
144 $ "$PYTHON" $TESTTMP/show_mode.py ro |
41289
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
145 ro:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
146 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
147 # The behavior is the same as without atomic update |