review/extension_ui.py @ 9639f74d4c7f

Start working on the basic reviewing of csets.
author Steve Losh <steve@stevelosh.com>
date Sun, 04 Oct 2009 17:33:58 -0400
parents d02c0ed2f109
children cdd63ba4a8f8
'''The review extension's UI.'''

import messages
from api import *
from mercurial import util

def review(ui, repo, *fnames, **opts):
    '''code review a changeset in the current repository
    '''
    if opts.pop('init'):
        ui.note(messages.INIT_START)
        try:
            datastore = ReviewDatastore(ui, repo, lpath=opts.pop('local_path'),
                rpath=opts.pop('remote_path'), create=True)
            ui.status(messages.INIT_SUCCESS)
            return
        except PreexistingDatastore, e:
            if e.committed:
                ui.note(messages.INIT_EXISTS_COMMITTED)
            else:
                raise util.Abort(messages.INIT_EXISTS_UNCOMMITTED)
            return
        
    # No other options matched, so we're at the basic review command.
    rev = opts.pop('rev')
    rd = ReviewDatastore(ui, repo)
    rc = rd[rev]

cmdtable = {
    'review': (review, [
        ('i', 'init', False, 'start code reviewing this repository'),
        ('', 'local-path', '', 'the local path to the code review data'),
        ('', 'remote-path', '', 'the remote path to code review data'),
        ('r', 'rev', '.', 'the revision to review'),
    ],
    'hg review')
}