[revised PATCH stable] document 'default' and 'default-push' in paths docstring

Martin Geisler mg at lazybytes.net
Fri Apr 16 16:55:46 CDT 2010


On Fri, Apr 16, 2010 at 23:12, Faheem Mitha <faheem at email.unc.edu> wrote:
> Timeless and myself fiddled with this a bit more yesterday. We also
> used a suggestion from hstuart. The result was below. I was meaning to
> post this, but Martin already pushed the previous version to crew. :-)

Oh, sorry about that, I was just happy to finally push a patch again :-)

> Anyway, a couple of things.
>
> 1) timeless observed that default and default-push aren't just used
> for pull and push. incoming and outgoing use them too, hence the
> wording. Does anything else use these?

They are actually also used for 'hg bundle' and for 'hg email' and
perhaps more that I cannot come to think of right now.

> 2) timeless also suggested writing tests for usage of default and
> default-push. There are tests for push using default-push and default
> when push is not set, but I didn't see anything for pull when default
> is set, or for incoming and outgoing when default / default-push is
> set. Opinions about adding these?

I sounds like the tests cover some cases and the rest (pull with
default set) is covered by our daily usage. So I don't see a big need
for such tests. But if you write them, then I'll of course be happy to
push them.

> # HG changeset patch
> # User Faheem Mitha <faheem at email.unc.edu>
> # Date 1271451531 -19800
> # Node ID 626713d803ba28acc81eb55cc825a7361a5130b7
> # Parent  a8486615eece30274b3f8b4d93daf3d37af65b9e
> Document 'default' and 'default-push' in paths docstring
>
> diff -r a8486615eece -r 626713d803ba mercurial/commands.py
> --- a/mercurial/commands.py     Fri Apr 16 22:14:14 2010 +0200
> +++ b/mercurial/commands.py     Sat Apr 17 02:28:51 2010 +0530
> @@ -2375,10 +2375,13 @@
>     Path names are defined in the [paths] section of /etc/mercurial/hgrc
>     and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too.
>
> -    The names 'default' and 'default-push' have a special meaning.
> -    They are the locations used when pulling and pushing respectively
> -    unless a location is specified. When cloning a repository, the
> -    clone source is written as 'default' in .hg/hgrc.
> +    For operations requiring a location, if one is not specified, the
> +    path names 'default' and 'default-push', if defined, are used as
> +    fallbacks for incoming and outgoing operations, respectively.

I don't like the flow in that sentence, I think it is chopped up into
too many pieces. What about:

  The names 'default' and 'default-push' have a special meaning. Doing
'hg pull' or 'hg incoming' will use 'default' when no location is
given whereas 'hg push' and 'hg outgoing' will use 'default-push'. If
'default-push' is not defined, then 'default' is used as a fallback
for both incoming and outgoing operations.

-- 
Martin Geisler


More information about the Mercurial-devel mailing list