changeset 14485:610873cf064a

Make pull -u behave like pull && update Previously, pull would not update if new branch heads were received, whereas pull && update would move to the tipmost branch head. Also change the "crosses branches" abort in merge.update from "crosses branches (merge branches or use --check to force update)" to "crosses branches (merge branches or update --check to force update)" since it can no longer assume the user is running hg update.
author Brendan Cully <brendan@kublai.com>
date Tue, 31 May 2011 11:52:22 -0700
parents 4582a4dd1817
children 4e3eda05189b
files mercurial/commands.py mercurial/merge.py tests/test-issue1502.t tests/test-merge5.t tests/test-pull-branch.t tests/test-pull-update.t tests/test-update-branches.t
diffstat 7 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue May 31 15:55:23 2011 -0500
+++ b/mercurial/commands.py	Tue May 31 11:52:22 2011 -0700
@@ -3655,10 +3655,11 @@
     if modheads == 0:
         return
     if optupdate:
-        if (modheads <= 1 or len(repo.branchheads()) == 1) or checkout:
+        try:
             return hg.update(repo, checkout)
-        else:
-            ui.status(_("not updating, since new heads added\n"))
+        except util.Abort, inst:
+            ui.warn(_("not updating: %s\n" % str(inst)))
+            return 0
     if modheads > 1:
         currentbranchheads = len(repo.branchheads())
         if currentbranchheads == modheads:
--- a/mercurial/merge.py	Tue May 31 15:55:23 2011 -0500
+++ b/mercurial/merge.py	Tue May 31 11:52:22 2011 -0700
@@ -529,7 +529,7 @@
                 raise util.Abort(_("crosses branches (merge branches or use"
                                    " --clean to discard changes)"))
             elif onode is None:
-                raise util.Abort(_("crosses branches (merge branches or use"
+                raise util.Abort(_("crosses branches (merge branches or update"
                                    " --check to force update)"))
             else:
                 # Allow jumping branches if clean and specific rev given
--- a/tests/test-issue1502.t	Tue May 31 15:55:23 2011 -0500
+++ b/tests/test-issue1502.t	Tue May 31 11:52:22 2011 -0700
@@ -19,8 +19,7 @@
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
-  not updating, since new heads added
-  (run 'hg heads' to see heads, 'hg merge' to merge)
+  not updating: crosses branches (merge branches or update --check to force update)
 
   $ hg -R foo1 book branchy
   $ hg -R foo1 book
--- a/tests/test-merge5.t	Tue May 31 15:55:23 2011 -0500
+++ b/tests/test-merge5.t	Tue May 31 11:52:22 2011 -0700
@@ -14,7 +14,7 @@
   $ hg update 1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg update
-  abort: crosses branches (merge branches or use --check to force update)
+  abort: crosses branches (merge branches or update --check to force update)
   [255]
   $ hg update -c
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
--- a/tests/test-pull-branch.t	Tue May 31 15:55:23 2011 -0500
+++ b/tests/test-pull-branch.t	Tue May 31 11:52:22 2011 -0700
@@ -131,11 +131,12 @@
   adding manifests
   adding file changes
   added 4 changesets with 4 changes to 1 files (+1 heads)
-  not updating, since new heads added
-  (run 'hg heads' to see heads, 'hg merge' to merge)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Make changes on new branch on tt
 
+  $ hg up 6
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg branch branchC
   marked working directory as branch branchC
   $ echo b1 > bar 
--- a/tests/test-pull-update.t	Tue May 31 15:55:23 2011 -0500
+++ b/tests/test-pull-update.t	Tue May 31 11:52:22 2011 -0700
@@ -25,8 +25,7 @@
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
-  not updating, since new heads added
-  (run 'hg heads' to see heads, 'hg merge' to merge)
+  not updating: crosses branches (merge branches or update --check to force update)
 
   $ cd ../tt
 
@@ -39,8 +38,7 @@
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
-  not updating, since new heads added
-  (run 'hg heads' to see heads, 'hg merge' to merge)
+  not updating: crosses branches (merge branches or update --check to force update)
 
   $ HGMERGE=true hg merge
   merging foo
--- a/tests/test-update-branches.t	Tue May 31 15:55:23 2011 -0500
+++ b/tests/test-update-branches.t	Tue May 31 11:52:22 2011 -0700
@@ -77,7 +77,7 @@
   parent=5
 
   $ norevtest 'none clean same'   clean 2
-  abort: crosses branches (merge branches or use --check to force update)
+  abort: crosses branches (merge branches or update --check to force update)
   parent=2