Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved all repo stats code from git.py to the base
When all of the new code to provide more interesting stats was added to git.py, it was not very re-usable. A few pull requests could use it though. In particular, #105 adds more info to the svn segment and #210 does the same for mercurial. I would rather not create inconsistencies among these segments or have them duplicate code. Moving it into the base file creates a place where each segment can access it and have a consistent behavior.
- Loading branch information
Showing
4 changed files
with
96 additions
and
38 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
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,22 @@ | ||
import unittest | ||
import powerline_shell_base as p | ||
|
||
|
||
class RepoStatsTest(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.repo_stats = p.RepoStats() | ||
self.repo_stats.not_staged = 1 | ||
self.repo_stats.conflicted = 4 | ||
|
||
def test_simple(self): | ||
self.assertEqual(self.repo_stats.untracked, 0) | ||
|
||
def test_n_or_empty__empty(self): | ||
self.assertEqual(self.repo_stats.n_or_empty("not_staged"), u"") | ||
|
||
def test_n_or_empty__n(self): | ||
self.assertEqual(self.repo_stats.n_or_empty("conflicted"), u"4") | ||
|
||
def test_index(self): | ||
self.assertEqual(self.repo_stats["not_staged"], 1) |
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