mercurial/localrepo.py
changeset 1586 5c5aaaa9ab6f
parent 1582 63799b01985c
parent 1581 db10b7114de0
child 1588 a679a364436a
equal deleted inserted replaced
1585:d7c4b9bfcc94 1586:5c5aaaa9ab6f
  1362                 self.hook("commit", node=hex(self.changelog.node(i)))
  1362                 self.hook("commit", node=hex(self.changelog.node(i)))
  1363 
  1363 
  1364         return
  1364         return
  1365 
  1365 
  1366     def update(self, node, allow=False, force=False, choose=None,
  1366     def update(self, node, allow=False, force=False, choose=None,
  1367                moddirstate=True):
  1367                moddirstate=True, forcemerge=False):
  1368         pl = self.dirstate.parents()
  1368         pl = self.dirstate.parents()
  1369         if not force and pl[1] != nullid:
  1369         if not force and pl[1] != nullid:
  1370             self.ui.warn(_("aborting: outstanding uncommitted merges\n"))
  1370             self.ui.warn(_("aborting: outstanding uncommitted merges\n"))
  1371             return 1
  1371             return 1
  1372 
  1372 
  1381         mf2 = self.manifest.readflags(m2n)
  1381         mf2 = self.manifest.readflags(m2n)
  1382         ma = self.manifest.read(man)
  1382         ma = self.manifest.read(man)
  1383         mfa = self.manifest.readflags(man)
  1383         mfa = self.manifest.readflags(man)
  1384 
  1384 
  1385         (c, a, d, u) = self.changes()
  1385         (c, a, d, u) = self.changes()
       
  1386 
       
  1387         if allow and not forcemerge:
       
  1388             if c or a or d:
       
  1389                 raise util.Abort(_("outstanding uncommited changes"))
       
  1390         if not forcemerge and not force:
       
  1391             for f in u:
       
  1392                 if f in m2:
       
  1393                      t1 = self.wread(f)
       
  1394                      t2 = self.file(f).read(m2[f])
       
  1395                      if cmp(t1, t2) != 0:
       
  1396                         raise util.Abort(_("'%s' already exists in the working"
       
  1397                                            " dir and differs from remote") % f)
  1386 
  1398 
  1387         # is this a jump, or a merge?  i.e. is there a linear path
  1399         # is this a jump, or a merge?  i.e. is there a linear path
  1388         # from p1 to p2?
  1400         # from p1 to p2?
  1389         linear_path = (pa == p1 or pa == p2)
  1401         linear_path = (pa == p1 or pa == p2)
  1390 
  1402