mercurial/localrepo.py
changeset 1586 5c5aaaa9ab6f
parent 1582 63799b01985c
parent 1581 db10b7114de0
child 1588 a679a364436a
--- a/mercurial/localrepo.py	Mon Dec 12 07:50:43 2005 -0800
+++ b/mercurial/localrepo.py	Thu Dec 15 15:39:20 2005 +0100
@@ -1364,7 +1364,7 @@
         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 @@
 
         (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)