mercurial/localrepo.py
changeset 2266 3f7692b0ff13
parent 2264 fdb699b5e132
child 2269 8cb77698f5fd
equal deleted inserted replaced
2265:3e4a1a0739c2 2266:3f7692b0ff13
  1590             raise util.Abort(_("there is nothing to merge, "
  1590             raise util.Abort(_("there is nothing to merge, "
  1591                                "just use 'hg update'"))
  1591                                "just use 'hg update'"))
  1592         if allow and not forcemerge:
  1592         if allow and not forcemerge:
  1593             if modified or added or removed:
  1593             if modified or added or removed:
  1594                 raise util.Abort(_("outstanding uncommitted changes"))
  1594                 raise util.Abort(_("outstanding uncommitted changes"))
       
  1595 
  1595         if not forcemerge and not force:
  1596         if not forcemerge and not force:
  1596             for f in unknown:
  1597             for f in unknown:
  1597                 if f in m2:
  1598                 if f in m2:
  1598                     t1 = self.wread(f)
  1599                     t1 = self.wread(f)
  1599                     t2 = self.file(f).read(m2[f])
  1600                     t2 = self.file(f).read(m2[f])
  1763                 self.ui.status(_("(use 'hg merge' to merge across branches"
  1764                 self.ui.status(_("(use 'hg merge' to merge across branches"
  1764                                  " or 'hg update -C' to lose changes)\n"))
  1765                                  " or 'hg update -C' to lose changes)\n"))
  1765                 return 1
  1766                 return 1
  1766             branch_merge = True
  1767             branch_merge = True
  1767 
  1768 
       
  1769         xp1 = hex(p1)
       
  1770         xp2 = hex(p2)
       
  1771         if p2 == nullid: xxp2 = ''
       
  1772         else: xxp2 = xp2
       
  1773 
       
  1774         self.hook('preupdate', throw=True, parent1=xp1, parent2=xxp2)
       
  1775 
  1768         # get the files we don't need to change
  1776         # get the files we don't need to change
  1769         files = get.keys()
  1777         files = get.keys()
  1770         files.sort()
  1778         files.sort()
  1771         for f in files:
  1779         for f in files:
  1772             if f[0] == "/":
  1780             if f[0] == "/":
  1783 
  1791 
  1784         # merge the tricky bits
  1792         # merge the tricky bits
  1785         failedmerge = []
  1793         failedmerge = []
  1786         files = merge.keys()
  1794         files = merge.keys()
  1787         files.sort()
  1795         files.sort()
  1788         xp1 = hex(p1)
       
  1789         xp2 = hex(p2)
       
  1790         for f in files:
  1796         for f in files:
  1791             self.ui.status(_("merging %s\n") % f)
  1797             self.ui.status(_("merging %s\n") % f)
  1792             my, other, flag = merge[f]
  1798             my, other, flag = merge[f]
  1793             ret = self.merge3(f, my, other, xp1, xp2)
  1799             ret = self.merge3(f, my, other, xp1, xp2)
  1794             if ret:
  1800             if ret:
  1848                     self.ui.status(_("(branch merge, don't forget to commit)\n"))
  1854                     self.ui.status(_("(branch merge, don't forget to commit)\n"))
  1849             elif failedmerge:
  1855             elif failedmerge:
  1850                 self.ui.status(_("There are unresolved merges with"
  1856                 self.ui.status(_("There are unresolved merges with"
  1851                                  " locally modified files.\n"))
  1857                                  " locally modified files.\n"))
  1852 
  1858 
       
  1859         self.hook('update', parent1=xp1, parent2=xxp2, error=int(err))
  1853         return err
  1860         return err
  1854 
  1861 
  1855     def merge3(self, fn, my, other, p1, p2):
  1862     def merge3(self, fn, my, other, p1, p2):
  1856         """perform a 3-way merge in the working directory"""
  1863         """perform a 3-way merge in the working directory"""
  1857 
  1864