[PATCH 1 of 3] committablectx: override __int__ to return integer next to tip

Yuya Nishihara yuya at tcha.org
Fri Apr 10 22:56:29 CDT 2015


On Fri, 10 Apr 2015 15:08:40 -0500, Matt Mackall wrote:
> On Fri, 2015-04-10 at 23:54 +0900, Yuya Nishihara wrote:
> > # HG changeset patch
> > # User Yuya Nishihara <yuya at tcha.org>
> > # Date 1428154731 -32400
> > #      Sat Apr 04 22:38:51 2015 +0900
> > # Node ID 7b7efec2eafba7dde274316eb3c18a98ec6528b1
> > # Parent  e0e28e910fa3797fd0aa4f818e9b33c5bcbf0e53
> > committablectx: override __int__ to return integer next to tip
> 
> Postscript: I see that normal contexts already have __int__.. which may
> be a mistake. Do we use it anywhere?

Yes.

% grep ctx **/*.py | grep 'int(\|%d' | grep -v 'rev()' | grep -v 'repo\.\(set\|revs\)'
...
mercurial/cmdutil.py:        repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
mercurial/cmdutil.py:        repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
mercurial/commands.py:                ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition))
mercurial/templatekw.py:    childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]


More information about the Mercurial-devel mailing list