Differences between revisions 4 and 5
Revision 4 as of 2017-03-03 12:33:02
Size: 3609
Comment:
Revision 5 as of 2017-03-03 12:54:06
Size: 3589
Comment:
Deletions are marked like this. Additions are marked like this.
Line 104: Line 104:
   * only match files that exists in the current matching context    * files are matches in the ctx of the head

Note:

This page is primarily intended for developers of Mercurial.

Revision Context

Status: Project

Main proponents: Pierre-YvesDavid, YuyaNishihara

/!\ This is a speculative project and does not represent any firm decisions on future behavior.

Fileset and revset might depend of revision context, there is current

1. Goal

Various fileset (eg: added(…), modified(…), …) and revset (follow(…), followllines(…)) depends of the "revision context". Currently they mostly use the working copy parent for this and sometime a revision specified to the command through another argument. We aim to provide a way to specify a wider range of revision context for them.

An example usecase would be to be able to do hg archive --rev X 'set: rev(Y::X, modified() + added() to archive all the file modified between Y and X at the state they are at X.

2. Detailed Definition

There is multiple kind of eligible fileset.

2.1. changes-filesets

The one matching changes between multiple rev:

  • added(),

  • clean(),

  • copied(),

  • deleted(),

  • etc…

There is multiples way to specify revision here:

  • on 1 rev: same as hg status --change X. the difference between this changeset and its parent,

  • between 2 revs: same as hg status --rev X --rev Y. the difference between the changeset, Should generalize to multiple rev?

2.2. property-filesets

The one matching a property specific to a content:

  • binary(),

  • exec(),

  • grep(regex),

  • size(…),

  • etc…

There is multiple way to patch this:

  • files matching the property in any of this revision,

  • files matching the property in all of this revision,

2.3. revsets

In addition, some revset are also "content dependent" and need revision reference:

  • followlines(…),

  • follow(…, [startrev]), (the startrev fits some of what we are discussion here)

It is unclear if we need to use the same approach for fileset and revset but the problem seems similar enough to be mentioned at the same time.

3. Brain storming

Brain storming on possibilities

  • revs(REVS, FILESET, [mode=any|all]) property matched in any (default to any),

  • revs(REVS, FILESET, [mode=any|all]) if REVS match a single revs: works as status --change. if many works as hg status --rev,

    • what if computed complex REVS happen to result in a single rev? --change and --rev are very different, which should be selected explicitly. -- yuya

  • betweenrevs(ROOTS, HEADS, FILESET) match changes between ROOTS and HEADS,

  • anyrevs(REVS, FILESET) property matched in any REVS,

  • allrevs(REVS, FILESET) property matched in all REVS,

4. Proposal

(name are open for bikeshedding)

  • revs(REVS, FILESET, [match=any|all]):

    • do property matching on all revision in REVS.

    • matches file that exists in REVS even if they do not exist in mainly matched context,

    • match argument control if a property needs to be True for any or all revision in REVS (default to any)

    • fileset that track "changes" are treated like a property (eg: revs(42+24, 'added()' matches files added by 42 or 24.

  • status(REVS, FILESET):
    • do changes tracking between roots(REVS) and heads(REV).

    • error out if a property fileset is used ?

    • files are matches in the ctx of the head

5. See Also


CategoryDeveloper CategoryNewFeatures

RevContextPlan (last edited 2017-03-03 13:06:32 by Pierre-YvesDavid)