[PATCH] drop {short,hex}(ctx.node()) calls in favor of ctx methods
Alexander Solovyov
alexander at solovyov.net
Sat Apr 30 05:59:50 CDT 2011
# HG changeset patch
# User Alexander Solovyov <alexander at solovyov.net>
# Date 1304160907 -7200
# Node ID a3d483ca1f03bf0d7348c07d151cc39c7328de72
# Parent 14352d74764bdae41066670c0347822eb9ace88c
drop {short,hex}(ctx.node()) calls in favor of ctx methods
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -351,13 +351,12 @@ def bisect(ui, repo, rev=None, extra=Non
else:
ui.write(_("The first bad revision is:\n"))
displayer.show(repo[nodes[0]])
- parents = repo[nodes[0]].parents()
extendnode = extendbisectrange(nodes, good)
if extendnode is not None:
ui.write(_('Not all ancestors of this changeset have been'
' checked.\nUse bisect --extend to continue the '
'bisection from\nthe common ancestor, %s.\n')
- % short(extendnode.node()))
+ % str(extendnode))
else:
# multiple possible revisions
if good:
@@ -459,7 +458,7 @@ def bisect(ui, repo, rev=None, extra=Non
extendnode = extendbisectrange(nodes, good)
if extendnode is not None:
ui.write(_("Extending search to changeset %d:%s\n"
- % (extendnode.rev(), short(extendnode.node()))))
+ % (extendnode.rev(), str(extendnode))))
if noupdate:
return
cmdutil.bail_if_changed(repo)
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -80,7 +80,7 @@ def _filerevision(web, tmpl, fctx):
path=webutil.up(f),
text=lines(),
rev=fctx.rev(),
- node=hex(fctx.node()),
+ node=fctx.hex(),
author=fctx.user(),
date=fctx.date(),
desc=fctx.description(),
@@ -239,7 +239,7 @@ def changelog(web, req, tmpl, shortlog=F
changenav = webutil.revnavgen(pos, revcount, count, web.repo.changectx)
return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav,
- node=hex(ctx.node()), rev=pos, changesets=count,
+ node=ctx.hex(), rev=pos, changesets=count,
entries=lambda **x: changelist(limit=0,**x),
latestentry=lambda **x: changelist(limit=1,**x),
archives=web.archivelist("tip"), revcount=revcount,
@@ -582,7 +582,7 @@ def annotate(web, req, tmpl):
last = fnode
yield {"parity": parity.next(),
- "node": hex(f.node()),
+ "node": f.hex(),
"rev": f.rev(),
"author": f.user(),
"desc": f.description(),
@@ -598,7 +598,7 @@ def annotate(web, req, tmpl):
annotate=annotate,
path=webutil.up(f),
rev=fctx.rev(),
- node=hex(fctx.node()),
+ node=fctx.hex(),
author=fctx.user(),
date=fctx.date(),
desc=fctx.description(),
@@ -655,7 +655,7 @@ def filelog(web, req, tmpl):
l.insert(0, {"parity": parity.next(),
"filerev": i,
"file": f,
- "node": hex(iterfctx.node()),
+ "node": iterfctx.hex(),
"author": iterfctx.user(),
"date": iterfctx.date(),
"rename": webutil.renamelink(iterfctx),
@@ -677,7 +677,7 @@ def filelog(web, req, tmpl):
nodefunc = lambda x: fctx.filectx(fileid=x)
nav = webutil.revnavgen(end - 1, revcount, count, nodefunc)
- return tmpl("filelog", file=f, node=hex(fctx.node()), nav=nav,
+ return tmpl("filelog", file=f, node=fctx.hex(), nav=nav,
entries=lambda **x: entries(limit=0, **x),
latestentry=lambda **x: entries(limit=1, **x),
revcount=revcount, morevars=morevars, lessvars=lessvars)
@@ -762,7 +762,7 @@ def graph(web, req, tmpl):
for (id, type, ctx, vtx, edges) in tree:
if type != graphmod.CHANGESET:
continue
- node = short(ctx.node())
+ node = str(ctx)
age = templatefilters.age(ctx.date())
desc = templatefilters.firstline(ctx.description())
desc = cgi.escape(templatefilters.nonempty(desc))
@@ -790,8 +790,6 @@ def help(web, req, tmpl):
topicname = req.form.get('node', [None])[0]
if not topicname:
- topic = []
-
def topics(**map):
for entries, summary, _ in helpmod.helptable:
entries = sorted(entries, key=len)
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -66,7 +66,7 @@ def _siblings(siblings=[], hiderev=None)
if len(siblings) == 1 and siblings[0].rev() == hiderev:
return
for s in siblings:
- d = {'node': hex(s.node()), 'rev': s.rev()}
+ d = {'node': s.hex(), 'rev': s.rev()}
d['user'] = s.user()
d['date'] = s.date()
d['description'] = s.description()
More information about the Mercurial-devel
mailing list