예제 #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)