Mercurial > hg
annotate tests/test-update-atomic.t @ 49603:3eda36e9b3d6 stable
matcher: fix issues regex flag contained in pattern (issue6759)
Python 3.11 is now enforcing that flag must be at the beginning of the regex
This creates a serious regression for people using Python 3.11 with an hgignore
using flag in a "relre" pattern.
We now detect any flags in such pattern and "prepend" our ".*" pattern after them.
In addition, we now insert the flag in the regexp to only affect the pattern we
are rewriting. Otherwise, the regex built from the combined pattern would these
flags in the middle of it anyway.
As a side effect of this last change, we fix a bug… before this change regex
flag in a pattern would affect all combined patterns. That was bad and is not
longer the case.
The Rust code needs to be updated to fix that very bug, but we will do it in
another changeset.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 16 Nov 2022 13:05:01 +0100 |
parents | 42d2b31cee0b |
children |
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 |
41358
0a0927f7549d
tests: fix module-import warnings in test-update-atomic.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
41347
diff
changeset
|
6 > import os |
0a0927f7549d
tests: fix module-import warnings in test-update-atomic.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
41347
diff
changeset
|
7 > 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
|
8 > import sys |
41358
0a0927f7549d
tests: fix module-import warnings in test-update-atomic.t
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
41347
diff
changeset
|
9 > 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
|
10 > |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
11 > 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
|
12 > file_stat = os.stat(file_path) |
41347
40787a96fda7
py3: fix test-update-atomic.t
Augie Fackler <augie@google.com>
parents:
41289
diff
changeset
|
13 > 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
|
14 > 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
|
15 > |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
16 > EOF |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
17 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
18 $ 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
|
19 $ cd repo |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
20 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
21 $ cat > .hg/showwrites.py <<EOF |
41347
40787a96fda7
py3: fix test-update-atomic.t
Augie Fackler <augie@google.com>
parents:
41289
diff
changeset
|
22 > from mercurial import pycompat |
40787a96fda7
py3: fix test-update-atomic.t
Augie Fackler <augie@google.com>
parents:
41289
diff
changeset
|
23 > 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
|
24 > 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
|
25 > 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
|
26 > 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
|
27 > def __call__(self, *args, **kwargs): |
41347
40787a96fda7
py3: fix test-update-atomic.t
Augie Fackler <augie@google.com>
parents:
41289
diff
changeset
|
28 > print(pycompat.sysstr(stringutil.pprint( |
40787a96fda7
py3: fix test-update-atomic.t
Augie Fackler <augie@google.com>
parents:
41289
diff
changeset
|
29 > ('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
|
30 > 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
|
31 > 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
|
32 > EOF |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
33 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
34 $ 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
|
35 $ 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
|
36 $ 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
|
37 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
38 # 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
|
39 # - 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
|
40 # - 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
|
41 # - 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
|
42 # - 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
|
43 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
44 $ 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
|
45 $ 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
|
46 $ 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
|
47 $ 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
|
48 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
49 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
|
50 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
51 $ 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
|
52 $ 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
|
53 ('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
|
54 |
47063
1d075b857c90
tests: ensure `$PYTHON` is quoted for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
46226
diff
changeset
|
55 $ "$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
|
56 a1:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
57 a2:0755 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
58 b1:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
59 b2:0755 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
60 d:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
61 ro:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
62 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
63 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
|
64 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
|
65 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
66 $ 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
|
67 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
68 $ 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
|
69 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
70 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
|
71 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
72 $ 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
|
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 -r 1 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
75 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
|
76 |
47063
1d075b857c90
tests: ensure `$PYTHON` is quoted for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
46226
diff
changeset
|
77 $ "$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
|
78 a1:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
79 a2:0755 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
80 b1:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
81 b2:0755 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
82 d:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
83 ro:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
84 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
85 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
|
86 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
87 $ 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
|
88 |
47063
1d075b857c90
tests: ensure `$PYTHON` is quoted for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
46226
diff
changeset
|
89 $ "$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
|
90 ro:0444 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
91 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
92 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
|
93 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
94 $ 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
|
95 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
|
96 |
47063
1d075b857c90
tests: ensure `$PYTHON` is quoted for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
46226
diff
changeset
|
97 $ "$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
|
98 ro:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
99 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
100 # 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
|
101 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
102 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
|
103 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
104 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
105 $ 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
|
106 > [experimental] |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
107 > 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
|
108 > EOF |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
109 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
110 $ 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
|
111 $ 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
|
112 ('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
|
113 $ 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
|
114 C a1 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
115 C a2 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
116 C b1 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
117 C b2 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
118 C d |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
119 C ro |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
120 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
121 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
|
122 $ "$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
|
123 a1:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
124 a2:0755 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
125 b1:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
126 b2:0755 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
127 d:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
128 ro:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
129 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
130 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
|
131 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
132 $ 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
|
133 |
47063
1d075b857c90
tests: ensure `$PYTHON` is quoted for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
46226
diff
changeset
|
134 $ "$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
|
135 ro:0444 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
136 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
137 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
|
138 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
139 $ 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
|
140 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
|
141 |
47063
1d075b857c90
tests: ensure `$PYTHON` is quoted for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
46226
diff
changeset
|
142 $ "$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
|
143 ro:0644 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
144 |
593f6359681d
update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
145 # The behavior is the same as without atomic update |