For now just uses a hard-coded SVN URL, and never stores the last-seen revision. As a result, it always examines all revisions.
33 lines
926 B
Python
33 lines
926 B
Python
import logging
|
|
|
|
from flask import Blueprint
|
|
from pillar.api.utils import jsonify
|
|
|
|
blueprint = Blueprint('attract', __name__)
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
@blueprint.route('/jemoeder')
|
|
def jemoeder():
|
|
return jsonify({'je': 'moeder'})
|
|
|
|
|
|
@blueprint.route('/subversion/kick')
|
|
def subversion_kick():
|
|
from . import subversion
|
|
|
|
# TODO: each project should have its own SVN server.
|
|
svn_server_url = 'svn://localhost/agent327'
|
|
log.info('Re-examining SVN server %s', svn_server_url)
|
|
client = subversion.obtain(svn_server_url)
|
|
|
|
# TODO: last_seen_revision should be stored, probably at the project level.
|
|
last_seen_revision = 0
|
|
observer = subversion.CommitLogObserver(client, last_seen_revision=last_seen_revision)
|
|
observer.fetch_and_observe()
|
|
|
|
return jsonify({
|
|
'previous_last_seen_revision': last_seen_revision,
|
|
'last_seen_revision': observer.last_seen_revision,
|
|
})
|