v0.8 Release – Contemplating UI for the Changeset Query

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:

/pushloghtml?fromchange=df94feb90a4f&tochange=5428595e217c

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'][0])
        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'])[0]
    elif 'startID' in req.form:
        query.querystart = QueryType.PUSHID
        query.querystart_value = req.form.get('startID', ['0'])[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'][0])
        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'])[0]
    elif 'endID' in req.form:
        query.queryend = QueryType.PUSHID
        query.queryend_value = req.form.get('endID', [None])[0]
 
    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.

The UI

Now, the question remains what type of UI to implement. I could just dump in another two text boxes and a button for the changeset query. But, that just seems clumsy and it will clutter up the page. Right now I’m thinking of a drop down menu and two text boxes that can take in either dates or changesets. I’ll need to implement some JavaScript to get this functionality working. I hope to have this up and running soon.

This entry was posted in DPS911, Mercurial Project, Open Source and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>