The cmdtype argument defaults to registrar.cmdtype.UNRECOVERABLE_WRITE. This
argument will help us in telling whether a command is read only or write and
what kind of write. This information can be used in various ways.
Currently, we will use to information to decide what level of accessibility a
command can has on hidden commits based on it's type.
Details
- Reviewers
durham - Group Reviewers
hg-reviewers
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Event Timeline
mercurial/registrar.py | ||
---|---|---|
150 | I think an enum would be better here (UNRECOVERABLE_WRITE, RECOVERABLE_WRITE, READ_ONLY). Especially because I think people generally copy and paste the registrar decorators from other functions, and if we're just specifying numbers they are more likely to just reuse whatever value they copied. |
mercurial/registrar.py | ||
---|---|---|
150 | nod. registrar.internalmerge() has a good example of pseudo enum. |
mercurial/registrar.py | ||
---|---|---|
151 | I was thinking an actual enum, to avoid potential typo's. For instance: class hiddenlevel(object): UNRECOVERABLE_WRITE="unrecoverable" RECOVERABLE_WRITE="recoverable" READ_ONLY="readonly" |
Has there been discussion around extensions using this? Should there be discussion now? Specifically, I'm trying to figure out how external things will use this feature. Should it be a try/except? Or should modules set the access level before looking for a (potentially) hidden commit?
I think @indygreg has some ideas around making "read-only" vs "writable" repo objects. I personally prefer whatever repo approach (having a field in repo, or use different types of repo objects).
I think an enum would be better here (UNRECOVERABLE_WRITE, RECOVERABLE_WRITE, READ_ONLY). Especially because I think people generally copy and paste the registrar decorators from other functions, and if we're just specifying numbers they are more likely to just reuse whatever value they copied.