This is an archive of the discontinued Mercurial Phabricator instance.

dispatch: store the command name which is going to run in ui object
AbandonedPublic

Authored by durin42 on Sep 2 2017, 11:38 AM.

Details

Reviewers
pulkit
Group Reviewers
hg-reviewers
Summary

This patch stores the command which is going to run in the ui object in
_internal.command. This will help us in checking which command we are running
where ever we need command specific logic instead of putting the logic in every
command.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

pulkit created this revision.Sep 2 2017, 11:38 AM
yuja added a subscriber: yuja.Sep 4 2017, 10:15 AM

This reminds me the following patch series. The discussion was quite long, but
IIRC, we generally liked the functionality, but didn't like the implementation
that abuses "ui" object.

http://mercurial.markmail.org/message/4wlaxqjqs74vpyxy

This will help us in checking which command we are running
where ever we need command specific logic instead of putting the logic in every
command.

Do you have any usage example?

tests/test-basic.t
5

Perhaps this shouldn't be exposed (i.e. shouldn't be a config value.)

quark added a subscriber: quark.Sep 6 2017, 3:09 PM

This is for directaccess as directaccess originally designed (https://www.mercurial-scm.org/repo/evolve/rev/b8f880d417)

It may be cleaner to use a flag of scmutil.rev* instead. So commands themselves could decide whether to enable directaccess or not.

yuja added a comment.Sep 7 2017, 10:17 AM
In D613#10467, @quark wrote:

This is for directaccess as directaccess originally designed (https://www.mercurial-scm.org/repo/evolve/rev/b8f880d417)
It may be cleaner to use a flag of scmutil.rev* instead. So commands themselves could decide whether to enable directaccess or not.

Perhaps it could be a read-only flag (or class) set to repo object?

quark added a comment.Sep 7 2017, 1:05 PM
In D613#10670, @yuja wrote:

Perhaps it could be a read-only flag (or class) set to repo object?

Yes. It seems repo.filtername may be a reasonable choice.

pulkit planned changes to this revision.Sep 9 2017, 1:32 PM
durin42 commandeered this revision.
durin42 abandoned this revision.

My understanding is that we're moving towards a marker in the command registrar to decide what repo filter to use, which seems cleaner. Please reopen this (and commandeer it if needed) if I'm wrong. Thanks!