Mercurial > hg
annotate tests/test-permissions.t @ 16536:63c817ea4a70 stable
commit: abort on merge with missing files
Here is a script illustrating the previous behaviour:
The merge brings a new file 'b' from remote
$ hg merge 1 --debug
searching for copies back to rev 1
unmatched files in other:
b
resolving manifests
overwrite: False, partial: False
ancestor: 07f494440405, local: 540395c44225+, remote: 102a90ea7b4a
b: remote created -> g
updating: b 1/1 files (100.00%)
getting b
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
Delete but do not remove b
$ rm b
$ hg st
! b
The commit succeeds
$ hg commit -m merge
$ hg parents --template "{rev} {desc|firstline} files: {files}\n"
3 merge files:
$ hg st
! b
b changes were ignored, but even b existence was ignored
$ hg manifest
a
This happens because localrepo.commitctx() checks the input ctx.files(), which
is empty for workingctx.files() only returns added, modified or removed
entries, and bypass files/manifest updates completely. So the committed
revision manifest is the same as its first parent one, not containing the 'b'
file.
This patch forces the commit to abort in presence of a merge and missing files.
test-merge4.t is modified accordingly as it was introduced to check hg was not
just terminating with a traceback (5e9e8b8d2629).
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Sat, 28 Apr 2012 15:01:57 +0200 |
parents | a1914d214579 |
children | f2719b387380 |
rev | line source |
---|---|
15443
a1914d214579
tests: use 'hghave unix-permissions' for tests that really use chmod
Mads Kiilerich <mads@kiilerich.com>
parents:
12640
diff
changeset
|
1 $ "$TESTDIR/hghave" unix-permissions || exit 80 |
a1914d214579
tests: use 'hghave unix-permissions' for tests that really use chmod
Mads Kiilerich <mads@kiilerich.com>
parents:
12640
diff
changeset
|
2 |
12279 | 3 $ hg init t |
4 $ cd t | |
5 | |
6 $ echo foo > a | |
7 $ hg add a | |
8 | |
9 $ hg commit -m "1" | |
10 | |
11 $ hg verify | |
12 checking changesets | |
13 checking manifests | |
14 crosschecking files in changesets and manifests | |
15 checking files | |
16 1 files, 1 changesets, 1 total revisions | |
17 | |
18 $ chmod -r .hg/store/data/a.i | |
19 | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
20 $ hg verify |
12279 | 21 checking changesets |
22 checking manifests | |
23 crosschecking files in changesets and manifests | |
24 checking files | |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12376
diff
changeset
|
25 abort: Permission denied: $TESTTMP/t/.hg/store/data/a.i |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
26 [255] |
12279 | 27 |
28 $ chmod +r .hg/store/data/a.i | |
29 | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
30 $ hg verify |
12279 | 31 checking changesets |
32 checking manifests | |
33 crosschecking files in changesets and manifests | |
34 checking files | |
35 1 files, 1 changesets, 1 total revisions | |
1497 | 36 |
12279 | 37 $ chmod -w .hg/store/data/a.i |
38 | |
39 $ echo barber > a | |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
40 $ hg commit -m "2" |
12279 | 41 trouble committing a! |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12376
diff
changeset
|
42 abort: Permission denied: $TESTTMP/t/.hg/store/data/a.i |
12365
22f3353bcc36
tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
43 [255] |
12279 | 44 |
45 $ chmod -w . | |
46 | |
47 $ hg diff --nodates | |
48 diff -r 2a18120dc1c9 a | |
49 --- a/a | |
50 +++ b/a | |
51 @@ -1,1 +1,1 @@ | |
52 -foo | |
53 +barber | |
7099
6f750e76fb46
dirstate.walk: skip unreadable directories (issue1213)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5519
diff
changeset
|
54 |
12279 | 55 $ chmod +w . |
56 | |
57 $ chmod +w .hg/store/data/a.i | |
58 $ mkdir dir | |
59 $ touch dir/a | |
60 $ hg status | |
61 M a | |
62 ? dir/a | |
63 $ chmod -rx dir | |
64 $ hg status | |
65 dir: Permission denied | |
66 M a | |
67 | |
68 Reenable perm to allow deletion: | |
69 | |
70 $ chmod +rx dir | |
71 |