##// END OF EJS Templates
test-resolve: add tests for re-merge
Martin von Zweigbergk -
r23023:63c9088b default
parent child Browse files
Show More
@@ -1,112 +1,151 b''
1 test that a commit clears the merge state.
1 test that a commit clears the merge state.
2
2
3 $ hg init repo
3 $ hg init repo
4 $ cd repo
4 $ cd repo
5
5
6 $ echo foo > file1
6 $ echo foo > file1
7 $ echo foo > file2
7 $ echo foo > file2
8 $ hg commit -Am 'add files'
8 $ hg commit -Am 'add files'
9 adding file1
9 adding file1
10 adding file2
10 adding file2
11
11
12 $ echo bar >> file1
12 $ echo bar >> file1
13 $ echo bar >> file2
13 $ echo bar >> file2
14 $ hg commit -Am 'append bar to files'
14 $ hg commit -Am 'append bar to files'
15
15
16 create a second head with conflicting edits
16 create a second head with conflicting edits
17
17
18 $ hg up -C 0
18 $ hg up -C 0
19 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 $ echo baz >> file1
20 $ echo baz >> file1
21 $ echo baz >> file2
21 $ echo baz >> file2
22 $ hg commit -Am 'append baz to files'
22 $ hg commit -Am 'append baz to files'
23 created new head
23 created new head
24
24
25 create a third head with no conflicting edits
25 create a third head with no conflicting edits
26 $ hg up -qC 0
26 $ hg up -qC 0
27 $ echo foo > file3
27 $ echo foo > file3
28 $ hg commit -Am 'add non-conflicting file'
28 $ hg commit -Am 'add non-conflicting file'
29 adding file3
29 adding file3
30 created new head
30 created new head
31
31
32 failing merge
32 failing merge
33
33
34 $ hg up -qC 2
34 $ hg up -qC 2
35 $ hg merge --tool=internal:fail 1
35 $ hg merge --tool=internal:fail 1
36 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
36 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
37 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
37 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
38 [1]
38 [1]
39
39
40 resolve -l should contain unresolved entries
40 resolve -l should contain unresolved entries
41
41
42 $ hg resolve -l
42 $ hg resolve -l
43 U file1
43 U file1
44 U file2
44 U file2
45
45
46 resolving an unknown path should emit a warning
46 resolving an unknown path should emit a warning
47
47
48 $ hg resolve -m does-not-exist
48 $ hg resolve -m does-not-exist
49 arguments do not match paths that need resolving
49 arguments do not match paths that need resolving
50
50
51 resolve the failure
51 resolve the failure
52
52
53 $ echo resolved > file1
53 $ echo resolved > file1
54 $ hg resolve -m file1
54 $ hg resolve -m file1
55
55
56 resolve -l should show resolved file as resolved
56 resolve -l should show resolved file as resolved
57
57
58 $ hg resolve -l
58 $ hg resolve -l
59 R file1
59 R file1
60 U file2
60 U file2
61
61
62 resolve -m without paths should mark all resolved
62 resolve -m without paths should mark all resolved
63
63
64 $ hg resolve -m
64 $ hg resolve -m
65 (no more unresolved files)
65 (no more unresolved files)
66 $ hg commit -m 'resolved'
66 $ hg commit -m 'resolved'
67
67
68 resolve -l should be empty after commit
68 resolve -l should be empty after commit
69
69
70 $ hg resolve -l
70 $ hg resolve -l
71
71
72 resolve --all should abort when no merge in progress
72 resolve --all should abort when no merge in progress
73
73
74 $ hg resolve --all
74 $ hg resolve --all
75 abort: resolve command not applicable when not merging
75 abort: resolve command not applicable when not merging
76 [255]
76 [255]
77
77
78 resolve -m should abort when no merge in progress
78 resolve -m should abort when no merge in progress
79
79
80 $ hg resolve -m
80 $ hg resolve -m
81 abort: resolve command not applicable when not merging
81 abort: resolve command not applicable when not merging
82 [255]
82 [255]
83
83
84 set up conflict-free merge
84 set up conflict-free merge
85
85
86 $ hg up -qC 3
86 $ hg up -qC 3
87 $ hg merge 1
87 $ hg merge 1
88 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
88 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 (branch merge, don't forget to commit)
89 (branch merge, don't forget to commit)
90
90
91 BROKEN: resolve --all should do nothing in merge without conflicts
91 BROKEN: resolve --all should do nothing in merge without conflicts
92 $ hg resolve --all
92 $ hg resolve --all
93 abort: resolve command not applicable when not merging
93 abort: resolve command not applicable when not merging
94 [255]
94 [255]
95
95
96 BROKEN: resolve -m should do nothing in merge without conflicts
96 BROKEN: resolve -m should do nothing in merge without conflicts
97
97
98 $ hg resolve -m
98 $ hg resolve -m
99 abort: resolve command not applicable when not merging
99 abort: resolve command not applicable when not merging
100 [255]
100 [255]
101
101
102 get back to conflicting state
103
104 $ hg up -qC 2
105 $ hg merge --tool=internal:fail 1
106 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
107 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
108 [1]
109
110 resolve without arguments should suggest --all
111 $ hg resolve
112 abort: no files or directories specified
113 (use --all to remerge all files)
114 [255]
115
116 resolve --all should re-merge all unresolved files
117 $ hg resolve -q --all
118 warning: conflicts during merge.
119 merging file1 incomplete! (edit conflicts, then use 'hg resolve --mark')
120 warning: conflicts during merge.
121 merging file2 incomplete! (edit conflicts, then use 'hg resolve --mark')
122 [1]
123 $ grep -q '<<<' file1
124 $ grep -q '<<<' file2
125
126 resolve <file> should re-merge file
127 $ echo resolved > file1
128 $ hg resolve -q file1
129 warning: conflicts during merge.
130 merging file1 incomplete! (edit conflicts, then use 'hg resolve --mark')
131 [1]
132 $ grep -q '<<<' file1
133
134 resolve <file> should do nothing if 'file' was marked resolved
135 $ echo resolved > file1
136 $ hg resolve -m file1
137 $ hg resolve -q file1
138 $ cat file1
139 resolved
140
102 test crashed merge with empty mergestate
141 test crashed merge with empty mergestate
103
142
104 $ hg up -qC 1
143 $ hg up -qC 1
105 $ mkdir .hg/merge
144 $ mkdir .hg/merge
106 $ touch .hg/merge/state
145 $ touch .hg/merge/state
107
146
108 resolve -l should be empty
147 resolve -l should be empty
109
148
110 $ hg resolve -l
149 $ hg resolve -l
111
150
112 $ cd ..
151 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now