]> khamidou — GitHub mirrors - arcanist.git/commit
Add a DSL for selecting base commits
authorepriestley <git@epriestley.com>
Fri, 15 Jun 2012 21:01:28 +0000 (14:01 -0700)
committerepriestley <git@epriestley.com>
Fri, 15 Jun 2012 21:01:28 +0000 (14:01 -0700)
commitf2220e74fc06f3dfb3ce4624f5c26265c8291f7c
tree70566cc1f260aab3008ac5ad1d92e0f116271e73
parent57499106ec5c1d7f2cde6fdc106bffcf62cd1bc6
Add a DSL for selecting base commits

Summary:
New optional mode. If you set 'base' in local, project or global config or pass '--base' to 'arc diff' or 'arc which', it switches to DSL mode.

In DSL mode, lists of rules from args, local, project and global config are resolved, in that order. Rules can manipulate the rule machine or resolve into actual commits. Provides support for some 'arc' rules (mostly machine manipulation) and 'git' rules (symbolic ref and merge-base).

Test Plan:
Ran unit tests. Also:

```$ arc which --show-base --base 'arc:prompt'

    Against which commit? HEAD
HEAD
$ arc which --show-base --base 'git:HEAD'
HEAD
$ arc which --show-base --base 'git:fake'
Usage Exception: None of the rules in your 'base' configuration matched a valid commit. Adjust rules or specify which commit you want to use explicitly.
$ arc which --show-base --base 'git:origin/master'
origin/master
$ arc which --show-base --base 'git:upstream'
Usage Exception: None of the rules in your 'base' configuration matched a valid commit. Adjust rules or specify which commit you want to use explicitly.
$ arc which --show-base --base 'literal:derp'
derp
$ arc which --show-base --base 'arc:halt'
Usage Exception: None of the rules in your 'base' configuration matched a valid commit. Adjust rules or specify which commit you want to use explicitly.
$ arc set-config --local base git:origin/master
Set key 'base' = 'git:origin/master' in local config.
$ arc which --show-base
origin/master
$ arc which --show-base --base 'git:HEAD^'
HEAD^
$ arc which --show-base --base 'arc:yield, git:HEAD^'
origin/master
$ arc which --show-base --base 'arc:global, git:HEAD^'
HEAD^
$ arc which --show-base --base 'arc:global, git:merge-base(origin/master)'
3f4f8992fba8d1f142974da36a82bae900e247c0```

Reviewers: dschleimer, vrana

Reviewed By: dschleimer

CC: aran
Maniphest Tasks: T1233

Differential Revision: https://secure.phabricator.com/D2748
src/__phutil_library_map__.php
src/parser/ArcanistBaseCommitParser.php [new file with mode: 0644]
src/parser/__tests__/ArcanistBaseCommitParserTestCase.php [new file with mode: 0644]
src/repository/api/ArcanistGitAPI.php
src/repository/api/ArcanistRepositoryAPI.php
src/workflow/ArcanistDiffWorkflow.php
src/workflow/ArcanistWhichWorkflow.php