mercurial/localrepo.py
changeset 1679 675ca845c2f8
parent 1678 b345cc4c22c0
parent 1588 a679a364436a
child 1680 c21b54f7f7b8
equal deleted inserted replaced
1678:b345cc4c22c0 1679:675ca845c2f8
    22                 if p == oldp: raise repo.RepoError(_("no repo found"))
    22                 if p == oldp: raise repo.RepoError(_("no repo found"))
    23             path = p
    23             path = p
    24         self.path = os.path.join(path, ".hg")
    24         self.path = os.path.join(path, ".hg")
    25 
    25 
    26         if not create and not os.path.isdir(self.path):
    26         if not create and not os.path.isdir(self.path):
    27             raise repo.RepoError(_("repository %s not found") % self.path)
    27             raise repo.RepoError(_("repository %s not found") % path)
    28 
    28 
    29         self.root = os.path.abspath(path)
    29         self.root = os.path.abspath(path)
    30         self.ui = ui
    30         self.ui = ui
    31         self.opener = util.opener(self.path)
    31         self.opener = util.opener(self.path)
    32         self.wopener = util.opener(self.root)
    32         self.wopener = util.opener(self.root)
  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