Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add paths arguments from Git rev-list

  • Loading branch information...
commit f943acc67588049c9a5502bff5e8ca80abf6e4ad 1 parent 28f8b3c
Kirill chEbba Chebunin chEbba authored

Showing 1 changed file with 34 additions and 4 deletions. Show diff stats Hide diff stats

  1. +34 4 VersionControl/Git/Util/RevListFetcher.php
38 VersionControl/Git/Util/RevListFetcher.php
@@ -30,6 +30,7 @@
30 30 * @category VersionControl
31 31 * @package VersionControl_Git
32 32 * @author Kousuke Ebihara <ebihara@php.net>
  33 + * @author Kirill chEbba Chebunin <iam@chebba.org>
33 34 * @copyright 2010 Kousuke Ebihara
34 35 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
35 36 */
@@ -50,6 +51,13 @@ class VersionControl_Git_Util_RevListFetcher extends VersionControl_Git_Util_Com
50 51 protected $target = self::DEFAULT_TARGET;
51 52
52 53 /**
  54 + * Commits will be filtered by modifications for this paths only
  55 + *
  56 + * @var type
  57 + */
  58 + protected $paths = array();
  59 +
  60 + /**
53 61 * Set the target
54 62 *
55 63 * @param string $target The target for the commits that you want to get
@@ -64,6 +72,20 @@ public function target($target)
64 72 }
65 73
66 74 /**
  75 + * Set paths
  76 + *
  77 + * @param array $paths The array of paths which commits you want
  78 + *
  79 + * @return VersionControl_Git_Util_RevListFetcher The "$this" object
  80 + */
  81 + public function paths(array $paths)
  82 + {
  83 + $this->paths = $paths;
  84 +
  85 + return $this;
  86 + }
  87 +
  88 + /**
67 89 * Reset properties
68 90 *
69 91 * @return VersionControl_Git_Util_RevListFetcher The "$this" object
@@ -74,6 +96,8 @@ public function reset()
74 96
75 97 $this->target = self::DEFAULT_TARGET;
76 98
  99 + $this->paths = array();
  100 +
77 101 return $this;
78 102 }
79 103
@@ -84,10 +108,16 @@ public function reset()
84 108 */
85 109 public function fetch()
86 110 {
87   - $string = $this->setSubCommand('rev-list')
88   - ->setOption('pretty', 'raw')
89   - ->setArguments(array($this->target))
90   - ->execute();
  111 + $this->setSubCommand('rev-list')
  112 + ->setOption('pretty', 'raw')
  113 + ->setArguments(array($this->target));
  114 +
  115 + // Add paths to arguments
  116 + foreach ($this->paths as $path) {
  117 + $this->addArgument($path);
  118 + }
  119 +
  120 + $string = $this->execute();
91 121
92 122 $lines = explode("\n", $string);
93 123

0 comments on commit f943acc

Please sign in to comment.
Something went wrong with that request. Please try again.