[PATCH] push: add a message when pushing phases but not changes

Martin von Zweigbergk martinvonz at google.com
Tue Dec 6 12:15:56 EST 2016


On Fri, Dec 2, 2016 at 11:12 AM, Jeremy Wall (zaphar)
<jeremy at marzhillstudios.com> wrote:
> # HG changeset patch
> # User Jeremy Wall (zaphar) <jeremy at marzhillstudios.com>
> # Date 1480542942 21600
> #      Wed Nov 30 15:55:42 2016 -0600
> # Node ID 9cb1540e417dc79a55944adffb691a3ada01571c
> # Parent  9e29d4e4e08b5996adda49cdd0b497d89e2b16ee
> push: add a message when pushing phases but not changes
>
> This is an attempt to fix
> https://bz.mercurial-scm.org/show_bug.cgi?id=4232

Thanks, that "no changes found" has struck me as misleading. Question
for others: will it be considered BC-breaking to change it to e.g. "no
changesets found"?

>
> diff -r 9e29d4e4e08b -r 9cb1540e417d mercurial/exchange.py
> --- a/mercurial/exchange.py     Tue Nov 29 04:11:05 2016 -0800
> +++ b/mercurial/exchange.py     Wed Nov 30 15:55:42 2016 -0600
> @@ -14,6 +14,7 @@
>  from .node import (
>      hex,
>      nullid,
> +    short,
>  )
>  from . import (
>      base85,
> @@ -643,9 +644,20 @@
>  def _pushcheckoutgoing(pushop):
>      outgoing = pushop.outgoing
>      unfi = pushop.repo.unfiltered()
> +    ui = unfi.ui
>      if not outgoing.missing:
> -        # nothing to push
> -        scmutil.nochangesfound(unfi.ui, unfi, outgoing.excluded)
> +        # TODO(jeremy): Question? Should I be worrying about
> +        # fallbackoutdatedphases here too?
> +        # phases to push
> +        if pushop.outdatedphases:
> +            for outphase in pushop.outdatedphases:
> +                # TODO(jeremy): Is this the right way to report this?
> +                ui.status(_("sending phase %s for %s\n") %
> +                          (outphase.phasestr(), short(outphase.node())))
> +                # TODO(jeremy): Do I still return false?
> +        else:
> +            # nothing to push
> +            scmutil.nochangesfound(ui, unfi, outgoing.excluded)

Instead of displaying the message only when no changesets are pushed,
it seems better to do what Pierre-Yves suggested on the bug: display a
message when we're updating phases on changesets not involved in the
push.

On that topic, but off topic for this patch, I'd also like for the
obsmarker exchange to be mentioned in the output. For changeset
discovery, we say "searching for changes", but for obsmarkers, it's
just a progress bar that says "preparing locally". (Phase and bookmark
discover is usually quick enough that I don't think they need to be
mentioned.)

>          return False
>      # something to push
>      if not pushop.force:
> diff -r 9e29d4e4e08b -r 9cb1540e417d tests/test-phases-exchange.t
> --- a/tests/test-phases-exchange.t      Tue Nov 29 04:11:05 2016 -0800
> +++ b/tests/test-phases-exchange.t      Wed Nov 30 15:55:42 2016 -0600
> @@ -384,7 +384,7 @@
>    $ hg push ../alpha # from nu
>    pushing to ../alpha
>    searching for changes
> -  no changes found
> +  sending phase public for 145e75495359

I think a summary would better than listing every phase root (?).
There could potentially be many. We usually say something like "added
X changesets with Y changes to Z files (+W heads)" for changesets, so
maybe just "updated X phase boundaries" or something like that, or
maybe "updated phases on X commits", since the user is probably not
expected to know what a phase boundary is.

>    [1]
>    $ cd ..
>    $ cd alpha
> @@ -600,7 +600,7 @@
>    $ hg push ../alpha
>    pushing to ../alpha
>    searching for changes
> -  no changes found
> +  sending phase public for b740e3e5c05d
>    [1]
>    $ hgph
>    o  6 public a-F - b740e3e5c05d
> @@ -705,7 +705,7 @@
>    $ hg push ../alpha
>    pushing to ../alpha
>    searching for changes
> -  no changes found
> +  sending phase draft for 967b449fbc94
>    [1]
>    $ hgph
>    o  9 public a-H - 967b449fbc94
> diff -r 9e29d4e4e08b -r 9cb1540e417d tests/test-push-warn.t
> --- a/tests/test-push-warn.t    Tue Nov 29 04:11:05 2016 -0800
> +++ b/tests/test-push-warn.t    Wed Nov 30 15:55:42 2016 -0600
> @@ -125,7 +125,7 @@
>    $ hg push -r 2 ../c
>    pushing to ../c
>    searching for changes
> -  no changes found
> +  sending phase public for d9f42cd1a1ec
>    [1]
>
>    $ hg push -r 3 ../c
> diff -r 9e29d4e4e08b -r 9cb1540e417d tests/test-subrepo.t
> --- a/tests/test-subrepo.t      Tue Nov 29 04:11:05 2016 -0800
> +++ b/tests/test-subrepo.t      Wed Nov 30 15:55:42 2016 -0600
> @@ -1519,7 +1519,13 @@
>  (issue3781)
>
>    $ cp -r main issue3781
> +  cp: main/.hg/cache/checklink: No such file or directory
> +  cp: main/s/.hg/cache/checklink: No such file or directory
> +  [1]
>    $ cp -r main issue3781-dest
> +  cp: main/.hg/cache/checklink: No such file or directory
> +  cp: main/s/.hg/cache/checklink: No such file or directory
> +  [1]
>    $ cd issue3781-dest/s
>    $ hg phase tip # show we have draft changeset
>    5: draft
> @@ -1535,7 +1541,8 @@
>    searching for changes
>    no changes found
>    searching for changes
> -  no changes found
> +  sending phase draft for d6125d9cc876
> +  sending phase draft for 8bd5629adcbe
>    [1]
>  # clean the push cache
>    $ rm s/.hg/cache/storehash/*
> diff -r 9e29d4e4e08b -r 9cb1540e417d tests/test-treediscovery-legacy.t
> --- a/tests/test-treediscovery-legacy.t Tue Nov 29 04:11:05 2016 -0800
> +++ b/tests/test-treediscovery-legacy.t Wed Nov 30 15:55:42 2016 -0600
> @@ -115,7 +115,7 @@
>    $ hg push $remote
>    pushing to http://localhost:$HGPORT/
>    searching for changes
> -  no changes found
> +  sending phase public for a19bfa7e7328
>    [1]
>    $ cd ..
>
> diff -r 9e29d4e4e08b -r 9cb1540e417d tests/test-treediscovery.t
> --- a/tests/test-treediscovery.t        Tue Nov 29 04:11:05 2016 -0800
> +++ b/tests/test-treediscovery.t        Wed Nov 30 15:55:42 2016 -0600
> @@ -104,7 +104,7 @@
>    $ hg push $remote
>    pushing to http://localhost:$HGPORT/
>    searching for changes
> -  no changes found
> +  sending phase public for a19bfa7e7328
>    [1]
>    $ cd ..
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list