update: use normal update path with --check (issue2450)
authorMatt Mackall <mpm@selenic.com>
Thu, 09 Feb 2012 13:16:20 -0600
changeset 16092 914bc95e227b
parent 16090 e1d8218d733b
child 16093 7e30f5f2285f
update: use normal update path with --check (issue2450) This avoids clobbering unknown files on update by not using overwrite mode.
mercurial/commands.py
mercurial/merge.py
--- a/mercurial/commands.py	Mon Feb 06 15:36:44 2012 -0600
+++ b/mercurial/commands.py	Thu Feb 09 13:16:20 2012 -0600
@@ -5711,18 +5711,20 @@
     if check and clean:
         raise util.Abort(_("cannot specify both -c/--check and -C/--clean"))
 
+    if date:
+        if rev is not None:
+            raise util.Abort(_("you can't specify a revision and a date"))
+        rev = cmdutil.finddate(ui, repo, date)
+
     if check:
         # we could use dirty() but we can ignore merge and branch trivia
         c = repo[None]
         if c.modified() or c.added() or c.removed():
             raise util.Abort(_("uncommitted local changes"))
-
-    if date:
-        if rev is not None:
-            raise util.Abort(_("you can't specify a revision and a date"))
-        rev = cmdutil.finddate(ui, repo, date)
-
-    if clean or check:
+        if not rev:
+            rev = repo[repo[None].branch()].rev()
+
+    if clean:
         ret = hg.clean(repo, rev)
     else:
         ret = hg.update(repo, rev)
--- a/mercurial/merge.py	Mon Feb 06 15:36:44 2012 -0600
+++ b/mercurial/merge.py	Thu Feb 09 13:16:20 2012 -0600
@@ -558,7 +558,7 @@
                                    " --check to force update)"))
             else:
                 # Allow jumping branches if clean and specific rev given
-                overwrite = True
+                pa = p1
 
         ### calculate phase
         action = []