drop {short,hex}(ctx.node()) calls in favor of ctx methods
authorAlexander Solovyov <alexander@solovyov.net>
Sat, 30 Apr 2011 12:55:07 +0200
changeset 14055 421d56a055fd
parent 14054 3c616f512a5b
child 14056 bcfe78c3d15c
drop {short,hex}(ctx.node()) calls in favor of ctx methods
mercurial/commands.py
mercurial/hgweb/webcommands.py
mercurial/hgweb/webutil.py
--- a/mercurial/commands.py	Fri Apr 29 22:21:13 2011 +0300
+++ b/mercurial/commands.py	Sat Apr 30 12:55:07 2011 +0200
@@ -351,13 +351,12 @@
             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()))
+                         % extendnode)
         else:
             # multiple possible revisions
             if good:
@@ -459,7 +458,7 @@
             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(), extendnode)))
                 if noupdate:
                     return
                 cmdutil.bail_if_changed(repo)
--- a/mercurial/hgweb/webcommands.py	Fri Apr 29 22:21:13 2011 +0300
+++ b/mercurial/hgweb/webcommands.py	Sat Apr 30 12:55:07 2011 +0200
@@ -80,7 +80,7 @@
                 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 @@
     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 @@
                 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 @@
                 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 @@
             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 @@
 
     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 @@
     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 @@
 
     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)
--- a/mercurial/hgweb/webutil.py	Fri Apr 29 22:21:13 2011 +0300
+++ b/mercurial/hgweb/webutil.py	Sat Apr 30 12:55:07 2011 +0200
@@ -66,7 +66,7 @@
     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()