diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-11-11 17:38:16 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2013-11-22 13:49:25 +0000 |
commit | 0b4e147009bffa7b720ee767633e3acf3bb68c3a (patch) | |
tree | 12448f87519c8738444618f53eb6ed49f632de92 /morphlib/gitdir_tests.py | |
parent | d83d6ad7230eb27afae4169330681967bb20dcfa (diff) | |
download | morph-0b4e147009bffa7b720ee767633e3acf3bb68c3a.tar.gz |
GitDir: Add GitIndex class
This represents the state of the index of a GitDirectory.
Methods that use the index are now used via the GitIndex class, rather
than using the default index, as previously used when the methods were
in GitDirectory.
GitIndex may be constructed with an alternative path, which can be used
to manipulate a git checkout without altering a developer's view of the
repository i.e. The working tree and default index.
This is needed for `morph build` and `morph deploy` to handle the build
without commit logic.
Diffstat (limited to 'morphlib/gitdir_tests.py')
-rw-r--r-- | morphlib/gitdir_tests.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/morphlib/gitdir_tests.py b/morphlib/gitdir_tests.py index 395ee2e5..a56df7c8 100644 --- a/morphlib/gitdir_tests.py +++ b/morphlib/gitdir_tests.py @@ -64,6 +64,12 @@ class GitDirectoryTests(unittest.TestCase): gitdir.set_remote_fetch_url('origin', url) self.assertEqual(gitdir.get_remote_fetch_url('origin'), url) + def test_gets_index(self): + os.mkdir(self.dirname) + gitdir = morphlib.gitdir.init(self.dirname) + self.assertIsInstance(gitdir.get_index(), morphlib.gitindex.GitIndex) + + class GitDirectoryContentsTests(unittest.TestCase): def setUp(self): @@ -172,8 +178,3 @@ class GitDirectoryContentsTests(unittest.TestCase): with open(os.path.join(self.tempdir, 'blob'), 'r') as f: sha1 = gd.store_blob(f) self.assertEqual('test string', gd.get_blob_contents(sha1)) - - def test_uncommitted_changes(self): - gd = morphlib.gitdir.GitDirectory(self.dirname) - self.assertEqual(sorted(gd.get_uncommitted_changes()), - [(' D', 'foo', None)]) |