-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from CrazyAwesomeCompany/feature/git
Add git changeset target
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# AutoPhing Git | ||
|
||
Perform Git commands | ||
|
||
## Targets ## | ||
|
||
### git-changeset-files ### | ||
Get the files from a git diff. The results are stored in the `files.changeset` and `files.changeset.php` properties. | ||
|
||
An example usage of this command is to get the changed PHP files for a Pull Request and run quality checks only | ||
against the changeset. | ||
|
||
## Configuration ## | ||
|
||
+ `git.file` - The Git binary file | ||
+ `git.revision` - The Git revision to compare | ||
+ `git.base.revision` - The Git revision use as base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
git.file=git | ||
|
||
git.base.revision=develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project name="git" default="git-changeset-files" basedir="."> | ||
<property file="${phing.dir.git}/git.properties" /> | ||
|
||
<target name="git-changeset-files"> | ||
<fail unless="git.revision" message="No valid git revision given"/> | ||
|
||
<exec executable="${git.file}" outputProperty="changesetfiles"> | ||
<arg value="diff"/> | ||
<arg value="--name-only"/> | ||
<arg value="${git.revision}"/> | ||
<arg value="${git.base.revision}"/> | ||
</exec> | ||
|
||
<property name="files.changeset" value="${changesetfiles}"> | ||
<filterchain> | ||
<replaceregexp> | ||
<regexp pattern="\n" replace=" " ignoreCase="true"/> | ||
</replaceregexp> | ||
</filterchain> | ||
</property> | ||
|
||
<property name="files.changeset.php" value="${changesetfiles}"> | ||
<filterchain> | ||
<linecontainsregexp> | ||
<regexp pattern=".php$"/> | ||
</linecontainsregexp> | ||
<replaceregexp> | ||
<regexp pattern="\n" replace=" " ignoreCase="true"/> | ||
</replaceregexp> | ||
</filterchain> | ||
</property> | ||
</target> | ||
</project> |