|
@@ 75-93 (lines=19) @@
|
| 72 |
|
|
| 73 |
|
return results |
| 74 |
|
|
| 75 |
|
def get_modified_files(self, |
| 76 |
|
branch=DEFAULT_BRANCH, |
| 77 |
|
diff_mode=STAGED_MODE, |
| 78 |
|
extensions=()): |
| 79 |
|
"""Find modified files in paths.""" |
| 80 |
|
cache_key = (branch, diff_mode, tuple(extensions)) |
| 81 |
|
if cache_key in self.cache: |
| 82 |
|
results = self.cache[cache_key] |
| 83 |
|
else: |
| 84 |
|
if diff_mode == COMMITED_MODE: |
| 85 |
|
results = self.diff_tool.commited_files(branch=branch) |
| 86 |
|
elif diff_mode == STAGED_MODE: |
| 87 |
|
results = self.diff_tool.staged_files() |
| 88 |
|
elif diff_mode == UNSTAGED_MODE: |
| 89 |
|
results = self.diff_tool.unstaged_files() |
| 90 |
|
results = filter_files(results, extensions) |
| 91 |
|
self.cache[cache_key] = results |
| 92 |
|
|
| 93 |
|
return results |
| 94 |
|
|
| 95 |
|
|
| 96 |
|
def test(): |
|
@@ 55-73 (lines=19) @@
|
| 52 |
|
|
| 53 |
|
return results |
| 54 |
|
|
| 55 |
|
def get_modified_file_lines(self, |
| 56 |
|
branch=DEFAULT_BRANCH, |
| 57 |
|
diff_mode=STAGED_MODE, |
| 58 |
|
extensions=()): |
| 59 |
|
"""Find modified lines of files in paths.""" |
| 60 |
|
cache_key = (branch, diff_mode, tuple(extensions), 'lines') |
| 61 |
|
if cache_key in self.cache: |
| 62 |
|
results = self.cache[cache_key] |
| 63 |
|
else: |
| 64 |
|
if diff_mode == COMMITED_MODE: |
| 65 |
|
results = self.diff_tool.commited_file_lines(branch=branch) |
| 66 |
|
elif diff_mode == STAGED_MODE: |
| 67 |
|
results = self.diff_tool.staged_file_lines() |
| 68 |
|
elif diff_mode == UNSTAGED_MODE: |
| 69 |
|
results = self.diff_tool.unstaged_file_lines() |
| 70 |
|
results = filter_files(results, extensions) |
| 71 |
|
self.cache[cache_key] = results |
| 72 |
|
|
| 73 |
|
return results |
| 74 |
|
|
| 75 |
|
def get_modified_files(self, |
| 76 |
|
branch=DEFAULT_BRANCH, |