Example #1
0
 def testCommit(self):
     s = GitScm({
         'scm': "git",
         'url': self.repodir,
         'commit': '0123456789012345678901234567890123456789',
         'recipe': "foo.yaml#0"
     })
     self.assertEqual(s.status(self.repodir_local, '', 0), 'unclean')
Example #2
0
    def testUnpushed(self):
        f = open(os.path.join(self.repodir_local, "test.txt"), "w")
        f.write("test modified")
        f.close()
        self.callGit('git commit -a -m "modified"', cwd=self.repodir_local)

        s = GitScm({ 'scm' : "git", 'url' : self.repodir, 'recipe' : "foo.yaml#0" })
        self.assertEqual(s.status(self.repodir_local, '', 0), 'unclean')
Example #3
0
 def testBranch(self):
     s = GitScm({
         'scm': "git",
         'url': self.repodir,
         'branch': 'anybranch',
         'recipe': "foo.yaml#0"
     })
     self.assertEqual(s.status(self.repodir_local, '', 0), 'unclean')
Example #4
0
 def testTag(self):
     s = GitScm({
         'scm': "git",
         'url': self.repodir,
         'tag': 'v0.1',
         'recipe': "foo.yaml#0"
     })
     self.assertEqual(s.status(self.repodir_local, '', 0), 'unclean')
Example #5
0
 def createGitScm(self, spec={}):
     s = {
         'scm': "git",
         'url': self.repodir,
         'recipe': "foo.yaml#0",
     }
     s.update(spec)
     return GitScm(s)
Example #6
0
 def createGitScm(self, spec={}):
     s = {
         'scm': "git",
         'url': "file://" + os.path.abspath(self.repodir),
         'recipe': "foo.yaml#0",
         '__source': "Recipe foo",
     }
     s.update(spec)
     return GitScm(s)
Example #7
0
def createGitScm(spec={}):
    s = {
        'scm': "git",
        'url': "MyURL",
        'recipe': "foo.yaml#0",
        '__source': "Recipe foo"
    }
    s.update(spec)
    return GitScm(s)
Example #8
0
 def processHashEngine(self, scm, expected):
     with tempfile.TemporaryDirectory() as workspace:
         self.invokeGit(workspace, scm)
         spec = scm.getLiveBuildIdSpec(workspace)
         if spec.startswith('='):
             self.assertEqual(bytes.fromhex(spec[1:]), expected)
         else:
             self.assertTrue(spec.startswith('g'))
             self.assertEqual(
                 bytes.fromhex(GitScm.processLiveBuildIdSpec(spec[1:])),
                 expected)
Example #9
0
 def processHashEngine(self, scm, expected):
     with tempfile.TemporaryDirectory() as workspace:
         subprocess.check_call(['/bin/bash', '-c', scm.asScript()],
             universal_newlines=True, stderr=subprocess.STDOUT, cwd=workspace)
         spec = scm.getLiveBuildIdSpec(workspace)
         if spec.startswith('='):
             self.assertEqual(bytes.fromhex(spec[1:]), expected)
         else:
             self.assertTrue(spec.startswith('g'))
             self.assertEqual(bytes.fromhex(GitScm.processLiveBuildIdSpec(spec[1:])),
                 expected)
Example #10
0
 def processHashEngine(self, scm, expected):
     with tempfile.TemporaryDirectory() as workspace:
         subprocess.check_call(['/bin/bash', '-c', scm.asScript()],
             universal_newlines=True, stderr=subprocess.STDOUT, cwd=workspace)
         spec = scm.getLiveBuildIdSpec(workspace)
         if spec.startswith('='):
             self.assertEqual(bytes.fromhex(spec[1:]), expected)
         else:
             self.assertTrue(spec.startswith('g'))
             self.assertEqual(bytes.fromhex(GitScm.processLiveBuildIdSpec(spec[1:])),
                 expected)
Example #11
0
 def testUrl(self):
     s = GitScm({ 'scm' : "git", 'url' : 'anywhere', 'recipe' : "foo.yaml#0" })
     self.assertEqual(s.status(self.repodir_local, '', 0), 'unclean')
Example #12
0
 def testModified(self):
     f = open(os.path.join(self.repodir_local, "test.txt"), "w")
     f.write("test modified")
     f.close()
     s = GitScm({ 'scm' : "git", 'url' : self.repodir, 'recipe' : "foo.yaml#0" })
     self.assertEqual(s.status(self.repodir_local, '')[0], 'dirty')
Example #13
0
 def testEmpty(self):
     removePath(self.repodir_local)
     s = GitScm({ 'scm' : "git", 'url' : self.repodir, 'recipe' : "foo.yaml#0" })
     self.assertEqual(s.status(self.repodir_local, '')[0], 'empty')
Example #14
0
 def testClean(self):
     s = GitScm({ 'scm' : "git", 'url' : self.repodir, 'recipe' : "foo.yaml#0" })
     self.assertEqual(s.status(self.repodir_local, '')[0], 'clean')