For this release I needed to find a new feature to work on. I had a look at the various bugs available for the pushlog and decided to go with this changeset UI bug. Now, currently there is UI (2 text boxes at the top right) available to submit a date query but nothing for the changeset query. Regretfully, I didn’t know that such a query even existed before I had a look at this bug. I’m sure other people are as ignorant about this as I was. This is why implementing some UI for this would be helpful.
Lets have a look at how this query works. It takes in two params, fromchange and tochange. Basically the query will retrieve all the changes pushed after the fromchange param and up to and including the tochange param. It works like any other query with the address bar looking something like this:
Server Side Code
The server side functionality is already there, found in the hgpoller/pushlog-feed.py file. The following is what it looks like:
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
if 'startdate' in req.form: startdate = doParseDate(req.form['startdate']) query.querystart = QueryType.DATE query.querystart_value = startdate elif 'fromchange' in req.form: query.querystart = QueryType.CHANGESET query.querystart_value = req.form.get('fromchange', ['null']) elif 'startID' in req.form: query.querystart = QueryType.PUSHID query.querystart_value = req.form.get('startID', ['0']) else: # default is last 10 pushes query.querystart = QueryType.COUNT query.querystart_value = PUSHES_PER_PAGE if 'enddate' in req.form: enddate = doParseDate(req.form['enddate']) query.queryend = QueryType.DATE query.queryend_value = enddate elif 'tochange' in req.form: query.queryend = QueryType.CHANGESET query.queryend_value = req.form.get('tochange', ['default']) elif 'endID' in req.form: query.queryend = QueryType.PUSHID query.queryend_value = req.form.get('endID', [None]) if 'user' in req.form: query.userquery = req.form.get('user', ) #TODO: use rev here, switch page to ?page=foo ? if 'changeset' in req.form: query.changesetquery = req.form.get('changeset', ) query.DoQuery() return query
The above code has the functionality for both the date and changeset queries. So basically, if the query is a changeset, then use QueryType.CHANGESET and set the values. Then query.DoQuery() retrieves the data from the db.