本文整理汇总了Python中mercurial.extensions.find函数的典型用法代码示例。如果您正苦于以下问题:Python find函数的具体用法?Python find怎么用?Python find使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: extsetup
def extsetup(ui):
entry = wrapcommand(commands.table, 'push', _push)
try:
# Don't add the 'to' arg if it already exists
extensions.find('remotenames')
except KeyError:
entry[1].append(('', 'to', '', _('server revision to rebase onto')))
partorder = exchange.b2partsgenorder
partorder.insert(partorder.index('changeset'),
partorder.pop(partorder.index(rebaseparttype)))
partorder.insert(0, partorder.pop(partorder.index(commonheadsparttype)))
wrapfunction(discovery, 'checkheads', _checkheads)
# we want to disable the heads check because in pushrebase repos, we
# expect the heads to change during the push and we should not abort.
# The check heads functions are used to verify that the heads haven't
# changed since the client did the initial discovery. Pushrebase is meant
# to allow concurrent pushes, so the heads may have very well changed.
# So let's not do this check.
wrapfunction(exchange, 'check_heads', _exchangecheckheads)
wrapfunction(exchange, '_pushb2ctxcheckheads', _skipcheckheads)
origpushkeyhandler = bundle2.parthandlermapping['pushkey']
newpushkeyhandler = lambda *args, **kwargs: \
bundle2pushkey(origpushkeyhandler, *args, **kwargs)
newpushkeyhandler.params = origpushkeyhandler.params
bundle2.parthandlermapping['pushkey'] = newpushkeyhandler
bundle2.parthandlermapping['b2x:pushkey'] = newpushkeyhandler
wrapfunction(exchange, 'unbundle', unbundle)
wrapfunction(hg, '_peerorrepo', _peerorrepo)
示例2: uisetup
def uisetup(ui):
extensions.wrapfunction(repair, 'strip', strip)
extensions.wrapcommand(commands.table, 'update', tasksupdate)
extensions.wrapcommand(commands.table, 'log', taskslog)
extensions.wrapcommand(commands.table, 'export', tasksexport)
entry = extensions.wrapcommand(commands.table, 'push', taskspush)
entry[1].append(('', 'completed-tasks', None,
_('push all heads that have completed tasks only')))
entry[1].append(('', 'all-tasks', None,
_('push all heads including those with incomplete tasks')))
try:
transplant = extensions.find('transplant')
if transplant:
entry = extensions.wrapcommand(transplant.cmdtable, 'transplant',
taskstransplant)
entry[1].append(('t', 'task', '',
_('transplant all changesets in task TASK')))
except:
pass
try:
patchbomb = extensions.find('patchbomb')
if patchbomb:
entry = extensions.wrapcommand(patchbomb.cmdtable, 'email',
tasksemail)
entry[1].append(('t', 'task', '',
_('email all changesets in task TASK')))
except:
pass
示例3: _patch
def _patch(m):
g = m.groups()
try:
extensions.find("mq")
except KeyError:
return ""
q = repo.mq
if _get_filter("quiet", g) and not len(q.series):
return ""
if _get_filter("topindex", g):
if len(q.applied):
out = str(len(q.applied) - 1)
else:
out = ""
elif _get_filter("applied", g):
out = str(len(q.applied))
elif _get_filter("unapplied", g):
out = str(len(q.unapplied(repo)))
elif _get_filter("count", g):
out = str(len(q.series))
else:
out = q.applied[-1].name if q.applied else ""
return _with_groups(g, out) if out else ""
示例4: _deleteunreachable
def _deleteunreachable(repo, ctx):
"""Deletes all ancestor and descendant commits of the given revision that
aren't reachable from another bookmark.
"""
keepheads = "bookmark() + ."
try:
extensions.find('remotenames')
keepheads += " + remotenames()"
except KeyError:
pass
hiderevs = repo.revs('::%s - ::(%r)', ctx.rev(), keepheads)
if hiderevs:
lock = None
try:
lock = repo.lock()
if _isobsstoreenabled(repo):
markers = []
for rev in hiderevs:
markers.append((repo[rev], ()))
obsolete.createmarkers(repo, markers)
repo.ui.status(_("%d changesets pruned\n") % len(hiderevs))
else:
repair.strip(repo.ui, repo,
[repo.changelog.node(r) for r in hiderevs])
finally:
lockmod.release(lock)
示例5: _patch
def _patch(m):
g = m.groups()
try:
extensions.find('mq')
except KeyError:
return ''
q = repo.mq
if _get_filter('quiet', g) and not len(q.series):
return ''
if _get_filter('topindex', g):
if len(q.applied):
out = str(len(q.applied) - 1)
else:
out = ''
elif _get_filter('applied', g):
out = str(len(q.applied))
elif _get_filter('unapplied', g):
out = str(len(q.unapplied(repo)))
elif _get_filter('count', g):
out = str(len(q.series))
else:
out = q.applied[-1].name if q.applied else ''
return _with_groups(g, out) if out else ''
示例6: extsetup
def extsetup(ui):
if _fbsparseexists(ui):
cmdtable.clear()
return
_setupclone(ui)
_setuplog(ui)
_setupadd(ui)
_setupdirstate(ui)
_setupdiff(ui)
# if fsmonitor is enabled, tell it to use our hash function
try:
fsmonitor = extensions.find('fsmonitor')
def _hashignore(orig, ignore):
return _hashmatcher(ignore)
extensions.wrapfunction(fsmonitor, '_hashignore', _hashignore)
except KeyError:
pass
# do the same for hgwatchman, old name
try:
hgwatchman = extensions.find('hgwatchman')
def _hashignore(orig, ignore):
return _hashmatcher(ignore)
extensions.wrapfunction(hgwatchman, '_hashignore', _hashignore)
except KeyError:
pass
示例7: extsetup
def extsetup(ui):
try:
extensions.find('win32text')
ui.warn(_("the eol extension is incompatible with the "
"win32text extension\n"))
except KeyError:
pass
示例8: uisetup
def uisetup(ui):
if ui.plain():
return
try:
extensions.find('color')
except KeyError:
ui.warn(_("warning: 'diff-highlight' requires 'color' extension "
"to be enabled, but not\n"))
return
if not isinstance(ui, colorui):
colorui.__bases__ = (ui.__class__,)
ui.__class__ = colorui
def colorconfig(orig, *args, **kwargs):
ret = orig(*args, **kwargs)
styles = color._styles
if INSERT_EMPH not in styles:
styles[INSERT_EMPH] = styles[INSERT_NORM] + ' inverse'
if DELETE_EMPH not in styles:
styles[DELETE_EMPH] = styles[DELETE_NORM] + ' inverse'
return ret
extensions.wrapfunction(color, 'configstyles', colorconfig)
示例9: extsetup
def extsetup(ui):
try:
extensions.find('win32text')
raise util.Abort(_("the eol extension is incompatible with the "
"win32text extension"))
except KeyError:
pass
示例10: unamend
def unamend(ui, repo, **opts):
"""undo the amend operation on a current changeset
This command will roll back to the previous version of a changeset,
leaving working directory in state in which it was before running
`hg amend` (e.g. files modified as part of an amend will be
marked as modified `hg status`)"""
try:
extensions.find('inhibit')
except KeyError:
hint = _("please add inhibit to the list of enabled extensions")
e = _("unamend requires inhibit extension to be enabled")
raise error.Abort(e, hint=hint)
unfi = repo.unfiltered()
# identify the commit from which to unamend
curctx = repo['.']
# identify the commit to which to unamend
markers = list(predecessormarkers(curctx))
if len(markers) != 1:
e = _("changeset must have one predecessor, found %i predecessors")
raise error.Abort(e % len(markers))
prednode = markers[0].prednode()
predctx = unfi[prednode]
if curctx.children():
raise error.Abort(_("cannot unamend in the middle of a stack"))
with repo.wlock(), repo.lock():
ctxbookmarks = curctx.bookmarks()
changedfiles = []
wctx = repo[None]
wm = wctx.manifest()
cm = predctx.manifest()
dirstate = repo.dirstate
diff = cm.diff(wm)
changedfiles.extend(diff.iterkeys())
tr = repo.transaction('unamend')
with dirstate.parentchange():
dirstate.rebuild(prednode, cm, changedfiles)
# we want added and removed files to be shown
# properly, not with ? and ! prefixes
for filename, data in diff.iteritems():
if data[0][0] is None:
dirstate.add(filename)
if data[1][0] is None:
dirstate.remove(filename)
changes = []
for book in ctxbookmarks:
changes.append((book, prednode))
repo._bookmarks.applychanges(repo, tr, changes)
obsolete.createmarkers(repo, [(curctx, (predctx,))])
tr.close()
示例11: _checkobsrebasewrapper
def _checkobsrebasewrapper(orig, repo, ui, *args):
overrides = {}
try:
extensions.find('inhibit')
# if inhibit is enabled, allow divergence
overrides[('experimental', 'evolution.allowdivergence')] = True
except KeyError:
pass
with repo.ui.configoverride(overrides, 'tweakdefaults'):
orig(repo, ui, *args)
示例12: extsetup
def extsetup(ui):
# Ensure required extensions are loaded.
for ext in ('purge', 'share'):
try:
extensions.find(ext)
except KeyError:
extensions.load(ui, ext, None)
purgemod = extensions.find('purge')
extensions.wrapcommand(purgemod.cmdtable, 'purge', purgewrapper)
示例13: uisetup
def uisetup(ui):
try:
extensions.find('mq')
cmdtable.update(_mqcmdtable)
except KeyError:
pass
# ignore --no-commit on hg<3.7 (ce76c4d2b85c)
_aliases, entry = cmdutil.findcmd('backout', commands.table)
if not any(op for op in entry[1] if op[1] == 'no-commit'):
entry[1].append(('', 'no-commit', None, '(EXPERIMENTAL)'))
示例14: extsetup
def extsetup(ui):
entry = wrapcommand(commands.table, 'push', _push)
try:
# Don't add the 'to' arg if it already exists
extensions.find('remotenames')
except KeyError:
entry[1].append(('', 'to', '', _('server revision to rebase onto')))
partorder = exchange.b2partsgenorder
# rebase part must go before the changeset part, so we can mark the
# changeset part as done first.
partorder.insert(partorder.index('changeset'),
partorder.pop(partorder.index(rebaseparttype)))
# rebase pack part must go before rebase part so it can write to the pack to
# disk for reading.
partorder.insert(partorder.index(rebaseparttype),
partorder.pop(partorder.index(rebasepackparttype)))
partorder.insert(0, partorder.pop(partorder.index(commonheadsparttype)))
if 'check-bookmarks' in partorder:
# check-bookmarks is intended for non-pushrebase scenarios when
# we can't push to a bookmark if it's changed in the meantime
partorder.pop(partorder.index('check-bookmarks'))
wrapfunction(discovery, 'checkheads', _checkheads)
# we want to disable the heads check because in pushrebase repos, we
# expect the heads to change during the push and we should not abort.
# The check heads functions are used to verify that the heads haven't
# changed since the client did the initial discovery. Pushrebase is meant
# to allow concurrent pushes, so the heads may have very well changed.
# So let's not do this check.
wrapfunction(exchange, 'check_heads', _exchangecheckheads)
wrapfunction(exchange, '_pushb2ctxcheckheads', _skipcheckheads)
origpushkeyhandler = bundle2.parthandlermapping['pushkey']
newpushkeyhandler = lambda *args, **kwargs: \
bundle2pushkey(origpushkeyhandler, *args, **kwargs)
newpushkeyhandler.params = origpushkeyhandler.params
bundle2.parthandlermapping['pushkey'] = newpushkeyhandler
bundle2.parthandlermapping['b2x:pushkey'] = newpushkeyhandler
origphaseheadshandler = bundle2.parthandlermapping['phase-heads']
newphaseheadshandler = lambda *args, **kwargs: \
bundle2phaseheads(origphaseheadshandler, *args, **kwargs)
newphaseheadshandler.params = origphaseheadshandler.params
bundle2.parthandlermapping['phase-heads'] = newphaseheadshandler
wrapfunction(exchange, 'unbundle', unbundle)
wrapfunction(hg, '_peerorrepo', _peerorrepo)
示例15: _patches
def _patches(m):
g = m.groups()
try:
extensions.find('mq')
except KeyError:
return ''
join_filter = _get_filter('join', g)
join_filter_arg = _get_filter_arg(join_filter)
if join_filter:
sep = join_filter_arg
else:
sep = ' -> '
patches = repo.mq.series
applied = [p.name for p in repo.mq.applied]
unapplied = filter(lambda p: p not in applied, patches)
if _get_filter('hide_applied', g):
patches = filter(lambda p: p not in applied, patches)
if _get_filter('hide_unapplied', g):
patches = filter(lambda p: p not in unapplied, patches)
if _get_filter('reverse', g):
patches = reversed(patches)
pre_applied_filter = _get_filter('pre_applied', g)
pre_applied_filter_arg = _get_filter_arg(pre_applied_filter)
post_applied_filter = _get_filter('post_applied', g)
post_applied_filter_arg = _get_filter_arg(post_applied_filter)
pre_unapplied_filter = _get_filter('pre_unapplied', g)
pre_unapplied_filter_arg = _get_filter_arg(pre_unapplied_filter)
post_unapplied_filter = _get_filter('post_unapplied', g)
post_unapplied_filter_arg = _get_filter_arg(post_unapplied_filter)
for n, patch in enumerate(patches):
if patch in applied:
if pre_applied_filter:
patches[n] = pre_applied_filter_arg + patches[n]
if post_applied_filter:
patches[n] = patches[n] + post_applied_filter_arg
elif patch in unapplied:
if pre_unapplied_filter:
patches[n] = pre_unapplied_filter_arg + patches[n]
if post_unapplied_filter:
patches[n] = patches[n] + post_unapplied_filter_arg
if patches:
return _with_groups(g, sep.join(patches))
else:
return ''