本文整理汇总了Python中mercurial.scmutil.revsingle函数的典型用法代码示例。如果您正苦于以下问题:Python revsingle函数的具体用法?Python revsingle怎么用?Python revsingle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了revsingle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: startfrom
def startfrom(ui, repo, opts):
base, dest = 'null', 'tip'
if opts.get('bookmark'):
dest = opts.get('bookmark')
if opts.get('base'):
base = opts['base']
if opts.get('bookmark') not in repo:
dest = base
basectx = scmutil.revsingle(repo, base)
destctx = scmutil.revsingle(repo, dest)
ctx = list(repo.set("""
last(
%n::%n and (
extra(p4changelist) or
extra(p4fullimportbasechangelist)))""",
basectx.node(), destctx.node()))
if ctx:
ctx = ctx[0]
startcl = lastcl(ctx)
ui.note(_('incremental import from changelist: %d, node: %s\n') %
(startcl, short(ctx.node())))
if ctx.node() == basectx.node():
ui.note(_('creating branchpoint, base %s\n') %
short(basectx.node()))
return ctx, startcl, True
return ctx, startcl, False
raise error.Abort(_('no valid p4 changelist number.'))
示例2: perfpathcopies
def perfpathcopies(ui, repo, rev1, rev2, **opts):
timer, fm = gettimer(ui, opts)
ctx1 = scmutil.revsingle(repo, rev1, rev1)
ctx2 = scmutil.revsingle(repo, rev2, rev2)
def d():
copies.pathcopies(ctx1, ctx2)
timer(d)
fm.end()
示例3: _masterrev
def _masterrev(repo, masterrevset):
try:
master = scmutil.revsingle(repo, masterrevset)
except error.RepoLookupError:
master = scmutil.revsingle(repo, _masterrevset(repo.ui, repo, ''))
except error.Abort: # empty revision set
return None
if master:
return master.rev()
return None
示例4: _filterfetchpaths
def _filterfetchpaths(repo, paths):
"""return a subset of paths whose history is long and need to fetch linelog
from the server. works with remotefilelog and non-remotefilelog repos.
"""
threshold = repo.ui.configint('fastannotate', 'clientfetchthreshold', 10)
if threshold <= 0:
return paths
master = repo.ui.config('fastannotate', 'mainbranch') or 'default'
if 'remotefilelog' in repo.requirements:
ctx = scmutil.revsingle(repo, master)
f = lambda path: len(ctx[path].ancestormap())
else:
f = lambda path: len(repo.file(path))
result = []
for path in paths:
try:
if f(path) >= threshold:
result.append(path)
except Exception: # file not found etc.
result.append(path)
return result
示例5: _rebase
def _rebase(orig, ui, repo, **opts):
if not opts.get('date') and not ui.configbool('tweakdefaults',
'rebasekeepdate'):
opts['date'] = currentdate()
if opts.get('continue') or opts.get('abort') or opts.get('restack'):
return orig(ui, repo, **opts)
# 'hg rebase' w/o args should do nothing
if not opts.get('dest'):
raise error.Abort("you must specify a destination (-d) for the rebase")
# 'hg rebase' can fast-forward bookmark
prev = repo['.']
dest = scmutil.revsingle(repo, opts.get('dest'))
# Only fast-forward the bookmark if no source nodes were explicitly
# specified.
if not (opts.get('base') or opts.get('source') or opts.get('rev')):
common = dest.ancestor(prev)
if prev == common:
result = hg.update(repo, dest.node())
if bmactive(repo):
with repo.wlock():
bookmarks.update(repo, [prev.node()], dest.node())
return result
return orig(ui, repo, **opts)
示例6: perfmanifest
def perfmanifest(ui, repo, rev):
ctx = scmutil.revsingle(repo, rev, rev)
t = ctx.manifestnode()
def d():
repo.manifest._mancache.clear()
repo.manifest._cache = None
repo.manifest.read(t)
timer(d)
示例7: perfmanifest
def perfmanifest(ui, repo, rev, **opts):
timer, fm = gettimer(ui, opts)
ctx = scmutil.revsingle(repo, rev, rev)
t = ctx.manifestnode()
def d():
repo.manifest.clearcaches()
repo.manifest.read(t)
timer(d)
fm.end()
示例8: resolveonto
def resolveonto(repo, ontoarg):
try:
if ontoarg != donotrebasemarker:
return scmutil.revsingle(repo, ontoarg)
except error.RepoLookupError:
# Probably a new bookmark. Leave onto as None to not do any rebasing
pass
# onto is None means don't do rebasing
return None
示例9: gverify
def gverify(ui, repo, **opts):
'''verify that a Mercurial rev matches the corresponding Git rev
Given a Mercurial revision that has a corresponding Git revision in the map,
this attempts to answer whether that revision has the same contents as the
corresponding Git revision.
'''
ctx = scmutil.revsingle(repo, opts.get('rev'), '.')
return verify.verify(ui, repo, ctx)
示例10: bookmark
def bookmark(ui, repoagent, *names, **opts):
"""add or remove a movable marker"""
from tortoisehg.hgqt import bookmark as bookmarkmod
repo = repoagent.rawRepo()
rev = scmutil.revsingle(repo, opts.get('rev')).rev()
if len(names) > 1:
raise util.Abort(_('only one new bookmark name allowed'))
dlg = bookmarkmod.BookmarkDialog(repoagent, rev)
if names:
dlg.setBookmarkName(hglib.tounicode(names[0]))
return dlg
示例11: merge
def merge(ui, repoagent, *pats, **opts):
"""merge wizard"""
from tortoisehg.hgqt import merge as mergemod
rev = opts.get('rev') or None
if not rev and len(pats):
rev = pats[0]
if not rev:
raise util.Abort(_('Merge revision not specified or not found'))
repo = repoagent.rawRepo()
rev = scmutil.revsingle(repo, rev).rev()
return mergemod.MergeDialog(repoagent, rev)
示例12: perfmergecalculate
def perfmergecalculate(ui, repo, rev):
wctx = repo[None]
rctx = scmutil.revsingle(repo, rev, rev)
ancestor = wctx.ancestor(rctx)
# we don't want working dir files to be stat'd in the benchmark, so prime
# that cache
wctx.dirty()
def d():
# acceptremote is True because we don't want prompts in the middle of
# our benchmark
merge.calculateupdates(repo, wctx, rctx, ancestor, False, False, False,
acceptremote=True)
timer(d)
示例13: filelog
def filelog(ui, repoagent, *pats, **opts):
"""show history of the specified file"""
from tortoisehg.hgqt import filedialogs
if len(pats) != 1:
raise util.Abort(_('requires a single filename'))
repo = repoagent.rawRepo()
rev = scmutil.revsingle(repo, opts.get('rev')).rev()
filename = hglib.canonpaths(pats)[0]
if opts.get('compare'):
dlg = filedialogs.FileDiffDialog(repoagent, filename)
else:
dlg = filedialogs.FileLogDialog(repoagent, filename)
dlg.goto(rev)
return dlg
示例14: debugbuildannotatecache
def debugbuildannotatecache(ui, repo, *pats, **opts):
"""incrementally build fastannotate cache up to REV for specified files
If REV is not specified, use the config 'fastannotate.mainbranch'.
If fastannotate.client is True, download the annotate cache from the
server. Otherwise, build the annotate cache locally.
The annotate cache will be built using the default diff and follow
options and lives in '.hg/fastannotate/default'.
"""
rev = opts.get('REV') or ui.config('fastannotate', 'mainbranch')
if not rev:
raise error.Abort(_('you need to provide a revision'),
hint=_('set fastannotate.mainbranch or use --rev'))
if ui.configbool('fastannotate', 'unfilteredrepo', True):
repo = repo.unfiltered()
ctx = scmutil.revsingle(repo, rev)
m = scmutil.match(ctx, pats, opts)
paths = list(ctx.walk(m))
if util.safehasattr(repo, 'prefetchfastannotate'):
# client
if opts.get('REV'):
raise error.Abort(_('--rev cannot be used for client'))
repo.prefetchfastannotate(paths)
else:
# server, or full repo
for i, path in enumerate(paths):
ui.progress(_('building'), i, total=len(paths))
with facontext.annotatecontext(repo, path) as actx:
try:
if actx.isuptodate(rev):
continue
actx.annotate(rev, rev)
except (faerror.CannotReuseError, faerror.CorruptedFileError):
# the cache is broken (could happen with renaming so the
# file history gets invalidated). rebuild and try again.
ui.debug('fastannotate: %s: rebuilding broken cache\n'
% path)
actx.rebuild()
try:
actx.annotate(rev, rev)
except Exception as ex:
# possibly a bug, but should not stop us from building
# cache for other files.
ui.warn(_('fastannotate: %s: failed to '
'build cache: %r\n') % (path, ex))
# clear the progress bar
ui.write()
示例15: backout
def backout(ui, repoagent, *pats, **opts):
"""backout tool"""
from tortoisehg.hgqt import backout as backoutmod
if opts.get('rev'):
rev = opts.get('rev')
elif len(pats) == 1:
rev = pats[0]
else:
rev = 'tip'
repo = repoagent.rawRepo()
rev = scmutil.revsingle(repo, rev).rev()
msg = backoutmod.checkrev(repo, rev)
if msg:
raise util.Abort(hglib.fromunicode(msg))
return backoutmod.BackoutDialog(repoagent, rev)