mercurial/localrepo.py
changeset 1581 db10b7114de0
parent 1559 59b3639df0a9
child 1586 5c5aaaa9ab6f
equal deleted inserted replaced
1580:4737b36e324e 1581:db10b7114de0
  1356                 self.hook("commit", node=hex(self.changelog.node(i)))
  1356                 self.hook("commit", node=hex(self.changelog.node(i)))
  1357 
  1357 
  1358         return
  1358         return
  1359 
  1359 
  1360     def update(self, node, allow=False, force=False, choose=None,
  1360     def update(self, node, allow=False, force=False, choose=None,
  1361                moddirstate=True):
  1361                moddirstate=True, forcemerge=False):
  1362         pl = self.dirstate.parents()
  1362         pl = self.dirstate.parents()
  1363         if not force and pl[1] != nullid:
  1363         if not force and pl[1] != nullid:
  1364             self.ui.warn(_("aborting: outstanding uncommitted merges\n"))
  1364             self.ui.warn(_("aborting: outstanding uncommitted merges\n"))
  1365             return 1
  1365             return 1
  1366 
  1366 
  1375         mf2 = self.manifest.readflags(m2n)
  1375         mf2 = self.manifest.readflags(m2n)
  1376         ma = self.manifest.read(man)
  1376         ma = self.manifest.read(man)
  1377         mfa = self.manifest.readflags(man)
  1377         mfa = self.manifest.readflags(man)
  1378 
  1378 
  1379         (c, a, d, u) = self.changes()
  1379         (c, a, d, u) = self.changes()
       
  1380 
       
  1381         if allow and not forcemerge:
       
  1382             if c or a or d:
       
  1383                 raise util.Abort(_("outstanding uncommited changes"))
       
  1384         if not forcemerge and not force:
       
  1385             for f in u:
       
  1386                 if f in m2:
       
  1387                      t1 = self.wread(f)
       
  1388                      t2 = self.file(f).read(m2[f])
       
  1389                      if cmp(t1, t2) != 0:
       
  1390                         raise util.Abort(_("'%s' already exists in the working"
       
  1391                                            " dir and differs from remote") % f)
  1380 
  1392 
  1381         # is this a jump, or a merge?  i.e. is there a linear path
  1393         # is this a jump, or a merge?  i.e. is there a linear path
  1382         # from p1 to p2?
  1394         # from p1 to p2?
  1383         linear_path = (pa == p1 or pa == p2)
  1395         linear_path = (pa == p1 or pa == p2)
  1384 
  1396