repoman-ext / modst.py

def modst(ui, f, *args, **opts):
    '''help'''
    
    maxlen = 0
    for m in f:
        maxlen = max(len(m), maxlen)

    for m in f:
        repo = f[m]
        modified, added, removed, deleted, unknown, ignored, clean = repo.status(ignored=opts['ignored'], clean=opts['clean'], unknown=opts['unknown'])
        other = opts['ignored'] and ignored or opts['clean'] and clean
        if opts['all'] or modified or added or removed or deleted or unknown or other:
            ui.write('%s%s' % (ui.emph_str(m), ' ' * (maxlen - len(m))))
            ui.write('%4dM ' % (len(modified),), label='status.modified')
            ui.write('%4dA ' % (len(added),), label='status.added')
            ui.write('%4dR ' % (len(removed),), label='status.removed')
            ui.write('%4d! ' % (len(deleted),), label='status.deleted')
            ui.write('%4d? ' % (len(unknown),), label='status.unknown')
            if opts['ignored']:
                ui.write('%4dI ' %(len(ignored),), label='status.ignored')
            if opts['clean']:
                ui.write('%5dC ' % (len(clean),), label='status.clean')
            ui.write('\n')

def inmerge(ui, f, *args, **opts):
    maxlen = 0
    for m in f:
        maxlen = max(len(m), maxlen)

    for m in f:
        repo = f[m]
        ctx = repo[None]
        if len(ctx.parents()) == 2:
            ui.write('%s%s' % (ui.emph_str(m), ' ' * (maxlen - len(m))))
            ui.write('%d: %s\n' % (ctx.parents()[0].rev(), ctx.parents()[0].description().splitlines()[0]))
            ui.write('%s' % (' ' * maxlen,))
            ui.write('%d: %s\n' % (ctx.parents()[1].rev(), ctx.parents()[1].description().splitlines()[0]))

cmdtable = {
        'modst': (modst, ['mst'], [
            ('', 'all', False, 'show status for all files'),
            ('i', 'ignored', False, 'show ignored files'),
            ('c', 'clean', False, 'show clean files'),
            ('u', 'unknown', False, 'show unknown files'),
            ], '...'),
        'inmerge': (inmerge, [], [], '...'),
        }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.