예제 #1
0
 def make_commit(self, **kwargs):
     attrs = {
         'tree':
         'd80c186a03f423a81b39df39dc87fd269736ca86',
         'parents': [
             'ab64bbdcc51b170d21588e5c5d391ee5c0c96dfd',
             '4cffe90e0a41ad3f5190079d7c8f036bde29cbe6'
         ],
         'author':
         'James Westby <*****@*****.**>',
         'committer':
         'James Westby <*****@*****.**>',
         'commit_time':
         1174773719,
         'author_time':
         1174773719,
         'commit_timezone':
         0,
         'author_timezone':
         0,
         'message':
         'Merge ../b\n'
     }
     attrs.update(kwargs)
     return make_commit(**attrs)
예제 #2
0
 def setUp(self):
     super(ProtocolGraphWalkerTestCase, self).setUp()
     # Create the following commit tree:
     #   3---5
     #  /
     # 1---2---4
     commits = [
       make_commit(id=ONE, parents=[], commit_time=111),
       make_commit(id=TWO, parents=[ONE], commit_time=222),
       make_commit(id=THREE, parents=[ONE], commit_time=333),
       make_commit(id=FOUR, parents=[TWO], commit_time=444),
       make_commit(id=FIVE, parents=[THREE], commit_time=555),
       ]
     self._repo = MemoryRepo.init_bare(commits, {})
     backend = DictBackend({'/': self._repo})
     self._walker = ProtocolGraphWalker(
         TestUploadPackHandler(backend, ['/', 'host=lolcats'], TestProto()),
         self._repo.object_store, self._repo.get_peeled)
예제 #3
0
 def make_commit(self, **kwargs):
     attrs = {'tree': 'd80c186a03f423a81b39df39dc87fd269736ca86',
              'parents': ['ab64bbdcc51b170d21588e5c5d391ee5c0c96dfd',
                          '4cffe90e0a41ad3f5190079d7c8f036bde29cbe6'],
              'author': 'James Westby <*****@*****.**>',
              'committer': 'James Westby <*****@*****.**>',
              'commit_time': 1174773719,
              'author_time': 1174773719,
              'commit_timezone': 0,
              'author_timezone': 0,
              'message':  'Merge ../b\n'}
     attrs.update(kwargs)
     return make_commit(**attrs)
예제 #4
0
 def make_commit(self, **kwargs):
     attrs = {
         "tree": "d80c186a03f423a81b39df39dc87fd269736ca86",
         "parents": ["ab64bbdcc51b170d21588e5c5d391ee5c0c96dfd", "4cffe90e0a41ad3f5190079d7c8f036bde29cbe6"],
         "author": "James Westby <*****@*****.**>",
         "committer": "James Westby <*****@*****.**>",
         "commit_time": 1174773719,
         "author_time": 1174773719,
         "commit_timezone": 0,
         "author_timezone": 0,
         "message": "Merge ../b\n",
     }
     attrs.update(kwargs)
     return make_commit(**attrs)
예제 #5
0
    def test_get_tagged(self):
        refs = {
            'refs/tags/tag1': ONE,
            'refs/tags/tag2': TWO,
            'refs/heads/master': FOUR,  # not a tag, no peeled value
            }
        # repo needs to peel this object
        self._repo.object_store.add_object(make_commit(id=FOUR))
        self._repo.refs._update(refs)
        peeled = {
            'refs/tags/tag1': '1234' * 10,
            'refs/tags/tag2': '5678' * 10,
            }
        self._repo.refs._update_peeled(peeled)

        caps = list(self._handler.required_capabilities()) + ['include-tag']
        self._handler.set_client_capabilities(caps)
        self.assertEquals({'1234' * 10: ONE, '5678' * 10: TWO},
                          self._handler.get_tagged(refs, repo=self._repo))

        # non-include-tag case
        caps = self._handler.required_capabilities()
        self._handler.set_client_capabilities(caps)
        self.assertEquals({}, self._handler.get_tagged(refs, repo=self._repo))
예제 #6
0
 def test_stub_sha(self):
     sha = '5' * 40
     c = make_commit(id=sha, message='foo')
     self.assertTrue(isinstance(c, Commit))
     self.assertEqual(sha, c.id)
     self.assertNotEqual(sha, c._make_sha())
예제 #7
0
 def test_stub_sha(self):
     sha = '5' * 40
     c = make_commit(id=sha, message='foo')
     self.assertTrue(isinstance(c, Commit))
     self.assertEqual(sha, c.id)
     self.assertNotEqual(sha, c._make_sha())