示例#1
0
    def pull(self):
        with self._actionlock:
            try:
                latest_before_pull = get_latest_commit()

                self._repo.remotes.origin.pull(progress=self._progress)

                after_pull = get_latest_commit()

            # The developers at the mailing list were unable to tell me
            # if the pull() would raise an exception on merge conflicts
            # or which exception would be raised. So I'm catching all and
            # verifying if there are conflicts in an exception and in the
            # case were no exceptions were raised
            except Exception, e:
                self.handle_conflicts(latest_before_pull)
                msg = self.UPD_ERROR_MSG + ' The original exception was: "%s"'
                raise GitClientError(msg % e)
            else:
示例#2
0
    def pull(self):
        with self._actionlock:
            try:
                latest_before_pull = get_latest_commit()
            
                self._repo.remotes.origin.pull(progress=self._progress)

                after_pull = get_latest_commit()
            
            # The developers at the mailing list were unable to tell me
            # if the pull() would raise an exception on merge conflicts
            # or which exception would be raised. So I'm catching all and
            # verifying if there are conflicts in an exception and in the
            # case were no exceptions were raised
            except Exception, e:
                self.handle_conflicts(latest_before_pull)
                msg = self.UPD_ERROR_MSG + ' The original exception was: "%s"'
                raise GitClientError(msg % e)
            else:
示例#3
0
def get_w3af_version_as_dict():
    """
    :return: All the version information in a dict
    """
    commit = to_short_id(get_latest_commit()) if is_git_repo() else 'unknown'
    cdate = ' - %s' % get_latest_commit_date() if is_git_repo() else ''
    branch = get_current_branch() if is_git_repo() else 'unknown'
    dirty = 'Yes' if is_dirty_repo() else 'No'

    return {'version': get_minimalistic_version(),
            'revision': commit + cdate,
            'branch': branch,
            'dirty': dirty}
示例#4
0
def get_w3af_version():
    """
    :return: A string with the w3af version.
    """
    commit = to_short_id(get_latest_commit()) if is_git_repo() else 'unknown'
    cdate = ' - %s' % get_latest_commit_date() if is_git_repo() else ''
    branch = get_current_branch() if is_git_repo() else 'unknown'
    dirty = 'Yes' if is_dirty_repo() else 'No'

    vnumber = get_minimalistic_version()
    
    return ('w3af - Web Application Attack and Audit Framework\n'
            'Version: %s\n'
            'Distribution: Kali Linux\n'
            'Author: Andres Riancho and the w3af team.') % (vnumber)
示例#5
0
def get_w3af_version():
    """
    :return: A string with the w3af version.
    """
    commit = to_short_id(get_latest_commit()) if is_git_repo() else 'unknown'
    cdate = ' - %s' % get_latest_commit_date() if is_git_repo() else ''
    branch = get_current_branch() if is_git_repo() else 'unknown'
    dirty = 'Yes' if is_dirty_repo() else 'No'

    vnumber = get_minimalistic_version()

    return ('w3af - Web Application Attack and Audit Framework\n'
            'Version: %s\n'
            'Revision: %s%s\n'
            'Branch: %s\n'
            'Local changes: %s\n'
            'Author: Andres Riancho and the w3af team.') % (
                vnumber, commit, cdate, branch, dirty)
示例#6
0
def get_w3af_version_as_dict():
    """
    This method seems to take considerable time to run when w3af is run from
    a git installation (.git directory is present). All of the time it takes
    to solve this function comes from get_w3af_version_as_dict(), which
    reads the Git meta-data.

    Some plugins, such as xml_file, call get_w3af_version every N seconds to
    write that information to the output file. I added @memoized in order to
    reduce the time it takes to run the output plugin.

    :return: All the version information in a dict
    """
    commit = to_short_id(get_latest_commit()) if is_git_repo() else 'unknown'
    cdate = ' - %s' % get_latest_commit_date() if is_git_repo() else ''
    branch = get_current_branch() if is_git_repo() else 'unknown'
    dirty = 'Yes' if is_dirty_repo() else 'No'

    return {'version': get_minimalistic_version(),
            'revision': commit + cdate,
            'branch': branch,
            'dirty': dirty}
示例#7
0
def get_w3af_version_as_dict():
    """
    This method seems to take considerable time to run when w3af is run from
    a git installation (.git directory is present). All of the time it takes
    to solve this function comes from get_w3af_version_as_dict(), which
    reads the Git meta-data.

    Some plugins, such as xml_file, call get_w3af_version every N seconds to
    write that information to the output file. I added @memoized in order to
    reduce the time it takes to run the output plugin.

    :return: All the version information in a dict
    """
    commit = to_short_id(get_latest_commit()) if is_git_repo() else 'unknown'
    cdate = ' - %s' % get_latest_commit_date() if is_git_repo() else ''
    branch = get_current_branch() if is_git_repo() else 'unknown'
    dirty = 'Yes' if is_dirty_repo() else 'No'

    return {
        'version': get_minimalistic_version(),
        'revision': commit + cdate,
        'branch': branch,
        'dirty': dirty
    }
示例#8
0
    def test_get_latest_commit(self):
        latest_commit = get_latest_commit()

        self.assertEqual(len(latest_commit), 40)
        self.assertIsInstance(latest_commit, basestring)
示例#9
0
 def test_get_latest_commit(self):
     latest_commit = get_latest_commit()
     
     self.assertEqual(len(latest_commit), 40)
     self.assertIsInstance(latest_commit, basestring)