| 1 |
#require serve |
| 2 |
|
| 3 |
$ echo "[extensions]" >> $HGRCPATH |
| 4 |
$ echo "fetch=" >> $HGRCPATH |
| 5 |
|
| 6 |
test fetch with default branches only |
| 7 |
|
| 8 |
$ hg init a |
| 9 |
$ echo a > a/a |
| 10 |
$ hg --cwd a commit -Ama |
| 11 |
adding a |
| 12 |
$ hg clone a b |
| 13 |
updating to branch default |
| 14 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 15 |
$ hg clone a c |
| 16 |
updating to branch default |
| 17 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 18 |
$ echo b > a/b |
| 19 |
$ hg --cwd a commit -Amb |
| 20 |
adding b |
| 21 |
$ hg --cwd a parents -q |
| 22 |
1:d2ae7f538514 |
| 23 |
|
| 24 |
should pull one change |
| 25 |
|
| 26 |
$ hg --cwd b fetch ../a |
| 27 |
pulling from ../a |
| 28 |
searching for changes |
| 29 |
adding changesets |
| 30 |
adding manifests |
| 31 |
adding file changes |
| 32 |
added 1 changesets with 1 changes to 1 files |
| 33 |
new changesets d2ae7f538514 |
| 34 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 35 |
$ hg --cwd b parents -q |
| 36 |
1:d2ae7f538514 |
| 37 |
$ echo c > c/c |
| 38 |
$ hg --cwd c commit -Amc |
| 39 |
adding c |
| 40 |
$ hg clone c d |
| 41 |
updating to branch default |
| 42 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 43 |
$ hg clone c e |
| 44 |
updating to branch default |
| 45 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 46 |
|
| 47 |
We cannot use the default commit message if fetching from a local |
| 48 |
repo, because the path of the repo will be included in the commit |
| 49 |
message, making every commit appear different. |
| 50 |
should merge c into a |
| 51 |
|
| 52 |
$ hg --cwd c fetch -d '0 0' -m 'automated merge' ../a |
| 53 |
pulling from ../a |
| 54 |
searching for changes |
| 55 |
adding changesets |
| 56 |
adding manifests |
| 57 |
adding file changes |
| 58 |
added 1 changesets with 1 changes to 1 files (+1 heads) |
| 59 |
new changesets d2ae7f538514 |
| 60 |
updating to 2:d2ae7f538514 |
| 61 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 62 |
merging with 1:d36c0562f908 |
| 63 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 64 |
new changeset 3:a323a0c43ec4 merges remote changes with local |
| 65 |
$ ls -A c |
| 66 |
.hg |
| 67 |
a |
| 68 |
b |
| 69 |
c |
| 70 |
$ hg serve --cwd a -a localhost -p $HGPORT -d --pid-file=hg.pid |
| 71 |
$ cat a/hg.pid >> "$DAEMON_PIDS" |
| 72 |
|
| 73 |
fetch over http, no auth |
| 74 |
(this also tests that editor is invoked if '--edit' is specified) |
| 75 |
|
| 76 |
$ HGEDITOR=cat hg --cwd d fetch --edit http://localhost:$HGPORT/ |
| 77 |
pulling from http://localhost:$HGPORT/ |
| 78 |
searching for changes |
| 79 |
adding changesets |
| 80 |
adding manifests |
| 81 |
adding file changes |
| 82 |
added 1 changesets with 1 changes to 1 files (+1 heads) |
| 83 |
new changesets d2ae7f538514 |
| 84 |
updating to 2:d2ae7f538514 |
| 85 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 86 |
merging with 1:d36c0562f908 |
| 87 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 88 |
Automated merge with http://localhost:$HGPORT/ |
| 89 |
|
| 90 |
|
| 91 |
HG: Enter commit message. Lines beginning with 'HG:' are removed. |
| 92 |
HG: Leave message empty to abort commit. |
| 93 |
HG: -- |
| 94 |
HG: user: test |
| 95 |
HG: branch merge |
| 96 |
HG: branch 'default' |
| 97 |
HG: changed c |
| 98 |
new changeset 3:* merges remote changes with local (glob) |
| 99 |
$ hg --cwd d tip --template '{desc}\n' |
| 100 |
Automated merge with http://localhost:$HGPORT/ |
| 101 |
$ hg --cwd d status --rev 'tip^1' --rev tip |
| 102 |
A c |
| 103 |
$ hg --cwd d status --rev 'tip^2' --rev tip |
| 104 |
A b |
| 105 |
|
| 106 |
fetch over http with auth (should be hidden in desc) |
| 107 |
(this also tests that editor is not invoked if '--edit' is not |
| 108 |
specified, even though commit message is not specified explicitly) |
| 109 |
|
| 110 |
$ HGEDITOR=cat hg --cwd e fetch http://user:password@localhost:$HGPORT/ |
| 111 |
pulling from http://user:***@localhost:$HGPORT/ |
| 112 |
searching for changes |
| 113 |
adding changesets |
| 114 |
adding manifests |
| 115 |
adding file changes |
| 116 |
added 1 changesets with 1 changes to 1 files (+1 heads) |
| 117 |
new changesets d2ae7f538514 |
| 118 |
updating to 2:d2ae7f538514 |
| 119 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 120 |
merging with 1:d36c0562f908 |
| 121 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 122 |
new changeset 3:* merges remote changes with local (glob) |
| 123 |
$ hg --cwd e tip --template '{desc}\n' |
| 124 |
Automated merge with http://localhost:$HGPORT/ |
| 125 |
$ hg clone a f |
| 126 |
updating to branch default |
| 127 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 128 |
$ hg clone a g |
| 129 |
updating to branch default |
| 130 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 131 |
$ echo f > f/f |
| 132 |
$ hg --cwd f ci -Amf |
| 133 |
adding f |
| 134 |
$ echo g > g/g |
| 135 |
$ hg --cwd g ci -Amg |
| 136 |
adding g |
| 137 |
$ hg clone -q f h |
| 138 |
$ hg clone -q g i |
| 139 |
|
| 140 |
should merge f into g |
| 141 |
|
| 142 |
$ hg --cwd g fetch -d '0 0' --switch -m 'automated merge' ../f |
| 143 |
pulling from ../f |
| 144 |
searching for changes |
| 145 |
adding changesets |
| 146 |
adding manifests |
| 147 |
adding file changes |
| 148 |
added 1 changesets with 1 changes to 1 files (+1 heads) |
| 149 |
new changesets 6343ca3eff20 |
| 150 |
0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 151 |
merging with 3:6343ca3eff20 |
| 152 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 153 |
new changeset 4:f7faa0b7d3c6 merges remote changes with local |
| 154 |
$ rm i/g |
| 155 |
|
| 156 |
should abort, because i is modified |
| 157 |
|
| 158 |
$ hg --cwd i fetch ../h |
| 159 |
abort: uncommitted changes |
| 160 |
[20] |
| 161 |
|
| 162 |
test fetch with named branches |
| 163 |
|
| 164 |
$ hg init nbase |
| 165 |
$ echo base > nbase/a |
| 166 |
$ hg -R nbase ci -Am base |
| 167 |
adding a |
| 168 |
$ hg -R nbase branch a |
| 169 |
marked working directory as branch a |
| 170 |
(branches are permanent and global, did you want a bookmark?) |
| 171 |
$ echo a > nbase/a |
| 172 |
$ hg -R nbase ci -m a |
| 173 |
$ hg -R nbase up -C 0 |
| 174 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 175 |
$ hg -R nbase branch b |
| 176 |
marked working directory as branch b |
| 177 |
$ echo b > nbase/b |
| 178 |
$ hg -R nbase ci -Am b |
| 179 |
adding b |
| 180 |
|
| 181 |
pull in change on foreign branch |
| 182 |
|
| 183 |
$ hg clone nbase n1 |
| 184 |
updating to branch default |
| 185 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 186 |
$ hg clone nbase n2 |
| 187 |
updating to branch default |
| 188 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 189 |
$ hg -R n1 up -C a |
| 190 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 191 |
$ echo aa > n1/a |
| 192 |
$ hg -R n1 ci -m a1 |
| 193 |
$ hg -R n2 up -C b |
| 194 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 195 |
$ hg -R n2 fetch -m 'merge' n1 |
| 196 |
pulling from n1 |
| 197 |
searching for changes |
| 198 |
adding changesets |
| 199 |
adding manifests |
| 200 |
adding file changes |
| 201 |
added 1 changesets with 1 changes to 1 files |
| 202 |
new changesets 8fdc9284bbc5 |
| 203 |
|
| 204 |
parent should be 2 (no automatic update) |
| 205 |
|
| 206 |
$ hg -R n2 parents --template '{rev}\n' |
| 207 |
2 |
| 208 |
$ rm -fr n1 n2 |
| 209 |
|
| 210 |
pull in changes on both foreign and local branches |
| 211 |
|
| 212 |
$ hg clone nbase n1 |
| 213 |
updating to branch default |
| 214 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 215 |
$ hg clone nbase n2 |
| 216 |
updating to branch default |
| 217 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 218 |
$ hg -R n1 up -C a |
| 219 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 220 |
$ echo aa > n1/a |
| 221 |
$ hg -R n1 ci -m a1 |
| 222 |
$ hg -R n1 up -C b |
| 223 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 224 |
$ echo bb > n1/b |
| 225 |
$ hg -R n1 ci -m b1 |
| 226 |
$ hg -R n2 up -C b |
| 227 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 228 |
$ hg -R n2 fetch -m 'merge' n1 |
| 229 |
pulling from n1 |
| 230 |
searching for changes |
| 231 |
adding changesets |
| 232 |
adding manifests |
| 233 |
adding file changes |
| 234 |
added 2 changesets with 2 changes to 2 files |
| 235 |
new changesets 8fdc9284bbc5:3c4a837a864f |
| 236 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 237 |
|
| 238 |
parent should be 4 (fast forward) |
| 239 |
|
| 240 |
$ hg -R n2 parents --template '{rev}\n' |
| 241 |
4 |
| 242 |
$ rm -fr n1 n2 |
| 243 |
|
| 244 |
pull changes on foreign (2 new heads) and local (1 new head) branches |
| 245 |
with a local change |
| 246 |
|
| 247 |
$ hg clone nbase n1 |
| 248 |
updating to branch default |
| 249 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 250 |
$ hg clone nbase n2 |
| 251 |
updating to branch default |
| 252 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 253 |
$ hg -R n1 up -C a |
| 254 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 255 |
$ echo a1 > n1/a |
| 256 |
$ hg -R n1 ci -m a1 |
| 257 |
$ hg -R n1 up -C b |
| 258 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 259 |
$ echo bb > n1/b |
| 260 |
$ hg -R n1 ci -m b1 |
| 261 |
$ hg -R n1 up -C 1 |
| 262 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 263 |
$ echo a2 > n1/a |
| 264 |
$ hg -R n1 ci -m a2 |
| 265 |
created new head |
| 266 |
$ hg -R n2 up -C b |
| 267 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 268 |
$ echo change >> n2/c |
| 269 |
$ hg -R n2 ci -A -m local |
| 270 |
adding c |
| 271 |
$ hg -R n2 fetch -d '0 0' -m 'merge' n1 |
| 272 |
pulling from n1 |
| 273 |
searching for changes |
| 274 |
adding changesets |
| 275 |
adding manifests |
| 276 |
adding file changes |
| 277 |
added 3 changesets with 3 changes to 2 files (+2 heads) |
| 278 |
new changesets d05ce59ff88d:a7954de24e4c |
| 279 |
updating to 5:3c4a837a864f |
| 280 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 281 |
merging with 3:1267f84a9ea5 |
| 282 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 283 |
new changeset 7:2cf2a1261f21 merges remote changes with local |
| 284 |
|
| 285 |
parent should be 7 (new merge changeset) |
| 286 |
|
| 287 |
$ hg -R n2 parents --template '{rev}\n' |
| 288 |
7 |
| 289 |
$ rm -fr n1 n2 |
| 290 |
|
| 291 |
pull in changes on foreign (merge of local branch) and local (2 new |
| 292 |
heads) with a local change |
| 293 |
|
| 294 |
$ hg clone nbase n1 |
| 295 |
updating to branch default |
| 296 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 297 |
$ hg clone nbase n2 |
| 298 |
updating to branch default |
| 299 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 300 |
$ hg -R n1 up -C a |
| 301 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 302 |
$ hg -R n1 merge b |
| 303 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 304 |
(branch merge, don't forget to commit) |
| 305 |
$ hg -R n1 ci -m merge |
| 306 |
$ hg -R n1 up -C 2 |
| 307 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 308 |
$ echo c > n1/a |
| 309 |
$ hg -R n1 ci -m c |
| 310 |
$ hg -R n1 up -C 2 |
| 311 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 312 |
$ echo cc > n1/a |
| 313 |
$ hg -R n1 ci -m cc |
| 314 |
created new head |
| 315 |
$ hg -R n2 up -C b |
| 316 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 317 |
$ echo change >> n2/b |
| 318 |
$ hg -R n2 ci -A -m local |
| 319 |
$ hg -R n2 fetch -m 'merge' n1 |
| 320 |
pulling from n1 |
| 321 |
searching for changes |
| 322 |
adding changesets |
| 323 |
adding manifests |
| 324 |
adding file changes |
| 325 |
added 3 changesets with 2 changes to 1 files (+2 heads) |
| 326 |
new changesets b84e8d0f020f:3d3bf54f99c0 |
| 327 |
not merging with 1 other new branch heads (use "hg heads ." and "hg merge" to merge them) |
| 328 |
[1] |
| 329 |
|
| 330 |
parent should be 3 (fetch did not merge anything) |
| 331 |
|
| 332 |
$ hg -R n2 parents --template '{rev}\n' |
| 333 |
3 |
| 334 |
$ rm -fr n1 n2 |
| 335 |
|
| 336 |
pull in change on different branch than dirstate |
| 337 |
|
| 338 |
$ hg init n1 |
| 339 |
$ echo a > n1/a |
| 340 |
$ hg -R n1 ci -Am initial |
| 341 |
adding a |
| 342 |
$ hg clone n1 n2 |
| 343 |
updating to branch default |
| 344 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 345 |
$ echo b > n1/a |
| 346 |
$ hg -R n1 ci -m next |
| 347 |
$ hg -R n2 branch topic |
| 348 |
marked working directory as branch topic |
| 349 |
(branches are permanent and global, did you want a bookmark?) |
| 350 |
$ hg -R n2 fetch -m merge n1 |
| 351 |
abort: working directory not at branch tip |
| 352 |
(use 'hg update' to check out branch tip) |
| 353 |
[255] |
| 354 |
|
| 355 |
parent should be 0 (fetch did not update or merge anything) |
| 356 |
|
| 357 |
$ hg -R n2 parents --template '{rev}\n' |
| 358 |
0 |
| 359 |
$ rm -fr n1 n2 |
| 360 |
|
| 361 |
test fetch with inactive branches |
| 362 |
|
| 363 |
$ hg init ib1 |
| 364 |
$ echo a > ib1/a |
| 365 |
$ hg --cwd ib1 ci -Am base |
| 366 |
adding a |
| 367 |
$ hg --cwd ib1 branch second |
| 368 |
marked working directory as branch second |
| 369 |
(branches are permanent and global, did you want a bookmark?) |
| 370 |
$ echo b > ib1/b |
| 371 |
$ hg --cwd ib1 ci -Am onsecond |
| 372 |
adding b |
| 373 |
$ hg --cwd ib1 branch -f default |
| 374 |
marked working directory as branch default |
| 375 |
$ echo c > ib1/c |
| 376 |
$ hg --cwd ib1 ci -Am newdefault |
| 377 |
adding c |
| 378 |
created new head |
| 379 |
$ hg clone ib1 ib2 |
| 380 |
updating to branch default |
| 381 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 382 |
|
| 383 |
fetch should succeed |
| 384 |
|
| 385 |
$ hg --cwd ib2 fetch ../ib1 |
| 386 |
pulling from ../ib1 |
| 387 |
searching for changes |
| 388 |
no changes found |
| 389 |
$ rm -fr ib1 ib2 |
| 390 |
|
| 391 |
test issue1726 |
| 392 |
|
| 393 |
$ hg init i1726r1 |
| 394 |
$ echo a > i1726r1/a |
| 395 |
$ hg --cwd i1726r1 ci -Am base |
| 396 |
adding a |
| 397 |
$ hg clone i1726r1 i1726r2 |
| 398 |
updating to branch default |
| 399 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 400 |
$ echo b > i1726r1/a |
| 401 |
$ hg --cwd i1726r1 ci -m second |
| 402 |
$ echo c > i1726r2/a |
| 403 |
$ hg --cwd i1726r2 ci -m third |
| 404 |
$ HGMERGE=true hg --cwd i1726r2 fetch ../i1726r1 |
| 405 |
pulling from ../i1726r1 |
| 406 |
searching for changes |
| 407 |
adding changesets |
| 408 |
adding manifests |
| 409 |
adding file changes |
| 410 |
added 1 changesets with 1 changes to 1 files (+1 heads) |
| 411 |
new changesets 7837755a2789 |
| 412 |
updating to 2:7837755a2789 |
| 413 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 414 |
merging with 1:d1f0c6c48ebd |
| 415 |
merging a |
| 416 |
0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
| 417 |
new changeset 3:* merges remote changes with local (glob) |
| 418 |
$ hg --cwd i1726r2 heads default --template '{rev}\n' |
| 419 |
3 |
| 420 |
|
| 421 |
test issue2047 |
| 422 |
|
| 423 |
$ hg -q init i2047a |
| 424 |
$ cd i2047a |
| 425 |
$ echo a > a |
| 426 |
$ hg -q ci -Am a |
| 427 |
$ hg -q branch stable |
| 428 |
$ echo b > b |
| 429 |
$ hg -q ci -Am b |
| 430 |
$ cd .. |
| 431 |
$ hg -q clone -r 0 i2047a i2047b |
| 432 |
$ cd i2047b |
| 433 |
$ hg fetch ../i2047a |
| 434 |
pulling from ../i2047a |
| 435 |
searching for changes |
| 436 |
adding changesets |
| 437 |
adding manifests |
| 438 |
adding file changes |
| 439 |
added 1 changesets with 1 changes to 1 files |
| 440 |
new changesets c8735224de5c |
| 441 |
|
| 442 |
$ cd .. |