diff mercurial/localrepo.py @ 1679:675ca845c2f8

Merge with upstream
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Thu, 15 Dec 2005 18:04:39 +0100
parents b345cc4c22c0 a679a364436a
children c21b54f7f7b8
line wrap: on
line diff
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -24,7 +24,7 @@ class localrepository(object):
         self.path = os.path.join(path, ".hg")
 
         if not create and not os.path.isdir(self.path):
-            raise repo.RepoError(_("repository %s not found") % self.path)
+            raise repo.RepoError(_("repository %s not found") % path)
 
         self.root = os.path.abspath(path)
         self.ui = ui
@@ -1364,7 +1364,7 @@ class localrepository(object):
         return
 
     def update(self, node, allow=False, force=False, choose=None,
-               moddirstate=True):
+               moddirstate=True, forcemerge=False):
         pl = self.dirstate.parents()
         if not force and pl[1] != nullid:
             self.ui.warn(_("aborting: outstanding uncommitted merges\n"))
@@ -1384,6 +1384,18 @@ class localrepository(object):
 
         (c, a, d, u) = self.changes()
 
+        if allow and not forcemerge:
+            if c or a or d:
+                raise util.Abort(_("outstanding uncommited changes"))
+        if not forcemerge and not force:
+            for f in u:
+                if f in m2:
+                     t1 = self.wread(f)
+                     t2 = self.file(f).read(m2[f])
+                     if cmp(t1, t2) != 0:
+                        raise util.Abort(_("'%s' already exists in the working"
+                                           " dir and differs from remote") % f)
+
         # is this a jump, or a merge?  i.e. is there a linear path
         # from p1 to p2?
         linear_path = (pa == p1 or pa == p2)