コード例 #1
0
 def testEmptyRepo(self):
   r = TestRepo('foo', TestClock())
   self.assertEqual(list(r.refglob()), [])
   self.assertIsNotNone(r.repo_path)
   self.assertEquals(r.short_name, 'foo')
   self.assertEqual(r.snap(), {})
   ref = r['refs/heads/master']
   ref.make_full_tree_commit('Initial Commit')
   self.assertEqual(list(r.refglob()), [ref])
コード例 #2
0
 def testEmptyRepo(self):
   r = TestRepo('foo', TestClock())
   self.assertEqual(list(r.refglob()), [])
   self.assertIsNotNone(r.repo_path)
   self.assertEquals(r.short_name, 'foo')
   self.assertEqual(r.snap(), {})
   ref = r['refs/heads/master']
   ref.make_full_tree_commit('Initial Commit')
   self.assertEqual(list(r.refglob()), [ref])
コード例 #3
0
 def testRepoMirrorOf(self):
   r = TestRepo('local', TestClock())
   m = TestRepo('mirror', TestClock(), mirror_of=r.repo_path)
   self.capture_stdio(m.reify)
   ref = r['refs/heads/master']
   ref.make_full_tree_commit('Initial Commit')
   self.assertEqual(list(r.refglob()), [ref])
   self.assertEqual(list(m.refglob()), [])
   self.capture_stdio(m.run, 'fetch')
   self.assertEqual(list(m.refglob()), [m['refs/heads/master']])
   self.assertEqual(r.snap(), m.snap())
コード例 #4
0
 def testRepoMirrorOf(self):
   r = TestRepo('local', TestClock())
   m = TestRepo('mirror', TestClock(), mirror_of=r.repo_path)
   self.capture_stdio(m.reify)
   ref = r['refs/heads/master']
   ref.make_full_tree_commit('Initial Commit')
   self.assertEqual(list(r.refglob()), [ref])
   self.assertEqual(list(m.refglob()), [])
   self.capture_stdio(m.run, 'fetch')
   self.assertEqual(list(m.refglob()), [m['refs/heads/master']])
   self.assertEqual(r.snap(), m.snap())
コード例 #5
0
 def testInitialCommit(self):
   r = TestRepo('foo', TestClock())
   ref = r['refs/heads/master']
   ref.make_full_tree_commit('Initial Commit', {
     'cool_file': 'whazzap',
     'subdir': {
       'crazy times': 'this is awesome'
     }
   })
   self.assertEqual(list(r.refglob()), [ref])
   self.assertEqual(r.snap(include_committer=True), {
     'refs/heads/master': OD([
       ('b7c705ceddb223c09416b78e87dc8c41e7035a36', [
         # 'line too long' pylint: disable=C0301
         'committer Test User <*****@*****.**> 2014-06-13 00:09:06 +0800',
         '',
         'Initial Commit'
       ])
     ])
   })
   self.assertEqual('whazzap', r.run('cat-file', 'blob', 'master:cool_file'))
   self.assertEqual('this is awesome',
                    r.run('cat-file', 'blob', 'master:subdir/crazy times'))
コード例 #6
0
 def testInitialCommit(self):
   r = TestRepo('foo', TestClock())
   ref = r['refs/heads/master']
   ref.make_full_tree_commit('Initial Commit', {
     'cool_file': 'whazzap',
     'subdir': {
       'crazy times': 'this is awesome'
     }
   })
   self.assertEqual(list(r.refglob()), [ref])
   self.assertEqual(r.snap(include_committer=True), {
     'refs/heads/master': OD([
       ('b7c705ceddb223c09416b78e87dc8c41e7035a36', [
         # 'line too long' pylint: disable=C0301
         'committer Test User <*****@*****.**> 2014-06-13 00:09:06 +0800',
         '',
         'Initial Commit'
       ])
     ])
   })
   self.assertEqual('whazzap', r.run('cat-file', 'blob', 'master:cool_file'))
   self.assertEqual('this is awesome',
                    r.run('cat-file', 'blob', 'master:subdir/crazy times'))