tests/test-update-atomic.t
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
Tue, 02 Jul 2019 12:59:58 -0400
changeset 42621 99ebde4fec99
parent 41358 0a0927f7549d
child 44620 1bc345d488fd
permissions -rw-r--r--
commit: improve the files field of changelog for merges Currently, the files list of merge commits repeats all the deletions (either actual deletions, or files that got renamed) that happened between base and p2 of the merge. If p2 is the main branch, the list can easily be much bigger than the change being merged. This results in various problems worth improving: - changelog is bigger than necessary - `hg log directory` lists many unrelated merge commits, and `hg log -v -r commit` frequently fills multiple screens worth of files - it possibly slows down adjustlinkrev, by forcing it to read more manifests, and that function can certainly be a bottleneck - the server side of pulls can waste a lot of time simply opening the filelogs for pointless files (the constant factors for opening even a tiny filelog is apparently pretty bad) So stop listing such files as described in the code. Impacted merge commits and their descendants get a different hash than they would have without this. This doesn't seem problematic, except for convert. The previous commit helped with that in the hg->hg case (but if you do svn->hg twice from scratch, hashes can still change). The rest of the description is numbers. I don't have much to report, because recreating the files list of existing repositories is not easy: - debugupgradeformat and bundle/unbundle don't recreate the list - export/import tends to choke quickly applying patches or on description that contain diffs, - merge commits from the convert extension don't have the right files list for reasons orthogonal to the current commit - replaying the merge with hg update/hg merge/hg revert --all/hg commit can end up failing in hg revert - I wasn't sure that using debugsetparents + debugrebuilddirstate would really build the right thing I measured commit time before and after this change, in a case with no files filtered out, several files filtered out (no difference) and 5k files filtered out (+1% time). Recreating the 100 more recent merges in a private repo, the concatenated uncompressed files lists goes from 1.12MB to 0.52MB. Excluding 3 merges that are not representative, then the size goes from 570k to 15k. I converted part of mozilla-central, and observed file list shrinking quite a bit too, starting at the very first merge, 733641d9feaf, going from 550 files to 10 files (although they have relatively few merges, so they probably wouldn't care). Differential Revision: https://phab.mercurial-scm.org/D6613
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41289
593f6359681d update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     1
#require execbit unix-permissions
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
593f6359681d update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    57
  $ python $TESTTMP/show_mode.py *
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
593f6359681d update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    79
  $ python $TESTTMP/show_mode.py *
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
593f6359681d update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    91
  $ python $TESTTMP/show_mode.py ro
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
593f6359681d update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    99
  $ python $TESTTMP/show_mode.py ro
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
593f6359681d update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   124
  $ python $TESTTMP/show_mode.py *
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
593f6359681d update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   136
  $ python $TESTTMP/show_mode.py ro
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
593f6359681d update: fix edge-case with update.atomic-file and read-only files
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   144
  $ python $TESTTMP/show_mode.py ro
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