本文整理汇总了Python中mercurial.commands.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: urls
def urls(ui, repo, *paths, **opts):
'''Display a list of urls for the last several commits.
These are merely heuristic guesses and are intended for pasting into
bugs after landing. If that makes no sense to you, then you are probably
not the intended audience. It's mainly a Mozilla thing.
Note that this will display the URL for your default repo, which may very
well be something local. So you may need to give your outbound repo as
an argument.
'''
opts['template'] = '{node|short} {desc|firstline}\n'
ui.pushbuffer()
commands.log(ui, repo, **opts)
lines = ui.popbuffer()
if len(paths) == 0:
paths = ['default']
ui.pushbuffer()
commands.paths(ui, repo, *paths)
url = ui.popbuffer().rstrip()
url = re.sub(r'^\w+', 'http', url)
url = re.sub(r'(\w|\%|\.|-)+\@', '', url) # Remove usernames
for line in lines.split('\n'):
if len(line) > 0:
rev, desc = line.split(' ', 1)
ui.write(url + '/rev/' + rev + '\n ' + desc + '\n\n')
开发者ID:Nephyrin,项目名称:bzexport,代码行数:26,代码来源:__init__.py
示例2: list_commits
def list_commits(self, branch):
if self.vcs_type == 'git':
branch = branch or 'HEAD'
# using walker and a ref (branch)
branches = self.r.get_refs()
if branch not in branches:
branch = 'HEAD'
if branch in branches:
w = self.r.get_walker([self.r.refs[branch]])
#w = r.get_walker([r.refs['refs/heads/sqlite']])
l = [x.commit for x in w]
else:
l = ["Nothing has yet been done on your repo..."]
elif self.vcs_type == 'hg':
branch = branch or 'default'
branches = self.r.branchmap().keys()
if branch not in branches:
branch = 'default'
#if s['branch'] not in branches:
try:
self.ui.pushbuffer()
hg.log(self.ui, self.r, branch=[branch])
l = self.ui.popbuffer().split('\n\n')
except:
branch = 'default'
l = ["Nothing has yet been done on your repo..."]
return branch, l
开发者ID:PierrePaul,项目名称:Orgapp,代码行数:27,代码来源:repo.py
示例3: test_svn_revsets
def test_svn_revsets(self):
repo = self._load_fixture_and_fetch('two_revs.svndump')
# we want one commit that isn't from Subversion
self.commitchanges([('foo', 'foo', 'frobnicate\n')])
defaults = {'date': None, 'rev': ['fromsvn()'], 'user': None}
ui = CapturingUI()
commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults)
self.assertEqual(ui._output, '0:2 1:3 ')
defaults = {'date': None, 'rev': ['svnrev(2)'], 'user': None}
ui = CapturingUI()
commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults)
self.assertEqual(ui._output, '0:2 ')
defaults = {'date': None, 'rev': ['fromsvn(1)'], 'user': None}
self.assertRaises(error.ParseError,
commands.log, self.ui(), repo,
template='{rev}:{svnrev} ', **defaults)
defaults = {'date': None, 'rev': ['svnrev(1, 2)'], 'user': None}
self.assertRaises(error.ParseError,
commands.log, self.ui(), repo,
template='{rev}:{svnrev} ', **defaults)
开发者ID:fuzzball81,项目名称:dotfiles,代码行数:29,代码来源:test_template_keywords.py
示例4: get_version_info
def get_version_info(data_dir, path, info_encoding):
"""
Obtains information about a file via Mercurial Python API
arguments:
data_dir -- path to a Mercurial repository (= riki data directory)
path -- a file we want log information about
info_encoding -- encoding used on data fetched from hg (system dependent)
returns:
a dictionary {'date': str, 'user': str, 'changeset': str, 'summary' : str}
"""
from mercurial import commands, ui, hg, error
if type(path) is unicode: # mercurial API does not like unicode path
path = path.encode('utf-8')
ans = {}
try:
repo = hg.repository(ui.ui(), data_dir)
repo.ui.pushbuffer()
commands.log(repo.ui, repo, path)
output = repo.ui.popbuffer()
for item in re.split(r'\n', output):
srch = re.match(r'^(\w+):\s+(.+)$', item)
if srch:
v = srch.groups()[1]
ans[srch.groups()[0]] = v if info_encoding.lower() == 'utf-8' else v.decode(info_encoding)
except error.Abort as e:
logging.getLogger(__name__).warning('Failed to fetch version info about [%s]: %s' % (path, e))
if 'user' not in ans:
ans['user'] = 'unknown'
return ans
开发者ID:tomachalek,项目名称:riki,代码行数:32,代码来源:files.py
示例5: hg_log
def hg_log():
opts = { 'template': '{rev} {desc}\n', 'rev': None, 'date': None, 'user': None }
_ui.pushbuffer()
commands.log(_ui, get_sandbox_repo(), **opts)
output = _ui.popbuffer()
return output
开发者ID:Aican,项目名称:dotfiles-1,代码行数:8,代码来源:util.py
示例6: get_revision_before_date
def get_revision_before_date(self, date):
datestr = "<%s" % self.date_as_string(date)
branch = self.repo[None].branch()
self.ui.pushbuffer()
commands.log(self.ui, self.repo, branch=[branch], template="{node}\n", date=datestr, rev='', user='', limit=10)
hexids = self.ui.popbuffer()
#loop over up to 10 changesets to find first non-bogus one
for hexid in hexids.split():
if not self.changeset_is_bogus(self.repo[hexid]):
return hexid.strip()
return None
开发者ID:markdrago,项目名称:caboose,代码行数:12,代码来源:mercurial_repository.py
示例7: log
def log(self, filename):
self.hgui.pushbuffer()
commands.log(self.hgui, self.repo, filename, follow=True, date="", rev="", user="")
_log=self.hgui.popbuffer()
changesets=[_c for _c in _log.split('\n\n') if _c not in ('')]
history=[]
for changeset in changesets:
_dict={}
for _f in changeset.split("\n"):
kkk, vvv=_f.split(": ")
_dict[kkk.strip()]=vvv.strip()
history.append(_dict)
return history
开发者ID:hftsai,项目名称:gulon-soft,代码行数:14,代码来源:hghistory.py
示例8: security_check
def security_check(ui, repo, **kwargs):
ui.debug("running security_check\n")
error = False
ui.pushbuffer()
_quiet(
ui,
lambda: commands.log(
ui, repo, rev=["%s:tip" % kwargs["node"]], template="{node}\n", date=None, user=None, logfile=None
),
)
nodes = ui.popbuffer().split("\n")
# reenable this code if we need to blacklist a node
for node in nodes:
if node.startswith("8555e8551203") or node.startswith("e09bb3ece6c7"):
ui.warn("blacklisted changeid found: node %s is blacklisted\n" % node)
error = True # fail the push
# Look for blacklisted bugs
blacklist = [
# Serrano
580489,
604354,
# Wasabi
507624,
# Cyril
570049,
628834,
]
bugs = re.compile("(%s)" % "|".join([str(bug) for bug in blacklist]))
ui.pushbuffer()
_quiet(
ui,
lambda: commands.log(
ui, repo, rev=["%s:tip" % kwargs["node"]], template="{desc}", date=None, user=None, logfile=None
),
)
descs = ui.popbuffer()
searchDescs = bugs.search(descs)
if searchDescs:
ui.warn("blacklisted bug found: %s\n" % searchDescs.groups()[0])
error = True
return error
开发者ID:Nephyrin,项目名称:bzexport,代码行数:48,代码来源:tamarin-hook.py
示例9: perflog
def perflog(ui, repo, **opts):
timer, fm = gettimer(ui, opts)
ui.pushbuffer()
timer(lambda: commands.log(ui, repo, rev=[], date='', user='',
copies=opts.get('rename')))
ui.popbuffer()
fm.end()
开发者ID:CSCI-362-02-2015,项目名称:RedTeam,代码行数:7,代码来源:perf.py
示例10: perftemplating
def perftemplating(ui, repo, **opts):
timer, fm = gettimer(ui, opts)
ui.pushbuffer()
timer(lambda: commands.log(ui, repo, rev=[], date='', user='',
template='{date|shortdate} [{rev}:{node|short}]'
' {author|person}: {desc|firstline}\n'))
ui.popbuffer()
fm.end()
开发者ID:CSCI-362-02-2015,项目名称:RedTeam,代码行数:8,代码来源:perf.py
示例11: getLog
def getLog(_ui, srepo, opts):
_ui.pushbuffer()
try:
commands.log(_ui, srepo, **opts)
logOutput = _ui.popbuffer()
except error.ParseError, e:
# Some mercurial versions have a bug that results in
# saving a subrepo node id in the .hgsubstate file
# which ends with a "+" character. If that is the
# case, add a warning to the output, but try to
# get the revision information anyway
logOutput = ''
for n, rev in enumerate(opts['rev']):
if rev.endswith('+'):
logOutput += _('[WARNING] Invalid subrepo '
'revision ID:\n\t%s\n\n') % rev
opts['rev'][n] = rev[:-1]
commands.log(_ui, srepo, **opts)
logOutput += _ui.popbuffer()
开发者ID:velorientc,项目名称:git_test7,代码行数:19,代码来源:filedata.py
示例12: glog
def glog(ui, repo, *pats, **opts):
"""show revision history alongside an ASCII revision graph
Print a revision history alongside a revision graph drawn with
ASCII characters.
Nodes printed as an @ character are parents of the working
directory.
"""
opts['graph'] = True
return commands.log(ui, repo, *pats, **opts)
开发者ID:Distrotech,项目名称:mercurial,代码行数:11,代码来源:graphlog.py
示例13: rhlog
def rhlog(ui, repo, *pats, **opts):
rev = opts.pop('rev')
bra0 = opts.pop('branch')
from_rev = urllib.unquote_plus(opts.pop('from', None))
to_rev = urllib.unquote_plus(opts.pop('to' , None))
bra = urllib.unquote_plus(opts.pop('rhbranch', None))
from_rev = from_rev.replace('"', '\\"')
to_rev = to_rev.replace('"', '\\"')
opts['rev'] = ['"%s":"%s"' % (from_rev, to_rev)]
opts['branch'] = [bra]
return commands.log(ui, repo, *map(urllib.unquote_plus, pats), **opts)
开发者ID:101studio,项目名称:redmine,代码行数:11,代码来源:redminehelper.py
示例14: _getLog
def _getLog(self, limit=None):
"""Read log entries into a list of dictionaries."""
self.ui.pushbuffer()
commands.log(self.ui, self.repo, limit=limit, date=None, rev=None, user=None)
res = self.ui.popbuffer().strip()
logList = []
for logentry in res.split("\n\n"):
log = {}
logList.append(log)
for line in logentry.split("\n"):
k, v = line.split(":", 1)
assert k in ("changeset", "tag", "user", "date", "summary")
log[k.strip()] = v.strip()
log["parsed_date"] = util.parseTimeString(log["date"])
local_id, unid = log["changeset"].split(":")
log["local_id"] = int(local_id)
log["unid"] = unid
# pprint(logList)
return logList
开发者ID:CVL-GitHub,项目名称:cvl-fabric-launcher,代码行数:20,代码来源:hg_dav_provider.py
示例15: hg_commits
def hg_commits(filename):
face = ui.ui()
repo = hg.repository(face, blog_dir)
location = get_location(filename)
face.pushbuffer()
commands.log(face, repo, os.path.join(blog_dir, location, filename),
date='', rev=[], follow=True,
template="node:{node}\ndesc:{desc}\nmove:{file_copies}\n\n")
output = face.popbuffer()
commit = []
commits = []
for line in output.splitlines():
if line:
commit.append(line.split(':'))
else:
commits.append(dict(commit))
commit = []
return commits
开发者ID:limeburst,项目名称:yak,代码行数:20,代码来源:hg.py
示例16: test_svn_keywords
def test_svn_keywords(self):
defaults = {'date': None, 'rev': None, 'user': None, 'graph': True}
repo = self._load_fixture_and_fetch('two_revs.svndump')
# we want one commit that isn't from Subversion
self.commitchanges([('foo', 'foo', 'frobnicate\n')])
ui = CapturingUI()
commands.log(ui, repo, template=(' rev: {rev} svnrev:{svnrev} '
'svnpath:{svnpath} svnuuid:{svnuuid}\n'),
**defaults)
print ui._output
self.assertEqual(ui._output.strip(), '''
rev: 2 svnrev: svnpath: svnuuid:
@
|
rev: 1 svnrev:3 svnpath:/trunk svnuuid:df2126f7-00ab-4d49-b42c-7e981dde0bcf
o
|
rev: 0 svnrev:2 svnpath:/trunk svnuuid:df2126f7-00ab-4d49-b42c-7e981dde0bcf
o
'''.strip())
开发者ID:fuzzball81,项目名称:dotfiles,代码行数:22,代码来源:test_template_keywords.py
示例17: show
def show(ui, repo, *args, **opts):
"""show revision in detail
This behaves similarly to :hg:`log -vp -r REV [OPTION]... [FILE]...`, or
if called without a REV, :hg:`log -vp -r . [OPTION]...` Use
:hg:`log` for more powerful operations than supported by hg show
See :hg:`help templates` for more about pre-packaged styles and
specifying custom templates.
"""
ui.pager('show')
if len(args) == 0:
opts['rev'] = ['.']
pats = []
else:
opts['rev'] = [args[0]]
pats = args[1:]
if not scmutil.revrange(repo, opts['rev']):
h = _("if %s is a file, try `hg show . %s`") % (args[0], args[0])
raise error.Abort(_("unknown revision %s") % args[0],
hint=h)
opts['patch'] = not opts['stat']
opts['verbose'] = True
# Copy tracking is slow when doing a git diff. Override hgrc, and rely on
# opts getting us a git diff if it's been requested. Ideally, we'd find and
# fix the slowness in copy tracking, but this works for now.
# On a commit with lots of possible copies, Bryan O'Sullivan found that this
# reduces "time hg show" from 1.76 seconds to 0.81 seconds.
overrides = {('diff', 'git'): opts.get('git')
,('diff','unified'):opts.get('unified')
,('ui', 'verbose'): True}
with ui.configoverride(overrides, 'show'):
commands.log(ui, repo, *pats, **opts)
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:36,代码来源:fbshow.py
示例18: test_svn_keywords
def test_svn_keywords(self):
defaults = {'date': None, 'rev': None, 'user': None}
repo = self._load_fixture_and_fetch('two_revs.svndump')
# we want one commit that isn't from Subversion
self.commitchanges([('foo', 'foo', 'frobnicate\n')])
ui = CapturingUI()
commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults)
self.assertEqual(ui._output, '0:2 1:3 2: ')
ui = CapturingUI()
commands.log(ui, repo, template='{rev}:{svnpath} ', **defaults)
self.assertEqual(ui._output, '0:/trunk 1:/trunk 2: ')
ui = CapturingUI()
commands.log(ui, repo, template='{rev}:{svnuuid} ', **defaults)
self.assertEqual(ui._output,
('0:df2126f7-00ab-4d49-b42c-7e981dde0bcf '
'1:df2126f7-00ab-4d49-b42c-7e981dde0bcf '
'2: '))
开发者ID:avuori,项目名称:dotfiles,代码行数:19,代码来源:test_template_keywords.py
示例19: perflog
def perflog(ui, repo):
ui.pushbuffer()
timer(lambda: commands.log(ui, repo, rev=[], date='', user=''))
ui.popbuffer()
开发者ID:wangbiaouestc,项目名称:WindowsMingWMC,代码行数:4,代码来源:perf.py
示例20: qlog
def qlog(ui, repo, **opts):
"""Runs the hg log command for the patch queue repo of a regular repo"""
q = qrepo(ui, repo)
commands.log(ui, q, **opts)
开发者ID:codekoala,项目名称:hgext,代码行数:4,代码来源:qadd.py
注:本文中的mercurial.commands.log函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论