D451: revset: remove order information from tree

quark (Jun Wu) phabricator at mercurial-scm.org
Tue Aug 22 12:12:45 EDT 2017


quark added a comment.


  In https://phab.mercurial-scm.org/D451#7456, @yuja wrote:
  
  > Perhaps `_flipand(1:0, _flipand(1:0, 0::1))` would return `[1, 0]` if the input set
  >  were reversed. IMHO, that's correct under the original design.
  
  
  I see. The old code allows "weak define" that "define" becomes "follow". There is no way to tell if a revset is "strong define" or "weak define" from the help text. So it could be confusing sometimes.
  
    list(revset.match(None, '_flipand(1:0, _flipand(1:0, 0::1))', order=ORDER)(repo, revset.baseset(INITSET)))
  
  | OLD CODE      | ORDER=define | ORDER=follow |
  | INITSET=[0,1] | [0,1]        | [0,1]        |
  | INITSET=[1,0] | [1,0]        | [1,0]        |
  |
  
  
  
  | NEW CODE      | ORDER=define | ORDER=follow |
  | INITSET=[0,1] | [0,1]        | [0,1]        |
  | INITSET=[1,0] | [0,1]        | [1,0]        |
  |
  
  Since `set.sort()` is lazy and optimized to a no-op. I think it's cleaner to migrate everything to "strong define" (for core revsets). Third party code needs change to follow that. If they do not need `subrepo` (ex. remotenames case), the new API could be easier to use.
  
  ----
  
  Unrelated to this series, I also think some revsets might want a non-ascending "define" order. For example, it seems more natural if `p1(A+B)` could be equivalent to `p1(A)+p1(B)`. Same applies to `p2`, `parents`, `children` and maybe `roots`, `heads`.

REPOSITORY
  rHG Mercurial

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

To: quark, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list