| 1 |
$ hg init repo |
| 2 |
$ cd repo |
| 3 |
$ echo a > a |
| 4 |
$ hg commit -A -ma |
| 5 |
adding a |
| 6 |
|
| 7 |
$ echo b >> a |
| 8 |
$ hg commit -mb |
| 9 |
|
| 10 |
$ echo c >> a |
| 11 |
$ hg commit -mc |
| 12 |
|
| 13 |
$ hg up 1 |
| 14 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 15 |
$ echo d >> a |
| 16 |
$ hg commit -md |
| 17 |
created new head |
| 18 |
|
| 19 |
$ hg up 1 |
| 20 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 21 |
$ echo e >> a |
| 22 |
$ hg commit -me |
| 23 |
created new head |
| 24 |
|
| 25 |
$ hg up 1 |
| 26 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 27 |
|
| 28 |
Should fail because not at a head: |
| 29 |
|
| 30 |
$ hg merge |
| 31 |
abort: working directory not at a head revision |
| 32 |
(use 'hg update' or merge with an explicit revision) |
| 33 |
[255] |
| 34 |
|
| 35 |
$ hg up |
| 36 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 37 |
updated to "f25cbe84d8b3: e" |
| 38 |
2 other heads for branch "default" |
| 39 |
|
| 40 |
Should fail because > 2 heads: |
| 41 |
|
| 42 |
$ HGMERGE=internal:other; export HGMERGE |
| 43 |
$ hg merge |
| 44 |
abort: branch 'default' has 3 heads - please merge with an explicit rev |
| 45 |
(run 'hg heads .' to see heads, specify rev with -r) |
| 46 |
[255] |
| 47 |
|
| 48 |
Should succeed (we're specifying commands.merge.require-rev=True just to test |
| 49 |
that it allows merge to succeed if we specify a revision): |
| 50 |
|
| 51 |
$ hg merge 2 --config commands.merge.require-rev=True |
| 52 |
0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
| 53 |
(branch merge, don't forget to commit) |
| 54 |
$ hg id -Tjson |
| 55 |
[ |
| 56 |
{ |
| 57 |
"bookmarks": [], |
| 58 |
"branch": "default", |
| 59 |
"dirty": "+", |
| 60 |
"id": "f25cbe84d8b320e298e7703f18a25a3959518c23+2d95304fed5d89bc9d70b2a0d02f0d567469c3ab+", |
| 61 |
"node": "ffffffffffffffffffffffffffffffffffffffff", |
| 62 |
"parents": ["f25cbe84d8b320e298e7703f18a25a3959518c23", "2d95304fed5d89bc9d70b2a0d02f0d567469c3ab"], |
| 63 |
"tags": ["tip"] |
| 64 |
} |
| 65 |
] |
| 66 |
$ hg commit -mm1 |
| 67 |
|
| 68 |
Should fail because we didn't specify a revision (even though it would have |
| 69 |
succeeded without this): |
| 70 |
|
| 71 |
$ hg merge --config commands.merge.require-rev=True |
| 72 |
abort: configuration requires specifying revision to merge with |
| 73 |
[10] |
| 74 |
|
| 75 |
Should succeed - 2 heads: |
| 76 |
|
| 77 |
$ hg merge -P |
| 78 |
changeset: 3:ea9ff125ff88 |
| 79 |
parent: 1:1846eede8b68 |
| 80 |
user: test |
| 81 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 82 |
summary: d |
| 83 |
|
| 84 |
$ hg merge |
| 85 |
0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
| 86 |
(branch merge, don't forget to commit) |
| 87 |
$ hg commit -mm2 |
| 88 |
|
| 89 |
$ hg id -r 1 -Tjson |
| 90 |
[ |
| 91 |
{ |
| 92 |
"bookmarks": [], |
| 93 |
"branch": "default", |
| 94 |
"id": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1", |
| 95 |
"node": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1", |
| 96 |
"tags": [] |
| 97 |
} |
| 98 |
] |
| 99 |
|
| 100 |
Should fail because we didn't specify a revision (even though it would have |
| 101 |
failed without this due to being on tip, but this check comes first): |
| 102 |
|
| 103 |
$ hg merge --config commands.merge.require-rev=True |
| 104 |
abort: configuration requires specifying revision to merge with |
| 105 |
[10] |
| 106 |
|
| 107 |
Should fail because at tip: |
| 108 |
|
| 109 |
$ hg merge |
| 110 |
abort: nothing to merge |
| 111 |
[255] |
| 112 |
|
| 113 |
$ hg up 0 |
| 114 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 115 |
|
| 116 |
Should fail because there is only one head: |
| 117 |
|
| 118 |
$ hg merge |
| 119 |
abort: nothing to merge |
| 120 |
(use 'hg update' instead) |
| 121 |
[255] |
| 122 |
|
| 123 |
$ hg up 3 |
| 124 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 125 |
|
| 126 |
$ echo f >> a |
| 127 |
$ hg branch foobranch |
| 128 |
marked working directory as branch foobranch |
| 129 |
(branches are permanent and global, did you want a bookmark?) |
| 130 |
$ hg commit -mf |
| 131 |
|
| 132 |
Should fail because merge with other branch: |
| 133 |
|
| 134 |
$ hg merge |
| 135 |
abort: branch 'foobranch' has one head - please merge with an explicit rev |
| 136 |
(run 'hg heads' to see all heads, specify rev with -r) |
| 137 |
[255] |
| 138 |
|
| 139 |
|
| 140 |
Test for issue2043: ensure that 'merge -P' shows ancestors of 6 that |
| 141 |
are not ancestors of 7, regardless of where their common ancestors are. |
| 142 |
|
| 143 |
Merge preview not affected by common ancestor: |
| 144 |
|
| 145 |
$ hg up -q 7 |
| 146 |
$ hg merge -q -P 6 |
| 147 |
2:2d95304fed5d |
| 148 |
4:f25cbe84d8b3 |
| 149 |
5:a431fabd6039 |
| 150 |
6:e88e33f3bf62 |
| 151 |
|
| 152 |
Test experimental destination revset |
| 153 |
|
| 154 |
$ hg log -r '_destmerge()' |
| 155 |
abort: branch 'foobranch' has one head - please merge with an explicit rev |
| 156 |
(run 'hg heads' to see all heads, specify rev with -r) |
| 157 |
[255] |
| 158 |
|
| 159 |
(on a branch with a two heads) |
| 160 |
|
| 161 |
$ hg up 5 |
| 162 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 163 |
$ echo f >> a |
| 164 |
$ hg commit -mf |
| 165 |
created new head |
| 166 |
$ hg log -r '_destmerge()' |
| 167 |
changeset: 6:e88e33f3bf62 |
| 168 |
parent: 5:a431fabd6039 |
| 169 |
parent: 3:ea9ff125ff88 |
| 170 |
user: test |
| 171 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 172 |
summary: m2 |
| 173 |
|
| 174 |
|
| 175 |
(from the other head) |
| 176 |
|
| 177 |
$ hg log -r '_destmerge(e88e33f3bf62)' |
| 178 |
changeset: 8:b613918999e2 |
| 179 |
tag: tip |
| 180 |
parent: 5:a431fabd6039 |
| 181 |
user: test |
| 182 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 183 |
summary: f |
| 184 |
|
| 185 |
|
| 186 |
(from unrelated branch) |
| 187 |
|
| 188 |
$ hg log -r '_destmerge(foobranch)' |
| 189 |
abort: branch 'foobranch' has one head - please merge with an explicit rev |
| 190 |
(run 'hg heads' to see all heads, specify rev with -r) |
| 191 |
[255] |