[PATCH] push: move handling of explicitly pushed bookmarks into localrepo.push()

Matt Mackall mpm at selenic.com
Fri Dec 7 13:39:46 CST 2012


On Fri, 2012-12-07 at 12:51 -0600, Kevin Bullock wrote:
> # HG changeset patch
> # User Kevin Bullock <kbullock at ringworld.org>
> # Date 1354905590 21600
> # Node ID 47f4b9b1667a8af4df75fce5d2af8d12160f3f0b
> # Parent  f3991bcf4f0ff43b43a1b1d0210925a629ef3b9c
> push: move handling of explicitly pushed bookmarks into localrepo.push()
> 
> This puts the handling of bookmarks pushed with -B/--bookmark in the
> same place as already-shared bookmarks.
> 
> As a side effect, the undocumented exit code 2 for push (indicating
> that bookmarks explicitly listed couldn't be synched) is eliminated.

The docs for push say:

    Returns 0 if push was successful, 1 if nothing to push.

Most of the time, we say something like:

    Returns 0 if successful.

This implies by omission that all other exit codes are some sort of
failure. Most of these are 127/255 (abort, depending on platform), but
sometimes 1 is used. But here (and a few other places, like grep) 1 is a
non-error exit code. 2 is indeed a bit unusual here, but still falls
into the category of not-documented-as-success.

>    bookmark badname does not exist on the local or remote repository!
> -  [2]
> +  [1]

That's one failure mode. And indeed, "nothing to push" makes some sense
here. But it probably still warrants a failure, as you asked Mercurial
to push a specific thing that didn't exist.

But there's also this one:

            if not r:
                ui.warn(_('updating bookmark %s failed!\n') % b)
                if not result:
                    result = 2

This will generally be caused by divergent bookmarks or lack of remote
bookmark support. And that's definitely more of a failure than "nothing
to push".

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list