review/extension_ui.py @ 11f42ea0fcf5

Massive resturcturing.
author Steve Losh <steve@stevelosh.com>
date Sun, 04 Oct 2009 14:43:37 -0400
parents (none)
children d02c0ed2f109
'''The review extension's UI.'''

import messages
from data 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)
        

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'),
    ],
    'hg review')
}