test-permissions.t 1.44 KB
Newer Older
1
#require unix-permissions no-root reporevlogstore
2

3
#testcases dirstate-v1 dirstate-v2
4

5
6
7
8
9
#if dirstate-v2
  $ echo '[format]' >> $HGRCPATH
  $ echo 'exp-dirstate-v2=1' >> $HGRCPATH
#endif

Adrian Buehlmann's avatar
Adrian Buehlmann committed
10
11
12
13
14
15
16
17
18
19
20
21
22
  $ hg init t
  $ cd t

  $ echo foo > a
  $ hg add a

  $ hg commit -m "1"

  $ hg verify
  checking changesets
  checking manifests
  crosschecking files in changesets and manifests
  checking files
23
  checked 1 changesets with 1 changes to 1 files
Adrian Buehlmann's avatar
Adrian Buehlmann committed
24
25
26

  $ chmod -r .hg/store/data/a.i

27
  $ hg verify
Adrian Buehlmann's avatar
Adrian Buehlmann committed
28
29
30
31
  checking changesets
  checking manifests
  crosschecking files in changesets and manifests
  checking files
32
  abort: Permission denied: '$TESTTMP/t/.hg/store/data/a.i'
33
  [255]
Adrian Buehlmann's avatar
Adrian Buehlmann committed
34
35
36

  $ chmod +r .hg/store/data/a.i

37
  $ hg verify
Adrian Buehlmann's avatar
Adrian Buehlmann committed
38
39
40
41
  checking changesets
  checking manifests
  crosschecking files in changesets and manifests
  checking files
42
  checked 1 changesets with 1 changes to 1 files
Adrian Buehlmann's avatar
Adrian Buehlmann committed
43
44
45
46

  $ chmod -w .hg/store/data/a.i

  $ echo barber > a
47
  $ hg commit -m "2"
Adrian Buehlmann's avatar
Adrian Buehlmann committed
48
  trouble committing a!
49
  abort: Permission denied: '$TESTTMP/t/.hg/store/data/a.i'
50
  [255]
Adrian Buehlmann's avatar
Adrian Buehlmann committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

  $ chmod -w .

  $ hg diff --nodates
  diff -r 2a18120dc1c9 a
  --- a/a
  +++ b/a
  @@ -1,1 +1,1 @@
  -foo
  +barber

  $ chmod +w .

  $ chmod +w .hg/store/data/a.i
  $ mkdir dir
  $ touch dir/a
  $ hg status
  M a
  ? dir/a
  $ chmod -rx dir
71
72
73
74
75

#if no-fsmonitor

(fsmonitor makes "hg status" avoid accessing to "dir")

Adrian Buehlmann's avatar
Adrian Buehlmann committed
76
77
78
79
  $ hg status
  dir: Permission denied
  M a

80
81
#endif

Adrian Buehlmann's avatar
Adrian Buehlmann committed
82
83
84
85
Reenable perm to allow deletion:

  $ chmod +rx dir

kiilerix's avatar
kiilerix committed
86
  $ cd ..