This is an archive of the discontinued Mercurial Phabricator instance.

status: add default of --terse=u to tweakdefaults (BC)
ClosedPublic

Authored by durin42 on May 20 2018, 1:57 AM.

Details

Summary

This is in line with both Git and Subversion, and strikes me as a more
humane behavior.

Test output changes are expected once you read test-status.t, and I
feel like we've still got adequate coverage on things.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durin42 created this revision.May 20 2018, 1:57 AM
pulkit accepted this revision.May 20 2018, 4:06 PM
This revision was automatically updated to reflect the committed changes.
martinvonz added inline comments.
tests/test-status.t
112

We had a more extreme case of "entire working directory is untracked" in our internal tests. It was something like this

$ dir=foo/bar/baz/qux
$ mkdir -p $dir
$ cd $dir
$ echo stuff > file
$ hg st
? file

After this patch (we have tweakdefaults turned on internally), the output is instead this:

$ hg st
../../../../

It's correct, but it's much less readable than the old output. Git does the same thing (it also shows ../../../../), btw.

Maybe we shouldn't terse-ify the files in the current working directory? I understand how treating the working directory differently is not very appealing. Note that with both hg and git, if you add a file in the root directory of an empty repo, then the filename will still be printed (it doesn't just say .).

Consider an empty repo with these paths:

dir/subdir/subdir/a
dir/subdir/b
c

If you're in the root directory, I think we all expect to get this:

? dir/
? c

How about when you're in dir/subdir? We currently get this:

? ../
? ../../c

Perhaps it's better to display this?

? subdir/
? b
? ../../c

That seems consistent with not abbreviating the root directory's entries to just '.'.

It still gets weird when you're in dir/subdir/subdir/. Should we show this?

? a
? ../b
? ../../../c

Thoughts?

durin42 added inline comments.Jun 25 2018, 9:14 AM
tests/test-status.t
112

Yeah, that sounds reasonable. I think in general the tersed behavior is better, but this is an annoying edge case. Could you at least send a patch that introduces a "we'd rather we saw this output?" kind of test?

pulkit added inline comments.Jun 25 2018, 10:19 AM
tests/test-status.t
112

The proposed change sounds good to me. I haven't looked yet how this can be plugged into current implementation but I feel this won't be hard.