comparison mercurial/merge.py @ 24803:e89f909edffa stable 3.4-rc

merge default into stable for 3.4 freeze
author Matt Mackall <mpm@selenic.com>
date Thu, 16 Apr 2015 20:57:51 -0500
parents a8e6897dffbe
children 51844b8b5017
comparison
equal deleted inserted replaced
24753:612ed41ae359 24803:e89f909edffa
1043 "or check 'hg heads'")) 1043 "or check 'hg heads'"))
1044 if not force and (wc.files() or wc.deleted()): 1044 if not force and (wc.files() or wc.deleted()):
1045 raise util.Abort(_("uncommitted changes"), 1045 raise util.Abort(_("uncommitted changes"),
1046 hint=_("use 'hg status' to list changes")) 1046 hint=_("use 'hg status' to list changes"))
1047 for s in sorted(wc.substate): 1047 for s in sorted(wc.substate):
1048 if wc.sub(s).dirty(): 1048 wc.sub(s).bailifchanged()
1049 raise util.Abort(_("uncommitted changes in "
1050 "subrepository '%s'") % s)
1051 1049
1052 elif not overwrite: 1050 elif not overwrite:
1053 if p1 == p2: # no-op update 1051 if p1 == p2: # no-op update
1054 # call the hooks and exit early 1052 # call the hooks and exit early
1055 repo.hook('preupdate', throw=True, parent1=xp2, parent2='') 1053 repo.hook('preupdate', throw=True, parent1=xp2, parent2='')
1184 ctx - changeset to rebase 1182 ctx - changeset to rebase
1185 pctx - merge base, usually ctx.p1() 1183 pctx - merge base, usually ctx.p1()
1186 labels - merge labels eg ['local', 'graft'] 1184 labels - merge labels eg ['local', 'graft']
1187 1185
1188 """ 1186 """
1187 # If we're grafting a descendant onto an ancestor, be sure to pass
1188 # mergeancestor=True to update. This does two things: 1) allows the merge if
1189 # the destination is the same as the parent of the ctx (so we can use graft
1190 # to copy commits), and 2) informs update that the incoming changes are
1191 # newer than the destination so it doesn't prompt about "remote changed foo
1192 # which local deleted".
1193 mergeancestor = repo.changelog.isancestor(repo['.'].node(), ctx.node())
1189 1194
1190 stats = update(repo, ctx.node(), True, True, False, pctx.node(), 1195 stats = update(repo, ctx.node(), True, True, False, pctx.node(),
1191 labels=labels) 1196 mergeancestor=mergeancestor, labels=labels)
1197
1192 # drop the second merge parent 1198 # drop the second merge parent
1193 repo.dirstate.beginparentchange() 1199 repo.dirstate.beginparentchange()
1194 repo.setparents(repo['.'].node(), nullid) 1200 repo.setparents(repo['.'].node(), nullid)
1195 repo.dirstate.write() 1201 repo.dirstate.write()
1196 # fix up dirstate for copies and renames 1202 # fix up dirstate for copies and renames