##// 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
1 1 test that a commit clears the merge state.
2 2
3 3 $ hg init repo
4 4 $ cd repo
5 5
6 6 $ echo foo > file1
7 7 $ echo foo > file2
8 8 $ hg commit -Am 'add files'
9 9 adding file1
10 10 adding file2
11 11
12 12 $ echo bar >> file1
13 13 $ echo bar >> file2
14 14 $ hg commit -Am 'append bar to files'
15 15
16 16 create a second head with conflicting edits
17 17
18 18 $ hg up -C 0
19 19 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 20 $ echo baz >> file1
21 21 $ echo baz >> file2
22 22 $ hg commit -Am 'append baz to files'
23 23 created new head
24 24
25 25 create a third head with no conflicting edits
26 26 $ hg up -qC 0
27 27 $ echo foo > file3
28 28 $ hg commit -Am 'add non-conflicting file'
29 29 adding file3
30 30 created new head
31 31
32 32 failing merge
33 33
34 34 $ hg up -qC 2
35 35 $ hg merge --tool=internal:fail 1
36 36 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
37 37 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
38 38 [1]
39 39
40 40 resolve -l should contain unresolved entries
41 41
42 42 $ hg resolve -l
43 43 U file1
44 44 U file2
45 45
46 46 resolving an unknown path should emit a warning
47 47
48 48 $ hg resolve -m does-not-exist
49 49 arguments do not match paths that need resolving
50 50
51 51 resolve the failure
52 52
53 53 $ echo resolved > file1
54 54 $ hg resolve -m file1
55 55
56 56 resolve -l should show resolved file as resolved
57 57
58 58 $ hg resolve -l
59 59 R file1
60 60 U file2
61 61
62 62 resolve -m without paths should mark all resolved
63 63
64 64 $ hg resolve -m
65 65 (no more unresolved files)
66 66 $ hg commit -m 'resolved'
67 67
68 68 resolve -l should be empty after commit
69 69
70 70 $ hg resolve -l
71 71
72 72 resolve --all should abort when no merge in progress
73 73
74 74 $ hg resolve --all
75 75 abort: resolve command not applicable when not merging
76 76 [255]
77 77
78 78 resolve -m should abort when no merge in progress
79 79
80 80 $ hg resolve -m
81 81 abort: resolve command not applicable when not merging
82 82 [255]
83 83
84 84 set up conflict-free merge
85 85
86 86 $ hg up -qC 3
87 87 $ hg merge 1
88 88 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 89 (branch merge, don't forget to commit)
90 90
91 91 BROKEN: resolve --all should do nothing in merge without conflicts
92 92 $ hg resolve --all
93 93 abort: resolve command not applicable when not merging
94 94 [255]
95 95
96 96 BROKEN: resolve -m should do nothing in merge without conflicts
97 97
98 98 $ hg resolve -m
99 99 abort: resolve command not applicable when not merging
100 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 141 test crashed merge with empty mergestate
103 142
104 143 $ hg up -qC 1
105 144 $ mkdir .hg/merge
106 145 $ touch .hg/merge/state
107 146
108 147 resolve -l should be empty
109 148
110 149 $ hg resolve -l
111 150
112 151 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now