<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Any additional comments?<br>
    <pre class="moz-signature" cols="72">Hollis Blanchard <a class="moz-txt-link-rfc2396E" href="mailto:hollis_blanchard@mentor.com"><hollis_blanchard@mentor.com></a>
Mentor Graphics Emulation Division</pre>
    <div class="moz-cite-prefix">On 11/03/2017 02:07 PM, Hollis
      Blanchard wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:a952cae0303fa38d1b24.1509743274@aurora.wv.mentorg.com">
      <pre wrap=""># HG changeset patch
# User Hollis Blanchard <a class="moz-txt-link-rfc2396E" href="mailto:hollis_blanchard@mentor.com"><hollis_blanchard@mentor.com></a>
# 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
<a class="moz-txt-link-freetext" href="https://bz.mercurial-scm.org/show_bug.cgi?id=5365">https://bz.mercurial-scm.org/show_bug.cgi?id=5365</a>, 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 = <a class="moz-txt-link-freetext" href="file://$TESTTMP/r2">file://$TESTTMP/r2</a>
+  > .
+  > w
+  > q
+  > EOF
+  default = $TESTTMP/r1
+  $ hg -R split paths
+  default = $TESTTMP/r1
+  default-push = <a class="moz-txt-link-freetext" href="file://$TESTTMP/r2">file://$TESTTMP/r2</a>
+  $ hg -R split outgoing
+  comparing with <a class="moz-txt-link-freetext" href="file://$TESTTMP/r2">file://$TESTTMP/r2</a>
+  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 = <a class="moz-txt-link-freetext" href="file://$PWD/r2">file://$PWD/r2</a>
+  > .
+  > w
+  > EOF
+  default-push = <a class="moz-txt-link-freetext" href="file://$TESTTMP/r2">file://$TESTTMP/r2</a>
+  $ hg -R split paths
+  default = $TESTTMP/r1
+  default:pushurl = <a class="moz-txt-link-freetext" href="file://$TESTTMP/r2">file://$TESTTMP/r2</a>
+  $ hg -R split outgoing
+  comparing with <a class="moz-txt-link-freetext" href="file://$TESTTMP/r2">file://$TESTTMP/r2</a>
+  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 <a class="moz-txt-link-freetext" href="file://$TESTTMP/r2">file://$TESTTMP/r2</a>
+  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 <a class="moz-txt-link-freetext" href="file://$TESTTMP/r2">file://$TESTTMP/r2</a>
+  searching for changes
+  no changes found
+  [1]
+
_______________________________________________
Mercurial-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Mercurial-devel@mercurial-scm.org">Mercurial-devel@mercurial-scm.org</a>
<a class="moz-txt-link-freetext" href="https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel">https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>