[issue1916] hg bails when ) 1) forget to pull/update 2) commit/push specific files only 3) pull/update

Greg Ward greg-hg at gerg.ca
Sat Nov 21 18:58:01 CST 2009


On Sat, Nov 21, 2009 at 11:44 AM, timeless <timeless at gmail.com> wrote:
> # HG changeset patch
> # User timeless at mozdev.org
> # Date 1258821791 -7200
> # Node ID 726a846440a00465c74f6d5069377fad157b955b
> # Parent  b5170b8b32a5a8a77a9062da5726c0e4a667410d
> Handle forgetting to pull distinctly from intentionally forking (issue1916)
>
> If a user clones a repository and makes a change and commits, they haven't
> added any heads. When a second user clones that same repository at that same
> point and commits, they too haven't added a head. One of them will lose a push
> race. When this happens, we want to tell them that they need to pull, not that
> they need to merge (as neither of them have anything locally that needed to
> merge).
>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1509,8 +1509,12 @@ class localrepository(repo.repository):
>                 else:
>                     self.ui.warn(_("abort: push creates new remote heads!\n"))
>
> -                self.ui.status(_("(did you forget to merge?"
> -                                 " use push -f to force)\n"))
> +                if len(lheads) == len(rheads):
> +                    self.ui.status(_("(did you forget to pull?"
> +                                     " use push -f to force)\n"))

Great idea!  I wonder if it would be even better to say something like

  did you forget to pull/merge?
  did you forget to pull then merge?
  did you forget to pull and merge?

since, after all, you typically have to do both.

Greg


More information about the Mercurial-devel mailing list