示例#1
0
    m=match.match(None, None, [filepath], exact=True)
    status=repo.status(match=m, unknown=True)
    if any(status[:-2]):
        vim.command('let r=1')

repo_props={
            'tagslist': lambda repo: repo.tags().keys(),
        'brancheslist': lambda repo: repo.branchmap().keys(),
       'bookmarkslist': lambda repo: repo.listkeys('bookmarks').keys()
                                        if hasattr(repo, 'listkeys') else [],
                 'url': lambda repo: repo.ui.config('paths', 'default-push') or
                                     repo.ui.config('paths', 'default'),
              'branch': lambda repo: repo.dirstate.branch(),
        }

get_repo_prop = outermethod(autoexportmethod()(get_repo_prop_gen(repo_props)))

@outermethod
def call_cmd(repo, attr, bkwargs, *args, **kwargs):
    if bkwargs:
        for kw in bkwargs:
            if kw in kwargs:
                kwargs[kw]=bool(int(kwargs[kw]))
    if 'force' in kwargs:
        kwargs['force']=bool(int(kwargs['force']))
    else:
        kwargs['force']=False
    for key in [key for key in kwargs if key.find('-')!=-1]:
        newkey=key.replace('-', '_')
        kwargs[newkey]=kwargs.pop(key)
    cargs=[repo.ui, repo]
示例#2
0
repo_props = {
    'tagslist':
    lambda repo: repo.tags().keys(),
    'brancheslist':
    lambda repo: repo.branchmap().keys(),
    'bookmarkslist':
    lambda repo: repo.listkeys('bookmarks').keys()
    if hasattr(repo, 'listkeys') else [],
    'url':
    lambda repo: repo.ui.config('paths', 'default-push') or repo.ui.config(
        'paths', 'default'),
    'branch':
    lambda repo: repo.dirstate.branch(),
}

get_repo_prop = outermethod(autoexportmethod()(get_repo_prop_gen(repo_props)))


@outermethod
def call_cmd(repo, attr, bkwargs, *args, **kwargs):
    if bkwargs:
        for kw in bkwargs:
            if kw in kwargs:
                kwargs[kw] = bool(int(kwargs[kw]))
    if 'force' in kwargs:
        kwargs['force'] = bool(int(kwargs['force']))
    else:
        kwargs['force'] = False
    for key in [key for key in kwargs if key.find('-') != -1]:
        newkey = key.replace('-', '_')
        kwargs[newkey] = kwargs.pop(key)
示例#3
0
文件: aubazaar.py 项目: skeept/dotvim
    r.sort()
    return r

repo_props={
        'branch':        lambda repo: repo.branch.nick,
        'url':           lambda repo: (   repo.branch.get_push_location()
                                       or repo.branch.get_parent()).encode('utf-8'),
        'bookmarkslist': lambda repo: [],
        'brancheslist':  lambda repo: [],
        'tagslist':      lambda repo: sorted_str_keys(repo.branch.tags.get_tag_dict()),
}

get_repo_prop = outermethod(
                autoexportmethod()(
                bzrmethod(
                get_repo_prop_gen(repo_props, pathattr='basedir'))))

class ReadLock(object):
    def __init__(self, o):
        self.o = o

    def __enter__(self):
        self.o.lock_read()

    def __exit__(self, *args):
        self.o.unlock()

def get_all_files(repo, revid):
    tree = repo.branch.repository.revision_tree(revid)
    with ReadLock(tree):
        return list((item[0].encode('utf-8') for item in tree.list_files()))
示例#4
0
repo_props = {
    'branch':
    lambda repo: repo.branch.nick,
    'url':
    lambda repo: (repo.branch.get_push_location() or repo.branch.get_parent()).
    encode('utf-8'),
    'bookmarkslist':
    lambda repo: [],
    'brancheslist':
    lambda repo: [],
    'tagslist':
    lambda repo: sorted_str_keys(repo.branch.tags.get_tag_dict()),
}

get_repo_prop = outermethod(autoexportmethod()(bzrmethod(
    get_repo_prop_gen(repo_props, pathattr='basedir'))))


class ReadLock(object):
    def __init__(self, o):
        self.o = o

    def __enter__(self):
        self.o.lock_read()

    def __exit__(self, *args):
        self.o.unlock()


def get_all_files(repo, revid):
    tree = repo.branch.repository.revision_tree(revid)