diff mercurial/merge.py @ 3580:41989e55fa37

allow update to switch to a different branch if the repo is clean
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 29 Oct 2006 13:08:10 +0100
parents 3b4e00cba57a
children be61bd32046c fffc8a733bf9
line wrap: on
line diff
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -384,9 +384,13 @@ def update(repo, node, branchmerge, forc
         if branchmerge:
             raise util.Abort(_("there is nothing to merge, just use "
                                "'hg update' or look at 'hg heads'"))
-    elif not (overwrite or branchmerge):
-        raise util.Abort(_("update spans branches, use 'hg merge' "
-                           "or 'hg update -C' to lose changes"))
+    elif not branchmerge:
+        if not overwrite:
+            if wc.files():
+                raise util.Abort(_("outstanding uncommited changes, use "
+                                   "'hg update -C' to lose changes"))
+            else:
+                overwrite = True
     if branchmerge and not forcemerge:
         if wc.modified() or wc.added() or wc.removed():
             raise util.Abort(_("outstanding uncommitted changes"))