[PATCH 2 of 2] revset: new predicates to find key merge revisions

Simon Farnsworth simonfar at fb.com
Mon Mar 7 10:32:14 EST 2016


On 07/03/2016, 14:59, "Yuya Nishihara" <youjah at gmail.com on behalf of yuya at tcha.org> wrote:


>On Fri, 4 Mar 2016 12:12:05 -0800, Simon Farnsworth wrote:
>> # HG changeset patch
>> # User Simon Farnsworth <simonfar at fb.com>
>> # Date 1457121724 0
>> #      Fri Mar 04 20:02:04 2016 +0000
>> # Node ID 18378f0a3eeac6331fc24c1525c7e4dccba27251
>> # Parent  37fe1f9d08245f7540cb6137c312ae30dbcde688
>> revset: new predicates to find key merge revisions
>
>> + at predicate('conflict(type,[pattern])')
>> +def conflict(repo, subset, x):
>> +    """The type revision for any merge conflict matching pattern.
>> +    See :hg:`help patterns` for information about file patterns.
>> +
>> +    type should be one of "ancestor", "other" or "local", for the three-way
>> +    merge ancestor, the "other" tree, or the "local" tree.
>> +
>> +    The pattern without explicit kind like ``glob:`` is expected to be
>> +    relative to the current directory and match against a file exactly
>> +    for efficiency. If pattern is omitted, all conflicts are included.
>> +    """
>> +    # i18n: "conflict" is a keyword
>> +    l = getargs(x, 1, 2, _('conflict takes one or two arguments'))
>> +    t = getstring(l[0], _("conflict requires a type"))
>> +    if t not in ["ancestor", "other", "local"]:
>> +        msg = _('conflict file types are "ancestor", "other" or "local"')
>
>It appears we use the term "base", "other", and "local" in "help merge-tools".

I went back and forward between base and ancestor myself, then chose ancestor on a coin flip. I'll change in V2.

>
>> +    s = set()
>> +    for f in files:
>> +        if t == "ancestor":
>> +            s.add(ms.ancestorchangectx(f).rev())
>> +        elif t == "local":
>> +            s.add(ms.localfilectx(f).introrev())
>> +        elif t == "other":
>> +            s.add(ms.otherfilectx(f).introrev())
>
>Nit: "other" and "ancestor" raised exception with V1 mergestate.

Will fix and resubmit. Is there an easy way to get a V1 mergestate for a test case?

Simon


More information about the Mercurial-devel mailing list