[PATCH 2 of 2] commands: introduce `hg display`

Gregory Szorc gregory.szorc at gmail.com
Mon Nov 7 23:03:20 EST 2016


On Mon, Nov 7, 2016 at 2:03 AM, Denis Laxalde <denis.laxalde at logilab.fr>
wrote:

> Gregory Szorc a écrit :
>
>> For the command name, we would have preferred `hg show` because it is
>> shorter and not ambigious with any other core command. However, a
>> number of people have created `hg show` as effectively an alias to
>> `hg export`. And, some were concerned that Git users used to `git show`
>> being equivalent to `hg export` would be confused by a `hg show` doing
>> something different.
>>
>
> `git show` is not equivalent to `hg export`, quoting git-show(1):
>
>        Shows one or more objects (blobs, trees, tags and commits).
>
>        For commits it shows the log message and textual diff. It also
>        presents the merge commit in a special format as produced by git
>        diff-tree --cc.
>
>        For tags, it shows the tag message and the referenced objects.
>
>        For trees, it shows the names (equivalent to git ls-tree with
>        --name-only).
>
>        For plain blobs, it shows the plain contents.
>

TIL. I've only ever used `git show` for the "show a commit representation"
use case and `git cat-file` for displaying low-level objects.


>
> So only the first case is equivalent to `hg export` (or probably more
> `hg log -vpr`). Other cases are quite close to the "view" concept
> introduced here, as far as I understand.
>
> Then if a revision can be registered as a view, `hg show` could just be
> a plain replacement to the aforementioned alias I guess.
>
> Given this and the conflict with `hg diff`, could we reconsider
> the command name?
>

That is an interesting proposal. But I'm concerned with overlapping
namespaces. What values do we allow for the non-view behavior? Hash
fragments? Names (bookmarks, branches, tags)? If we allow names, what
happens when a name in a repo conflicts with a registered view name? What
happens if a view name conflicts with a changeset prefix? Of course, to
know if there is a collision you have to load names. That means (slightly
more) overhead to run the command.

FWIW, my idea for this command was to show representations of multiple
things. I'm willing to entertain the idea of "show me single entity X"
(changeset, tag, bookmark, etc). The easy solution is an argument to a view
(`hg display tag my-tag`). Things get harder when we merge namespaces.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20161107/156c4a00/attachment.html>


More information about the Mercurial-devel mailing list