예제 #1
0
파일: test_remote.py 프로젝트: dmore/jig
    def test_remote_different_branch_has_updates(self):
        """
        If the remote has a non-"master" branch as the default.
        """
        # Create a new branch on the remote
        alternate = self.remote_repo.create_head('alternate')
        self.remote_repo.head.reference = alternate
        self.remote_repo.head.reset(index=True, working_tree=True)

        # Clone the remote branch locally
        self.local_workingdir = mkdtemp()
        clone(self.remote_workingdir, self.local_workingdir,
              branch='alternate')
        self.local_repo = Repo(self.local_workingdir)

        # If we check now, no new updates have been made
        self.assertFalse(remote_has_updates(self.local_workingdir))

        # Let the clock rollover
        sleep(1.0)

        # Commit to the 'alternate' branch on the remote
        self.commit(self.remote_workingdir, 'a.txt', 'aaa')

        self.assertTrue(remote_has_updates(self.local_workingdir))
예제 #2
0
    def test_remote_different_branch_has_updates(self):
        """
        If the remote has a non-"master" branch as the default.
        """
        # Create a new branch on the remote
        alternate = self.remote_repo.create_head('alternate')
        self.remote_repo.head.reference = alternate
        self.remote_repo.head.reset(index=True, working_tree=True)

        # Clone the remote branch locally
        self.local_workingdir = mkdtemp()
        clone(self.remote_workingdir,
              self.local_workingdir,
              branch='alternate')
        self.local_repo = Repo(self.local_workingdir)

        # If we check now, no new updates have been made
        self.assertFalse(remote_has_updates(self.local_workingdir))

        # Let the clock rollover
        sleep(1.0)

        # Commit to the 'alternate' branch on the remote
        self.commit(self.remote_workingdir, 'a.txt', 'aaa')

        self.assertTrue(remote_has_updates(self.local_workingdir))
예제 #3
0
파일: test_remote.py 프로젝트: dmore/jig
    def test_has_updates_in_local(self):
        """
        If the updates are in the local branch, return False.
        """
        sleep(1.0)

        self.commit(self.local_workingdir, 'a.txt', 'aaa')

        self.assertFalse(remote_has_updates(self.local_workingdir))
예제 #4
0
파일: test_remote.py 프로젝트: dmore/jig
    def test_handles_git_python_exceptions(self):
        """
        If the fetch to retrieve new information results in an exception.
        """
        with patch('jig.gitutils.remote.git') as git:
            git.Repo.side_effect = AttributeError

            self.assertTrue(remote_has_updates(self.local_workingdir))

        with patch('jig.gitutils.remote.git') as git:
            git.Repo.side_effect = GitCommandError(None, None)

            self.assertTrue(remote_has_updates(self.local_workingdir))

        with patch('jig.gitutils.remote.git') as git:
            git.Repo.side_effect = AssertionError

            self.assertTrue(remote_has_updates(self.local_workingdir))
예제 #5
0
    def test_has_updates_in_local(self):
        """
        If the updates are in the local branch, return False.
        """
        sleep(1.0)

        self.commit(self.local_workingdir, 'a.txt', 'aaa')

        self.assertFalse(remote_has_updates(self.local_workingdir))
예제 #6
0
    def test_handles_git_python_exceptions(self):
        """
        If the fetch to retrieve new information results in an exception.
        """
        with patch('jig.gitutils.remote.git') as git:
            git.Repo.side_effect = AttributeError

            self.assertTrue(remote_has_updates(self.local_workingdir))

        with patch('jig.gitutils.remote.git') as git:
            git.Repo.side_effect = GitCommandError(None, None)

            self.assertTrue(remote_has_updates(self.local_workingdir))

        with patch('jig.gitutils.remote.git') as git:
            git.Repo.side_effect = AssertionError

            self.assertTrue(remote_has_updates(self.local_workingdir))
예제 #7
0
파일: test_remote.py 프로젝트: dmore/jig
    def test_has_updates(self):
        """
        If the remote is newer than the local, returns True.
        """
        # Wait a second so the date is different than our original commit
        sleep(1.0)

        self.commit(self.remote_workingdir, 'a.txt', 'aaa')

        self.assertTrue(remote_has_updates(self.local_workingdir))
예제 #8
0
    def test_has_updates(self):
        """
        If the remote is newer than the local, returns True.
        """
        # Wait a second so the date is different than our original commit
        sleep(1.0)

        self.commit(self.remote_workingdir, 'a.txt', 'aaa')

        self.assertTrue(remote_has_updates(self.local_workingdir))
예제 #9
0
파일: tools.py 프로젝트: robmadole/jig
def plugins_have_updates(gitrepo):
    """
    Return True if any installed plugins have updates.

    :param string gitrepo: path to the Git repository
    """
    jig_plugin_dir = join(gitrepo, JIG_DIR_NAME, JIG_PLUGIN_DIR)

    for directory in listdir(jig_plugin_dir):
        if remote_has_updates(join(jig_plugin_dir, directory)):
            return True

    return False
예제 #10
0
파일: tools.py 프로젝트: dmore/jig
def plugins_have_updates(gitrepo):
    """
    Return True if any installed plugins have updates.

    :param string gitrepo: path to the Git repository
    """
    jig_plugin_dir = join(gitrepo, JIG_DIR_NAME, JIG_PLUGIN_DIR)

    for directory in listdir(jig_plugin_dir):
        if remote_has_updates(join(jig_plugin_dir, directory)):
            return True

    return False
예제 #11
0
파일: test_remote.py 프로젝트: dmore/jig
 def test_no_updates(self):
     """
     If the remote and local are the same, return False.
     """
     self.assertFalse(remote_has_updates(self.local_workingdir))
예제 #12
0
 def test_no_updates(self):
     """
     If the remote and local are the same, return False.
     """
     self.assertFalse(remote_has_updates(self.local_workingdir))