mercurial/merge.py
changeset 3108 67874ebbb7dd
parent 3107 3bd05ad67f45
child 3109 62044d161470
equal deleted inserted replaced
3107:3bd05ad67f45 3108:67874ebbb7dd
   219 
   219 
   220     # are we going backwards?
   220     # are we going backwards?
   221     backwards = (pa == p2)
   221     backwards = (pa == p2)
   222 
   222 
   223     # is there a linear path from p1 to p2?
   223     # is there a linear path from p1 to p2?
   224     linear_path = (pa == p1 or pa == p2)
   224     linear = (pa == p1 or pa == p2)
   225     if branchmerge and linear_path:
   225     if branchmerge and linear:
   226         raise util.Abort(_("there is nothing to merge, just use "
   226         raise util.Abort(_("there is nothing to merge, just use "
   227                            "'hg update' or look at 'hg heads'"))
   227                            "'hg update' or look at 'hg heads'"))
   228 
   228 
   229     if not linear_path and not (overwrite or branchmerge):
   229     if not linear and not (overwrite or branchmerge):
   230         raise util.Abort(_("update spans branches, use 'hg merge' "
   230         raise util.Abort(_("update spans branches, use 'hg merge' "
   231                            "or 'hg update -C' to lose changes"))
   231                            "or 'hg update -C' to lose changes"))
   232 
   232 
   233     status = repo.status()
   233     status = repo.status()
   234     modified, added, removed, deleted, unknown = status[:5]
   234     modified, added, removed, deleted, unknown = status[:5]
   242 
   242 
   243     # resolve the manifest to determine which files
   243     # resolve the manifest to determine which files
   244     # we care about merging
   244     # we care about merging
   245     repo.ui.note(_("resolving manifests\n"))
   245     repo.ui.note(_("resolving manifests\n"))
   246     repo.ui.debug(_(" overwrite %s branchmerge %s partial %s linear %s\n") %
   246     repo.ui.debug(_(" overwrite %s branchmerge %s partial %s linear %s\n") %
   247                   (overwrite, branchmerge, bool(partial), linear_path))
   247                   (overwrite, branchmerge, bool(partial), linear))
   248     repo.ui.debug(_(" ancestor %s local %s remote %s\n") %
   248     repo.ui.debug(_(" ancestor %s local %s remote %s\n") %
   249                   (short(p1), short(p2), short(pa)))
   249                   (short(p1), short(p2), short(pa)))
   250 
   250 
   251     action = []
   251     action = []
   252     m1 = workingmanifest(repo, m1, status)
   252     m1 = workingmanifest(repo, m1, status)
   253 
   253 
   254     if not force:
   254     if not force:
   255         checkunknown(repo, m2, status)
   255         checkunknown(repo, m2, status)
   256     if linear_path:
   256     if linear:
   257         action += forgetremoved(m2, status)
   257         action += forgetremoved(m2, status)
   258     action += manifestmerge(repo.ui, m1, m2, ma, overwrite, backwards, partial)
   258     action += manifestmerge(repo.ui, m1, m2, ma, overwrite, backwards, partial)
   259     del m1, m2, ma
   259     del m1, m2, ma
   260 
   260 
   261     ### apply phase
   261     ### apply phase
   262 
   262 
   263     if linear_path or overwrite:
   263     if linear or overwrite:
   264         # we don't need to do any magic, just jump to the new rev
   264         # we don't need to do any magic, just jump to the new rev
   265         p1, p2 = p2, nullid
   265         p1, p2 = p2, nullid
   266 
   266 
   267     xp1 = hex(p1)
   267     xp1 = hex(p1)
   268     xp2 = hex(p2)
   268     xp2 = hex(p2)