Mercurial > hg
annotate tests/test-pathconflicts-basic.t @ 42619:20d0e59be79b
tests: show the files fields of changelogs for many merges
I don't think there's coverage for many of the subtle cases, and I
found it hard to understand what the code is doing by reading it. The
test takes 40s to run on a laptop, or 9s with --chg.
I have yet to find a description of what the files field is supposed
to be for merges. I thought it could be one of:
1. the files added/modified/removed relative to p1 (wouldn't seem
useful, but `hg diff -c -r mergerev` has this behavior)
2. the files with filelog nodes not in either parent (i.e., what is
needed to create a bundle out of a commit)
3. the files added/removed/modified files by merge itself [1]
It's clearly not 1, because file contents merges are symmetric. It's
clearly not 2 because removed files and exec bit changes are
listed. It's also not 3 but I think it's intended to be 3 and the
differences are bugs.
Assuming 3, the test shows that, for merges, the list of files both
overapproximates and underapproximates. All the cases involve file
changes not in the filelog but in the manifest (existence of file
at revision, exec bit and file vs symlink).
I didn't look at all underapproximations, but they looked minor. The
two overapproximations are problematic though because they both cause
potentially long lists of files when merging cleanly.
[1] even what it means for the merge commit itself to change a file is
not completely trivial. A file in the merge being the same as in one
of the parent is too lax as it would consider that merges change
nothing when they revert all the changes done on one side. The
criteria used in the test and in the next commit for "merge didn't
touch a file" is:
- the parents and the merge all have the same file
- or, one parent didn't touch the file and the other parent contains
the same file as the merge
Differential Revision: https://phab.mercurial-scm.org/D6612
author | Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> |
---|---|
date | Tue, 02 Jul 2019 12:55:51 -0400 |
parents | 0b46e1aa7760 |
children | dc00324e80f4 |
rev | line source |
---|---|
34942
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
34556
diff
changeset
|
1 Path conflict checking is currently disabled by default because of issue5716. |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
34556
diff
changeset
|
2 Turn it on for this test. |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
34556
diff
changeset
|
3 |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
34556
diff
changeset
|
4 $ cat >> $HGRCPATH << EOF |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
34556
diff
changeset
|
5 > [experimental] |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
34556
diff
changeset
|
6 > merge.checkpathconflicts=True |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
34556
diff
changeset
|
7 > EOF |
2a774cae3a03
merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents:
34556
diff
changeset
|
8 |
34544
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
9 $ hg init repo |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
10 $ cd repo |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
11 $ echo base > base |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
12 $ hg add base |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
13 $ hg commit -m "base" |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
14 $ hg bookmark -i base |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
15 $ echo 1 > a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
16 $ hg add a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
17 $ hg commit -m "file" |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
18 $ hg bookmark -i file |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
19 $ echo 2 > a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
20 $ hg commit -m "file2" |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
21 $ hg bookmark -i file2 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
22 $ hg up -q 0 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
23 $ mkdir a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
24 $ echo 2 > a/b |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
25 $ hg add a/b |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
26 $ hg commit -m "dir" |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
27 created new head |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
28 $ hg bookmark -i dir |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
29 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
30 Basic merge - local file conflicts with remote directory |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
31 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
32 $ hg up -q file |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
33 $ hg bookmark -i |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
34 $ hg merge --verbose dir |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
35 resolving manifests |
34555
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
34553
diff
changeset
|
36 a: path conflict - a file or link has the same name as a directory |
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
34553
diff
changeset
|
37 the local file has been renamed to a~853701544ac3 |
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
34553
diff
changeset
|
38 resolve manually then use 'hg resolve --mark a' |
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
34553
diff
changeset
|
39 moving a to a~853701544ac3 |
34544
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
40 getting a/b |
34555
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
34553
diff
changeset
|
41 1 files updated, 0 files merged, 0 files removed, 1 files unresolved |
35704
41ef02ba329b
merge: add `--abort` flag which can abort the merge
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34942
diff
changeset
|
42 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
34555
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
34553
diff
changeset
|
43 [1] |
34544
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
44 $ hg update --clean . |
34555
989e884d1be9
merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
34553
diff
changeset
|
45 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
34556
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
46 $ rm a~853701544ac3 |
34544
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
47 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
48 Basic update - local directory conflicts with remote file |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
49 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
50 $ hg up -q 0 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
51 $ mkdir a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
52 $ echo 3 > a/b |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
53 $ hg up file |
34553
0217d66846f7
merge: improve error messages for path conflicts during update
Mark Thomas <mbthomas@fb.com>
parents:
34552
diff
changeset
|
54 a: untracked directory conflicts with file |
34552
33c8a6837181
merge: check for path conflicts when updating (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
34544
diff
changeset
|
55 abort: untracked files in working directory differ from files in requested revision |
34544
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
56 [255] |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
57 $ hg up --clean file |
34556
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
58 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
59 (activating bookmark file) |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
60 |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
61 Repo state is ok |
34544
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
62 |
34556
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
63 $ hg sum |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
64 parent: 1:853701544ac3 |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
65 file |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
66 branch: default |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
67 bookmarks: *file |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
68 commit: (clean) |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
69 update: 2 new changesets (update) |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
70 phases: 4 draft |
34544
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
71 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
72 Basic update - untracked file conflicts with remote directory |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
73 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
74 $ hg up -q 0 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
75 $ echo untracked > a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
76 $ hg up --config merge.checkunknown=warn dir |
34552
33c8a6837181
merge: check for path conflicts when updating (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
34544
diff
changeset
|
77 a: replacing untracked file |
33c8a6837181
merge: check for path conflicts when updating (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
34544
diff
changeset
|
78 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
33c8a6837181
merge: check for path conflicts when updating (issue5628)
Mark Thomas <mbthomas@fb.com>
parents:
34544
diff
changeset
|
79 (activating bookmark dir) |
34556
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
80 $ cat a.orig |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
81 untracked |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
82 $ rm -f a.orig |
34544
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
83 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
84 Basic clean update - local directory conflicts with changed remote file |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
85 |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
86 $ hg up -q file |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
87 $ rm a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
88 $ mkdir a |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
89 $ echo 4 > a/b |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
90 $ hg up file2 |
40230
0b46e1aa7760
py3: add some glob to make output compatible with python 3
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
35704
diff
changeset
|
91 abort: *: *$TESTTMP/repo/a* (glob) |
34544
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
92 [255] |
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
93 $ hg up --clean file2 |
34556
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
95 (activating bookmark file2) |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
96 |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
97 Repo state is ok |
34544
34c8080d12ac
tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff
changeset
|
98 |
34556
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
99 $ hg sum |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
100 parent: 2:f64e09fac717 |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
101 file2 |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
102 branch: default |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
103 bookmarks: *file2 |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
104 commit: (clean) |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
105 update: 1 new changesets, 2 branch heads (merge) |
7a8a16f8ea22
context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents:
34555
diff
changeset
|
106 phases: 4 draft |