Пример #1
0
    def test_simple(self):
        repo.make_commit('1')
        safe_git.checkout('-b', 'develop')

        safe_git.push('--set-upstream', 'origin', 'develop')
        safe_git.amp('Hello', 'there', 'mates')
        actual = safe_git.log('--oneline')
        expected = ['1974b10 Hello there mates', 'c0d1dbb 0']
        self.assertEqual(actual, expected)

        actual = safe_git.log('--oneline', 'origin/develop')
        self.assertEqual(actual, expected)
Пример #2
0
    def test_new(self):
        git.new('one')
        repo.make_commit('1')
        git.push()
        actual = safe_git.log('--oneline', 'origin/one')
        expected = ['a03c0f8 1', 'c0d1dbb 0']
        self.assertEqual(actual, expected)

        git.new('two')
        repo.make_commit('2')
        git.push()
        actual = safe_git.log('--oneline', 'origin/two')
        expected = ['aff4d90 2', 'c0d1dbb 0']
        self.assertEqual(actual, expected)
Пример #3
0
 def test_test_files(self):
     self._test_files()
     actual = safe_git.log('--oneline')
     expected = [
         '2a2c087 3',
         '4fbc0b7 6',
         'adf954d 4',
         'a03c0f8 1',
         'c0d1dbb 0',
     ]
     self.assertEqual(actual, expected)
Пример #4
0
    def _first(self):
        repo.make_commit('1')
        repo.make_commit('2')
        repo.make_commit('3')
        repo.make_commit('4')
        repo.make_commit('5')
        repo.make_commit('6')
        repo.make_commit('7')

        actual = safe_git.log('--oneline')
        expected = [
            'e487041 7',
            'e1e931a 6',
            '8a4a4e2 5',
            'a7c7e8f 4',
            '9ab30c5 3',
            '043df1f 2',
            'a03c0f8 1',
            'c0d1dbb 0',
        ]
        self.assertEqual(actual, expected)
Пример #5
0
    def _get_files(self, *args):
        repo.make_commit('1')
        repo.make_commit('2')
        repo.make_commit('3')
        repo.make_commit('4')
        repo.make_commit('5')
        repo.make_commit('6')
        repo.make_commit('7')

        actual = safe_git.log('--oneline')
        expected = [
            'e487041 7',
            'e1e931a 6',
            '8a4a4e2 5',
            'a7c7e8f 4',
            '9ab30c5 3',
            '043df1f 2',
            'a03c0f8 1',
            'c0d1dbb 0',
        ]
        self.assertEqual(actual, expected)
        git.shuffle('_c_ab_', *args)
        files = [i for i in os.listdir() if not i.startswith('.')]
        self.assertEqual(sorted(files), ['0', '1', '3', '4', '6'])
Пример #6
0
 def test_squash(self):
     self._test_files('-s="0 1 3 4 6"')
     actual = safe_git.log('--oneline')
     expected = ['a60e28d "0 1 3 4 6"', 'a03c0f8 1', 'c0d1dbb 0']
     self.assertEqual(actual, expected)
Пример #7
0
 def test_no_arguments(self):
     self._first()
     git.shuffle()
     actual = safe_git.log('--oneline')[:4]
     expected = ['85af3d4 6', 'd9b4446 7', '8a4a4e2 5', 'a7c7e8f 4']
     self.assertEqual(actual, expected)
Пример #8
0
 def TODO_test_example(self):
     # Why does this fail?  Debugging gives nonsensical results!
     git.shuffle('__cba_')
     actual = safe_git.log('--oneline')[:4]
     expected = []
     self.assertEqual(actual, expected)
Пример #9
0
 def test_simple(self):
     self._get_files()
     expected = ['a023846 5', '2511fd4 3', 'c0d1dbb 0']
     self.assertEqual(safe_git.log('--oneline'), expected)
Пример #10
0
 def test_squash(self):
     self._get_files('-s="0 3 5"')
     expected = ['ad627aa "0 3 5"', 'c0d1dbb 0']
     self.assertEqual(safe_git.log('--oneline'), expected)