22 |
22 |
23 def postincoming(other, modheads): |
23 def postincoming(other, modheads): |
24 if modheads == 0: |
24 if modheads == 0: |
25 return 0 |
25 return 0 |
26 if modheads == 1: |
26 if modheads == 1: |
27 return commands.doupdate(ui, repo) |
27 return hg.update(repo, repo.changelog.tip()) |
28 newheads = repo.heads(parent) |
28 newheads = repo.heads(parent) |
29 newchildren = [n for n in repo.heads(parent) if n != parent] |
29 newchildren = [n for n in repo.heads(parent) if n != parent] |
30 newparent = parent |
30 newparent = parent |
31 if newchildren: |
31 if newchildren: |
32 commands.doupdate(ui, repo, node=hex(newchildren[0])) |
32 hg.update(repo, newchildren[0]) |
33 newparent = newchildren[0] |
33 newparent = newchildren[0] |
34 newheads = [n for n in repo.heads() if n != newparent] |
34 newheads = [n for n in repo.heads() if n != newparent] |
35 err = False |
35 err = False |
36 if newheads: |
36 if newheads: |
37 ui.status(_('merging with new head %d:%s\n') % |
37 ui.status(_('merging with new head %d:%s\n') % |
38 (repo.changelog.rev(newheads[0]), short(newheads[0]))) |
38 (repo.changelog.rev(newheads[0]), short(newheads[0]))) |
39 err = hg.update(repo, newheads[0], allow=True, remind=False) |
39 err = hg.merge(repo, newheads[0], remind=False) |
40 if not err and len(newheads) > 1: |
40 if not err and len(newheads) > 1: |
41 ui.status(_('not merging with %d other new heads ' |
41 ui.status(_('not merging with %d other new heads ' |
42 '(use "hg heads" and "hg merge" to merge them)') % |
42 '(use "hg heads" and "hg merge" to merge them)') % |
43 (len(newheads) - 1)) |
43 (len(newheads) - 1)) |
44 if not err: |
44 if not err: |