Re: [PATCH] fetch: only show "Fetching remote" when verbose mode is enabled

2015-10-25 Thread Paul Wise
On Sun, 2015-10-25 at 11:34 -0700, Junio C Hamano wrote:

> I ignored your patch when you sent it the first time the last week,
> due to the same issues I had with this round (see below) and forgot
> about it.

Thanks for the feedback this round.


> I cannot tell if you are trying to say if that is problematic, or if
> you are trying to say if it is a good thing.

It is just a description of the current behaviour when fetching a
single remote and is used as a justification for changing the behaviour
when fetching multiple remotes to match the behaviour when fetching a
single remote, because that suits my myrepos use-case better.

> I cannot tell what "This" refers to.

Replace "This" with "This patch".

> Your earlier sentence was about the behaviour of fetching from one
> remote, e.g. "git fetch this".  And this second sentence makes it
> sound as if that behaviour has some influence on how verbosely "git
> fetch group" (where 'this' and 'that' are members of 'remotes.group')
> to fetch from multiple remotes behaves.

There is no correlation between the verbosity of fetching one remote
and fetching multiple remotes but I would like them to have the same
verbosity level by default. I would like the default verbosity level to
be to not print anything when nothing was fetched. This is the default
verbosity level for fetching a single remote but not multiple remotes.

> Also (and this is the more important part of my complaint), I cannot
> tell if you are saying that it is *bad* for fetching multiple to be
> just as verbose, or if it is *good*, or what.

I think it is good, as long as they both default to printing nothing
when no commits/tags/etc were fetched.

> If you are fetching from two places, and only one of them has
> something new, you would see

I am not interested in that case, only in the case where multiple
remotes are being fetched and no commits/tags/etc were fetched,
essentially I want to turn this output:

$ git fetch --all
Fetching origin
Fetching mirror

Into this output:

$ git fetch --all

> That does not sound like a valid excuse to change the behaviour of
> the command everybody, not just "myrepos tool" (whatever it is),
> uses.  Your explanation does not seem to give us enough information
> to answer this question intelligently: shouldn't you be fixing
> myrepos instead, perhaps by making it run 'git fetch' with more
> verbose mode, if it wants to see more information, or running 'git
> fetch' and parsing different parts of its output?

myrepos is a tool for managing multiple repos of different types:

https://myrepos.branchable.com/

It definitely wouldn't be appropriate to add screen scraping and
parsing of different version control systems to myrepos.

myrepos doesn't care about the output of repository tools beyond
whether there was any output or not. myrepos will pass --verbose and
other flags on to git fetch if the user passes --verbose to it.

> Having said all that, this time I read the change and the change
> itself feels 40% sensible, even for those who do not care about
> "myrepos" at all.
All I want is for "Fetching remote" to not be printed when there are no
changes fetched and I haven't used the --verbose option.

I realise now that my patch is actually incorrect in that it also
suppresses "Fetching remote" messages when some changes were fetched.

I will come back with a correct patch that is better explained.

> I'd sell it like the attached, if I were doing this patch.  The last
> paragraph is where the remaining 60% went ;-)

Thanks, I will try to re-use that for the next patch.

> Note that the current output was deliberately designed like this to
> give an easy reminder for the user what the components of 'group'
> are.  With this change, we are selfishly and unilaterally breaking a
> feature that was designed to help them, but if they strongly care,
> they can complain and revert this change.

To be honest I didn't know this group feature existed and I am
surprised that anyone would want anything other than --all.

I am not sure what the solution here is but perhaps the behaviour
demonstrated below is acceptable to users of this feature:

# When no changes were fetched
$ git fetch group

# When some changes were fetched
$ git fetch group
Fetched origin
From
git://one.of.the.places.xz/
   aadb70a..74301d6  master ->
this/master
No changes from someone someoneelse otherperson

# When no changes were fetched in verbose mode
$ git fetch --verbose group
Fetching origin
Fetching someone
Fetching someoneelse
Fetching otherperson

# When some changes were fetched in verbose mode
$ git fetch --verbose group
Fetching origin
From git://one.of.the.places.xz/
   aadb70a..74301d6  master -> this/master
Fetching someone
Fetching someoneelse
Fetching otherperson

-- 
bye,
pabs

http://bonedaddy.net/pabs3/



signature.asc
Description: This is a digitally signed message part


Re: [PATCH] fetch: only show "Fetching remote" when verbose mode is enabled

2015-10-25 Thread Junio C Hamano
Paul Wise  writes:

> It definitely wouldn't be appropriate to add screen scraping and
> parsing of different version control systems to myrepos.

Huh?  If the tool claims to support VCS X and Y and Z, it needs to
know how to cause X and Y and Z to "fetch" in their own ways, and it
needs to know how X and Y and Z report what they have done.

The tool can choose to be lazy and not understand the outcome.  But
then if the tool misbehaves because it does not know and care what
happened, don't come here blaming the underlying VCS.  It is the
laziness of the tool that causes such a bug in the tool.

>> Having said all that, this time I read the change and the change
>> itself feels 40% sensible, even for those who do not care about
>> "myrepos" at all.
> All I want is for "Fetching remote" to not be printed when there are no
> changes fetched and I haven't used the --verbose option.
>
> I realise now that my patch is actually incorrect in that it also
> suppresses "Fetching remote" messages when some changes were fetched.

I actually think it makes things even worse.  I can come up with a
justification for the change in your patch as posted (but with
reservations, aka "the last paragraph"), but not with such a
behaviour.

> I will come back with a correct patch that is better explained.
>
>> I'd sell it like the attached, if I were doing this patch.  The last
>> paragraph is where the remaining 60% went ;-)
>
> Thanks, I will try to re-use that for the next patch.
>
>> Note that the current output was deliberately designed like this to
>> give an easy reminder for the user what the components of 'group'
>> are.  With this change, we are selfishly and unilaterally breaking a
>> feature that was designed to help them, but if they strongly care,
>> they can complain and revert this change.
>
> To be honest I didn't know this group feature existed and I am
> surprised that anyone would want anything other than --all.

I admit that I do not care too deeply myself, but I do care about
existing users (and possibly tools) that expect the current output,
so if you are going to argue for discarding some information from
the output, I'd want to make sure that you understand what you are
discarding and how they are supposed to be used and how they are
useful.

Unfortunately I am not getting that sense from the above "I'll show
the message only for the ones that were updated".

The thing is, the story does not change an iota between --all and a
named group.  Imagine you have three remotes X, Y and Z, and you
have a named group that contains all of them called G.  These are
the same:

$ git fetch G
$ git fetch --all

Further imagine that only X has something new.  Both of the above
would give you

$ git fetch --all ;# or G
Fetching X
From git://...
x..y master -> X/master
Fetching Y
Fetching Z

Remember that the user never said "X Y Z" from the command line; it
is because "--all" (and named group) is "once I configure, I do not
have to remember each and every one every time" mechanism.  That is
the crucial point.

The above output shows that the command tried to fetch from X and Y
and Z, it got something interesting from X, *AND* it also shows that
Y and Z were unchanged.  And this last part "Y and Z were unchanged"
is a useful information.  If you do not give the last two lines, the
user _must_ remember that --all (or G) consists of X, Y and Z, in
order to infer that.  That defeats the whole point of --all/group to
relieve the user from having to remember the set of remotes and
having to type them from the command line every time.

Contrast the following command sequence with the above:

$ git fetch X
From git://...
x..y master -> X/master
$ git fetch Y
$ git fetch Z

The responses from the command in the above sequence do not say
anything about Y and Z and that is totally sensible.  The user
explicitly said Y (and Z), and the command did not say anything for
them--it is clear enough for the user to know Y (and Z) did not have
anything new.

So fetching from multiple repositories with "--all" or group cannot
be fundamentally "consistent" with the single remote case, if you do
not want to lose information.

One tangent worth noting is this.  You can fetch from multiple
repositories that are explicitly named from the command line:

$ git fetch --multiple X Y
Fetching X
From git://...
x..y master -> X/master
Fetching Y

I do think that we do not need "Fetching Y" for this case, and I
actually think we shouldn't even say "Fetching X".

> I am not sure what the solution here is but perhaps the behaviour
> demonstrated below is acceptable to users of this feature:

I do not think so.  It does not address the fact that it loses
information to throw away "Fetching ..." message for repositories
with nothing new at all.  What gives us the right to break existing
users' expectations and force them to add 

Re: [PATCH] fetch: only show "Fetching remote" when verbose mode is enabled

2015-10-25 Thread Junio C Hamano
Paul Wise  writes:

I ignored your patch when you sent it the first time the last week,
due to the same issues I had with this round (see below) and forgot
about it.

> By default when fetching one remote nothing is printed unless there
> are changes that need fetching. This makes fetching multiple remotes
> be just as verbose as fetching a single remote.

I read this several times over a few days and I still cannot tell
what you are trying to say.  Let me disect.

> By default when fetching one remote nothing is printed unless there
> are changes that need fetching.

This is the description of the current behaviour, and a correct one
at that.  We are silent when nothing needs to be done here.

I cannot tell if you are trying to say if that is problematic, or if
you are trying to say if it is a good thing.

> This makes fetching multiple remotes
> be just as verbose as fetching a single remote.

I cannot tell what "This" refers to.

Your earlier sentence was about the behaviour of fetching from one
remote, e.g. "git fetch this".  And this second sentence makes it
sound as if that behaviour has some influence on how verbosely "git
fetch group" (where 'this' and 'that' are members of 'remotes.group')
to fetch from multiple remotes behaves.

Also (and this is the more important part of my complaint), I cannot
tell if you are saying that it is *bad* for fetching multiple to be
just as verbose, or if it is *good*, or what.

If you are fetching from two places, and only one of them has
something new, you would see

$ git fetch subs
Fetching paulus
Fetching l10n
From git://one.of.the.places.xz/
   aadb70a..74301d6  master -> this/master

so that you can see how remote.subs group expanded to.
   
> This is needed when fetching multiple repositories using the myrepos
> tool in minimal output mode, where myrepos only prints the repository
> names when git fetch prints some output.

That does not sound like a valid excuse to change the behaviour of
the command everybody, not just "myrepos tool" (whatever it is),
uses.  Your explanation does not seem to give us enough information
to answer this question intelligently: shouldn't you be fixing
myrepos instead, perhaps by making it run 'git fetch' with more
verbose mode, if it wants to see more information, or running 'git
fetch' and parsing different parts of its output?

Having said all that, this time I read the change and the change
itself feels 40% sensible, even for those who do not care about
"myrepos" at all.

I'd sell it like the attached, if I were doing this patch.  The last
paragraph is where the remaining 60% went ;-)

-- sample --
Subject: fetch: do not show remote group component without change

When fetching from a remote group, "Fetching X" is shown, followed
by the URL and ref-update summary, for each component of the remote
group.  With the default verbosity, the URL and ref-update summary
are not shown for repositories without anything new, but "Fetching
X" is always shown, which results in an output like this:

$ git fetch group
Fetching X
From git://the.url.for.X.repo/
   aadb70a..74301d6  master -> X/master
Fetching Y
Fetching Z

if the 'remotes.group' is configured to refer to three remotes, X, Y
and Z.  Given that "git fetch Y" would have produced no output with
the same verbosity, having the last two lines look inconsistent.

Tweak the verbosity so that "Fetching X" lines are given only when a
verbose output was requested with "git fetch -v".

Note that the current output was deliberately designed like this to
give an easy reminder for the user what the components of 'group'
are.  With this change, we are selfishly and unilaterally breaking a
feature that was designed to help them, but if they strongly care,
they can complain and revert this change.

-- end sample --
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html