示例#1
0
 def testSwitchRemoteBranch(self):
     scm = Git(Process(quiet=True))
     self.branch(self.packagedir, '2.x')
     self.clone()
     self.assertEqual(scm.get_branch_from_sandbox(self.clonedir), 'master')
     self.assertEqual(scm.switch_branch(self.clonedir, '2.x'), 0)
     self.assertEqual(scm.get_branch_from_sandbox(self.clonedir), '2.x')
示例#2
0
 def testSwitchSameBranch(self):
     scm = Git()
     self.assertEqual(scm.get_branch_from_sandbox(self.packagedir),
                      'parking')
     self.assertEqual(scm.switch_branch(self.packagedir, 'parking'), 0)
     self.assertEqual(scm.get_branch_from_sandbox(self.packagedir),
                      'parking')
示例#3
0
 def testCreateTag(self):
     scm = Git()
     self.assertEqual(scm.tag_exists(self.packagedir, '2.6'), False)
     self.assertEqual(
         scm.create_tag(self.packagedir, '2.6', 'testpackage', '2.6',
                        False), 0)
     self.assertEqual(scm.tag_exists(self.packagedir, '2.6'), True)
示例#4
0
 def testSwitchRemoteBranch(self):
     scm = Git(Process(quiet=True))
     self.branch(self.packagedir, "2.x")
     self.clone()
     self.assertEqual(scm.get_branch_from_sandbox(self.clonedir), "master")
     self.assertEqual(scm.switch_branch(self.clonedir, "2.x"), 0)
     self.assertEqual(scm.get_branch_from_sandbox(self.clonedir), "2.x")
示例#5
0
 def testCommitAndPushDirtyRemoteSandbox(self):
     scm = Git(Process(quiet=True))
     self.clone()
     self.modify(self.clonedir)
     self.assertEqual(scm.commit_sandbox(self.clonedir, "testpackage", "2.6", True), 0)
     self.verify(self.clonedir)
     self.update(self.packagedir)
     self.verify(self.packagedir)
示例#6
0
 def testCreateExistingTag(self):
     scm = Git(Process(quiet=True))
     self.assertEqual(
         scm.create_tag(self.packagedir, '2.6', 'testpackage', '2.6',
                        False), 0)
     self.assertEqual(scm.tag_exists(self.packagedir, '2.6'), True)
     self.assertRaises(SystemExit, scm.create_tag, self.packagedir, '2.6',
                       'testpackage', '2.6', False)
示例#7
0
 def testCreateAndPushRemoteTag(self):
     scm = Git(Process(quiet=True))
     self.clone()
     self.assertEqual(
         scm.create_tag(self.clonedir, '2.6', 'testpackage', '2.6', True),
         0)
     self.assertEqual(scm.tag_exists(self.clonedir, '2.6'), True)
     self.assertEqual(scm.tag_exists(self.packagedir, '2.6'), True)
示例#8
0
 def testCheckinAndPushDirtyRemoteSandbox(self):
     scm = Git(Process(quiet=True))
     self.clone()
     self.modify(self.clonedir)
     self.assertEqual(scm.checkin_sandbox(self.clonedir, 'testpackage', '2.6', True), 0)
     self.verify(self.clonedir)
     self.update(self.packagedir)
     self.verify(self.packagedir)
示例#9
0
 def testCommitAndPushDirtyRemoteSandbox(self):
     scm = Git(Process(quiet=True))
     self.clone()
     self.modify(self.clonedir)
     self.assertEqual(
         scm.commit_sandbox(self.clonedir, 'testpackage', '2.6', True), 0)
     self.verify(self.clonedir)
     self.update(self.packagedir)
     self.verify(self.packagedir)
示例#10
0
 def testCheckRaises(self):
     scm = Git()
     self.assertRaises(SystemExit, scm.check_valid_sandbox, 'foo')
     self.assertRaises(SystemExit, scm.check_valid_sandbox,
                       join(self.packagedir, 'setup.py'))
     self.destroy()
     self.assertRaises(SystemExit, scm.check_valid_sandbox, self.packagedir)
示例#11
0
    def testWhitebox(self):
        def func(cmd):
            if cmd == 'git branch':
                return 0, ['* master']
            return 1, []

        scm = Git(MockProcess(func=func))
        self.assertRaises(SystemExit, scm.get_tracked_branch_from_sandbox,
                          self.packagedir)
示例#12
0
    def testWhitebox(self):
        self.called = 0

        def func(cmd):
            if cmd == 'git branch':
                return 0, ['* master']
            if cmd == 'git config -l':
                self.called += 1
                if self.called == 1:
                    return 0, ['branch.master.remote=origin']
            return 1, []

        scm = Git(MockProcess(func=func))
        self.assertRaises(SystemExit, scm.get_url_from_sandbox,
                          self.packagedir)
示例#13
0
 def testBadProcess(self):
     scm = Git(MockProcess(rc=1))
     self.assertRaises(SystemExit, scm.check_tag_exists, self.packagedir,
                       '2.6')
示例#14
0
 def testTagExists(self):
     scm = Git()
     self.tag(self.packagedir, '2.6')
     self.assertEqual(scm.tag_exists(self.packagedir, '2.6'), True)
示例#15
0
 def testBadProcess(self):
     scm = Git(MockProcess(rc=1))
     self.assertRaises(SystemExit, scm.switch_branch, self.packagedir,
                       'master')
示例#16
0
 def testGetSubfolderRoot(self):
     scm = Git()
     self.assertEqual(
         scm.get_root_from_sandbox(join(self.packagedir, 'testpackage')),
         self.packagedir)
示例#17
0
 def testNotADir(self):
     scm = Git()
     self.assertEqual(
         scm.is_valid_sandbox(join(self.packagedir, 'setup.py')), False)
示例#18
0
 def testBadProcess(self):
     scm = Git(MockProcess(rc=1))
     self.assertRaises(SystemExit, scm.create_tag, self.packagedir, '2.6',
                       'testpackage', '2.6', False)
示例#19
0
 def testFileUrl(self):
     scm = Git()
     self.assertEqual(scm.is_valid_url("file://"), True)
示例#20
0
 def testCreateExistingTag(self):
     scm = Git(Process(quiet=True))
     self.assertEqual(scm.create_tag(self.packagedir, "2.6", "testpackage", "2.6", False), 0)
     self.assertEqual(scm.tag_exists(self.packagedir, "2.6"), True)
     self.assertRaises(SystemExit, scm.create_tag, self.packagedir, "2.6", "testpackage", "2.6", False)
示例#21
0
 def testCreateTag(self):
     scm = Git()
     self.assertEqual(scm.tag_exists(self.packagedir, "2.6"), False)
     self.assertEqual(scm.create_tag(self.packagedir, "2.6", "testpackage", "2.6", False), 0)
     self.assertEqual(scm.tag_exists(self.packagedir, "2.6"), True)
示例#22
0
 def testTagExists(self):
     scm = Git()
     self.tag(self.packagedir, "2.6")
     self.assertEqual(scm.tag_exists(self.packagedir, "2.6"), True)
示例#23
0
 def testGitSshUrl(self):
     scm = Git()
     self.assertEqual(scm.is_valid_url("[email protected]:Jarn/jarn.mkrelease"), True)
示例#24
0
 def testTagDoesNotExist(self):
     scm = Git()
     self.assertEqual(scm.tag_exists(self.packagedir, "2.6"), False)
示例#25
0
 def testEmptyBranchId(self):
     scm = Git()
     self.assertEqual(scm.make_branchid(self.packagedir, ""), "master")
示例#26
0
 def testSandbox(self):
     scm = Git()
     self.assertEqual(scm.is_valid_sandbox(self.packagedir), True)
示例#27
0
 def testCommitAndPushDirtyLocalSandbox(self):
     scm = Git(Process(quiet=True))
     self.modify(self.packagedir)
     self.assertEqual(scm.commit_sandbox(self.packagedir, "testpackage", "2.6", True), 0)
示例#28
0
 def testCreateAndPushLocalTag(self):
     scm = Git()
     self.assertEqual(scm.create_tag(self.packagedir, "2.6", "testpackage", "2.6", True), 0)
     self.assertEqual(scm.tag_exists(self.packagedir, "2.6"), True)
示例#29
0
 def testBadPush(self):
     scm = Git(Process(quiet=True))
     self.clone()
     self.destroy()
     self.assertRaises(SystemExit, scm.create_tag, self.packagedir, '2.6',
                       'testpackage', '2.6', True)
示例#30
0
 def testCreateAndPushRemoteTag(self):
     scm = Git(Process(quiet=True))
     self.clone()
     self.assertEqual(scm.create_tag(self.clonedir, "2.6", "testpackage", "2.6", True), 0)
     self.assertEqual(scm.tag_exists(self.clonedir, "2.6"), True)
     self.assertEqual(scm.tag_exists(self.packagedir, "2.6"), True)
示例#31
0
 def testVersionInfo(self):
     scm = Git()
     self.failIfEqual(scm.version_info, ())
示例#32
0
 def testSandbox(self):
     scm = Git()
     self.assertEqual(scm.is_valid_sandbox(self.packagedir), True)
示例#33
0
 def testCommitCleanSandbox(self):
     scm = Git(Process(quiet=True))
     self.assertEqual(scm.commit_sandbox(self.packagedir, "testpackage", "2.6", False), 0)
示例#34
0
 def testGetVersion(self):
     scm = Git()
     self.assertNotEqual(scm.get_version(), "")
示例#35
0
 def testSwitchSameBranch(self):
     scm = Git()
     self.assertEqual(scm.get_branch_from_sandbox(self.packagedir), "master")
     self.assertEqual(scm.switch_branch(self.packagedir, "master"), 0)
     self.assertEqual(scm.get_branch_from_sandbox(self.packagedir), "master")
示例#36
0
 def testSubdirOfSandbox(self):
     scm = Git()
     self.assertEqual(scm.is_valid_sandbox(join(self.packagedir, "testpackage")), True)
示例#37
0
 def testTagDoesNotExist(self):
     scm = Git()
     self.assertEqual(scm.tag_exists(self.packagedir, '2.6'), False)
示例#38
0
 def testNotExists(self):
     scm = Git()
     self.assertEqual(scm.is_valid_sandbox("foo"), False)
示例#39
0
 def testBadSandbox(self):
     scm = Git(Process(quiet=True))
     self.destroy()
     self.assertRaises(SystemExit, scm.check_tag_exists, self.packagedir,
                       '2.6')
示例#40
0
 def testNotADir(self):
     scm = Git()
     self.assertEqual(scm.is_valid_sandbox(join(self.packagedir, "setup.py")), False)
示例#41
0
 def testCheckRaises(self):
     scm = Git()
     self.tag(self.packagedir, '2.6')
     self.assertRaises(SystemExit, scm.check_tag_exists, self.packagedir,
                       '2.6')
示例#42
0
 def testNotACheckout(self):
     scm = Git()
     self.destroy()
     self.assertEqual(scm.is_valid_sandbox(self.packagedir), False)
示例#43
0
 def testCommitAndPushCleanRemoteSandbox(self):
     scm = Git(Process(quiet=True))
     self.clone()
     self.assertEqual(scm.commit_sandbox(self.clonedir, "testpackage", "2.6", True), 0)
示例#44
0
 def testGetRoot(self):
     scm = Git()
     self.assertEqual(scm.get_root_from_sandbox(self.packagedir), self.packagedir)
示例#45
0
 def testCreateAndPushLocalTag(self):
     scm = Git()
     self.assertEqual(
         scm.create_tag(self.packagedir, '2.6', 'testpackage', '2.6', True),
         0)
     self.assertEqual(scm.tag_exists(self.packagedir, '2.6'), True)
示例#46
0
 def testGetCloneRoot(self):
     scm = Git()
     self.clone()
     self.assertEqual(scm.get_root_from_sandbox(self.clonedir), self.clonedir)
示例#47
0
 def testSubdirOfSandbox(self):
     scm = Git()
     self.assertEqual(
         scm.is_valid_sandbox(join(self.packagedir, 'testpackage')), True)
示例#48
0
 def testGetCloneSubfolderRoot(self):
     scm = Git()
     self.clone()
     self.assertEqual(scm.get_root_from_sandbox(join(self.clonedir, "testpackage")), self.clonedir)
示例#49
0
 def testBadSandbox(self):
     scm = Git(Process(quiet=True))
     self.destroy()
     self.assertRaises(SystemExit, scm.create_tag, self.packagedir, '2.6',
                       'testpackage', '2.6', False)
示例#50
0
 def testDeletedButTrackedFile(self):
     scm = Git()
     self.delete(self.packagedir)
     # Note: The sandbox is reported as unclean
     self.assertEqual(scm.is_unclean_sandbox(self.packagedir), True)
示例#51
0
 def testGetVersion(self):
     scm = Git()
     self.failIfEqual(scm.get_version(), '')
示例#52
0
 def testMakeBranchId(self):
     scm = Git()
     self.assertEqual(scm.make_branchid(self.packagedir, "2.x"), "2.x")
示例#53
0
 def testNotExists(self):
     scm = Git()
     self.assertEqual(scm.is_valid_sandbox('foo'), False)
示例#54
0
 def testCloneUrl(self):
     scm = Git(Process(quiet=True))
     self.assertEqual(scm.clone_url(self.packagedir, "testclone"), 0)
     self.assertEqual(isdir("testclone"), True)
示例#55
0
 def testNotACheckout(self):
     scm = Git()
     self.destroy()
     self.assertEqual(scm.is_valid_sandbox(self.packagedir), False)
示例#56
0
 def testBadProtocol(self):
     scm = Git()
     self.assertEqual(scm.is_valid_url("svn://"), False)
示例#57
0
 def testGetRoot(self):
     scm = Git()
     self.assertEqual(scm.get_root_from_sandbox(self.packagedir),
                      self.packagedir)
示例#58
0
 def testBadSandbox(self):
     scm = Git(Process(quiet=True))
     self.destroy()
     self.assertRaises(SystemExit, scm.switch_branch, self.packagedir,
                       'master')
示例#59
0
 def testGetCloneRoot(self):
     scm = Git()
     self.clone()
     self.assertEqual(scm.get_root_from_sandbox(self.clonedir),
                      self.clonedir)
示例#60
0
 def testEmptyString(self):
     scm = Git()
     self.assertEqual(scm.is_valid_url(""), False)