Patchwork D6557: relnotes: added description about statemod._statecheck

login
register
mail settings
Submitter phabricator
Date June 20, 2019, 6:57 p.m.
Message ID <differential-rev-PHID-DREV-b7rda5gjo7hwudgg73k5-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/40628/
State Superseded
Headers show

Comments

phabricator - June 20, 2019, 6:57 p.m.
taapas1128 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6557

AFFECTED FILES
  relnotes/next

CHANGE DETAILS




To: taapas1128, #hg-reviewers
Cc: mercurial-devel
phabricator - June 27, 2019, 5:08 p.m.
martinvonz added inline comments.

INLINE COMMENTS

> next:63-69
> +   has been added to `state.py` and is form of class called `_statecheck`.
> +   To register a new state for an operation you need to add a `_statecheck`
> +   object with necessary information to `_unfinishedstates` list.
> +   The method of registration of a `_statecheck` object into `_unfinishedstates`
> +   is not direct but through `addunfinished()`. The data needed for various
> +   operations to be registered under `_unfinishedstates` list is stated in
> +   `_statecheck` class.

The "private" (underscore-prefixed) members should not be mentioned here. Extension developers should not be accessing them, so they don't need to know about them. What they need to know is that if they had been adding operations to `cmdutil.unfinishedstates`, `cmdutil.afterresolvestates`, or `cmdutil.STATES` before, they now need to use `state.addunfinished()`.

I now see that `state.addunfinished()` has `**kwargs`, which means they will have to look at the `_statecheck` class after all. Perhaps we should copy the arguments over from the class to the function (and remove the defaults from the class) so it's easier to find them?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6557/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6557

To: taapas1128, #hg-reviewers
Cc: martinvonz, mercurial-devel
phabricator - June 27, 2019, 7:24 p.m.
taapas1128 added inline comments.

INLINE COMMENTS

> martinvonz wrote in next:63-69
> The "private" (underscore-prefixed) members should not be mentioned here. Extension developers should not be accessing them, so they don't need to know about them. What they need to know is that if they had been adding operations to `cmdutil.unfinishedstates`, `cmdutil.afterresolvestates`, or `cmdutil.STATES` before, they now need to use `state.addunfinished()`.
> 
> I now see that `state.addunfinished()` has `**kwargs`, which means they will have to look at the `_statecheck` class after all. Perhaps we should copy the arguments over from the class to the function (and remove the defaults from the class) so it's easier to find them?

@martinvonz But that would destroy the integrity of `statecheck` class and `addunfinished` is just below `statecheck` class so one can easily look at `statecheck` if definitions for various flags are to be known. Still if you want I can do that.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6557/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6557

To: taapas1128, #hg-reviewers
Cc: martinvonz, mercurial-devel
phabricator - June 27, 2019, 10:06 p.m.
This revision is now accepted and ready to land.
martinvonz added inline comments.
martinvonz accepted this revision.

INLINE COMMENTS

> next:65-66
> +   independently a state for a new operation can be registered using
> +   `addunfinished()` in `state` module. The description of data needed
> +   to register an operation is stated under it.
> +

I'll drop the last sentence in flight since D6583 <https://phab.mercurial-scm.org/D6583> has landed.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6557/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6557

To: taapas1128, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel
phabricator - June 27, 2019, 10:08 p.m.
taapas1128 added inline comments.

INLINE COMMENTS

> martinvonz wrote in next:65-66
> I'll drop the last sentence in flight since D6583 <https://phab.mercurial-scm.org/D6583> has landed.

thanks!

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6557/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6557

To: taapas1128, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel

Patch

diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -54,3 +54,17 @@ 
 
  * `util.dirs()` and `util.finddirs()` now include an entry for the
    root directory (empty string).
+
+ * New API to manage unfinished operations: Earlier there were distinct APIs
+   which dealt with unfinished states and separate lists maintaining them.
+   eg:`cmdutil.afterresolvestates`, `cmdutil.unfinishedstates` and
+   `cmdutil.STATES`. Now these have been unified to a single
+   API which handles the various states and their utilities.This API
+   has been added to `state.py` and is form of class called `_statecheck`.
+   To register a new state for an operation you need to add a `_statecheck`
+   object with necessary information to `_unfinishedstates` list.
+   The method of registration of a `_statecheck` object into `_unfinishedstates`
+   is not direct but through `addunfinished()`. The data needed for various
+   operations to be registered under `_unfinishedstates` list is stated in
+   `_statecheck` class.
+