[PATCH] [v2] outgoing: respect ":pushurl" paths (issue5365)

Hollis Blanchard hollis_blanchard at mentor.com
Fri Nov 10 12:21:02 EST 2017


Any additional comments?

Hollis Blanchard <hollis_blanchard at mentor.com>
Mentor Graphics Emulation Division

On 11/03/2017 02:07 PM, Hollis Blanchard wrote:
> # HG changeset patch
> # User Hollis Blanchard <hollis_blanchard at mentor.com>
> # Date 1509731952 25200
> #      Fri Nov 03 10:59:12 2017 -0700
> # Branch stable
> # Node ID a952cae0303fa38d1b246561704071d41bbfa1ea
> # Parent  f445b10dc7fb3495d24d1c22b0996148864c77f7
> [v2] outgoing: respect ":pushurl" paths (issue5365)
>
> Make 'hg outgoing' respect "paths.default:pushurl" in addition to
> "paths.default-push".
>
> 'hg outgoing' has always meant "what will happen if I run 'hg push'?" and it's
> still documented that way:
>
>      Show changesets not found in the specified destination repository or the
>      default push location. These are the changesets that would be pushed if a
>      push was requested.
>
> If the user uses the now-deprecated "paths.default-push" path, it continues to
> work that way. However, as described at
> https://bz.mercurial-scm.org/show_bug.cgi?id=5365, it doesn't behave the same
> with "paths.default:pushurl".
>
> Why does it matter? Similar to the bugzilla reporter, I have a read-only mirror
> of a non-Mercurial repository:
>
>    upstream -> imported mirror -> user clone
>           ^-----------------------/
>
> Users push directly to upstream, and that content is then imported into the
> mirror. However, those repositories are not the same; it's possible that the
> mirroring has either broken completely, or an import process is running and not
> yet complete. In those cases, 'hg outgoing' will list changesets that have
> already been pushed.
>
> Mozilla's desired behavior described in bug 5365 can be accomplished through
> other means (e.g. 'hg outgoing default'), preserving the consistency and
> meaning of 'hg outgoing'.
>
> diff --git a/mercurial/hg.py b/mercurial/hg.py
> --- a/mercurial/hg.py
> +++ b/mercurial/hg.py
> @@ -910,7 +910,11 @@ def incoming(ui, repo, source, opts):
>       return _incoming(display, subreporecurse, ui, repo, source, opts)
>   
>   def _outgoing(ui, repo, dest, opts):
> -    dest = ui.expandpath(dest or 'default-push', dest or 'default')
> +    path = ui.paths.getpath(dest, default=('default-push', 'default'))
> +    if not path:
> +        raise error.Abort(_('default repository not configured!'),
> +                hint=_("see 'hg help config.paths'"))
> +    dest = path.pushloc or path.loc
>       dest, branches = parseurl(dest, opts.get('branch'))
>       ui.status(_('comparing with %s\n') % util.hidepassword(dest))
>       revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev'))
> diff --git a/tests/test-incoming-outgoing.t b/tests/test-incoming-outgoing.t
> --- a/tests/test-incoming-outgoing.t
> +++ b/tests/test-incoming-outgoing.t
> @@ -491,3 +491,71 @@ incoming from empty remote repository
>     searching for changes
>     no changes found
>     [1]
> +
> +Create a "split" repo that pulls from r1 and pushes to r2, using default-push
> +
> +  $ hg clone r1 split
> +  updating to branch default
> +  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  $ ed -s split/.hg/hgrc << EOF
> +  > /^default
> +  > a
> +  > default-push = file://$TESTTMP/r2
> +  > .
> +  > w
> +  > q
> +  > EOF
> +  default = $TESTTMP/r1
> +  $ hg -R split paths
> +  default = $TESTTMP/r1
> +  default-push = file://$TESTTMP/r2
> +  $ hg -R split outgoing
> +  comparing with file://$TESTTMP/r2
> +  searching for changes
> +  changeset:   0:3e92d79f743a
> +  tag:         tip
> +  user:        test
> +  date:        Thu Jan 01 00:00:00 1970 +0000
> +  summary:     a
> +
> +
> +Use default:pushurl instead of default-push
> +
> +  $ ed -s split/.hg/hgrc <<EOF
> +  > /^default-push
> +  > c
> +  > default:pushurl = file://$PWD/r2
> +  > .
> +  > w
> +  > EOF
> +  default-push = file://$TESTTMP/r2
> +  $ hg -R split paths
> +  default = $TESTTMP/r1
> +  default:pushurl = file://$TESTTMP/r2
> +  $ hg -R split outgoing
> +  comparing with file://$TESTTMP/r2
> +  searching for changes
> +  changeset:   0:3e92d79f743a
> +  tag:         tip
> +  user:        test
> +  date:        Thu Jan 01 00:00:00 1970 +0000
> +  summary:     a
> +
> +
> +Push and then double-check outgoing
> +
> +  $ echo a >> split/foo
> +  $ hg -R split commit -Ama
> +  $ hg -R split push
> +  pushing to file://$TESTTMP/r2
> +  searching for changes
> +  adding changesets
> +  adding manifests
> +  adding file changes
> +  added 2 changesets with 2 changes to 1 files
> +  $ hg -R split outgoing
> +  comparing with file://$TESTTMP/r2
> +  searching for changes
> +  no changes found
> +  [1]
> +
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20171110/b6a712ae/attachment.html>


More information about the Mercurial-devel mailing list