2016-08-31 16:01:42 +02:00
|
|
|
import logging
|
|
|
|
|
2016-07-29 16:48:43 +02:00
|
|
|
from flask import Blueprint
|
2016-08-31 11:30:44 +02:00
|
|
|
from pillar.api.utils import jsonify
|
2016-07-29 16:48:43 +02:00
|
|
|
|
|
|
|
blueprint = Blueprint('attract', __name__)
|
2016-08-31 16:01:42 +02:00
|
|
|
log = logging.getLogger(__name__)
|
2016-07-29 16:48:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
@blueprint.route('/jemoeder')
|
|
|
|
def jemoeder():
|
2016-07-29 17:43:58 +02:00
|
|
|
return jsonify({'je': 'moeder'})
|
2016-08-31 16:01:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
@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,
|
|
|
|
})
|