[PATCH] Make pull -u behave like pull && update

Adrian Buehlmann adrian at cadifra.com
Tue May 31 14:48:11 CDT 2011


On 2011-05-31 20:53, Brendan Cully wrote:
> # HG changeset patch
> # User Brendan Cully <brendan at kublai.com>
> # Date 1306867942 25200
> # Node ID d3d79bfdb1e256c43f0ebde0f49ecebe40058c2f
> # Parent  bd34a027f3edad33e71c02def67eb446473b6cf4
> 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.
> 
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -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.write(_("not updating: %s\n" % str(inst)))

shouldn't this be ui.warn ?

(otherwise, the patch looks reasonable)

> +            return 0
>      if modheads > 1:
>          currentbranchheads = len(repo.branchheads())
>          if currentbranchheads == modheads:
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -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
> diff --git a/tests/test-issue1502.t b/tests/test-issue1502.t
> --- a/tests/test-issue1502.t
> +++ b/tests/test-issue1502.t
> @@ -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
> diff --git a/tests/test-merge5.t b/tests/test-merge5.t
> --- a/tests/test-merge5.t
> +++ b/tests/test-merge5.t
> @@ -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
> diff --git a/tests/test-pull-branch.t b/tests/test-pull-branch.t
> --- a/tests/test-pull-branch.t
> +++ b/tests/test-pull-branch.t
> @@ -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 
> diff --git a/tests/test-pull-update.t b/tests/test-pull-update.t
> --- a/tests/test-pull-update.t
> +++ b/tests/test-pull-update.t
> @@ -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
> diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
> --- a/tests/test-update-branches.t
> +++ b/tests/test-update-branches.t
> @@ -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
>  
>  
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
> 
> 


More information about the Mercurial-devel mailing list