Mercurial > hg
changeset 28378:96a7368a79b6
shelve: use absolute_import
author | timeless <timeless@mozdev.org> |
---|---|
date | Wed, 02 Mar 2016 21:30:51 +0000 |
parents | 81ad683278b8 |
children | 27a9032374a7 |
files | hgext/shelve.py tests/test-check-py3-compat.t |
diffstat | 2 files changed, 38 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/shelve.py Wed Mar 02 21:26:36 2016 +0000 +++ b/hgext/shelve.py Wed Mar 02 21:30:51 2016 +0000 @@ -20,17 +20,36 @@ shelved change has a distinct name. For details, see the help for "hg shelve". """ +from __future__ import absolute_import import collections +import errno import itertools +from mercurial import ( + bundle2, + bundlerepo, + changegroup, + cmdutil, + commands, + error, + exchange, + hg, + lock as lockmod, + mdiff, + merge, + node as nodemod, + patch, + phases, + repair, + scmutil, + templatefilters, + util, +) from mercurial.i18n import _ -from mercurial.node import nullid, nullrev, bin, hex -from mercurial import changegroup, cmdutil, scmutil, phases, commands -from mercurial import error, hg, mdiff, merge, patch, repair, util -from mercurial import templatefilters, exchange, bundlerepo, bundle2 -from mercurial import lock as lockmod -from hgext import rebase -import errno + +from . import ( + rebase, +) cmdtable = {} command = cmdutil.command(cmdtable) @@ -146,15 +165,15 @@ name = fp.readline().strip() wctx = fp.readline().strip() pendingctx = fp.readline().strip() - parents = [bin(h) for h in fp.readline().split()] - stripnodes = [bin(h) for h in fp.readline().split()] + parents = [nodemod.bin(h) for h in fp.readline().split()] + stripnodes = [nodemod.bin(h) for h in fp.readline().split()] finally: fp.close() obj = cls() obj.name = name - obj.wctx = repo[bin(wctx)] - obj.pendingctx = repo[bin(pendingctx)] + obj.wctx = repo[nodemod.bin(wctx)] + obj.pendingctx = repo[nodemod.bin(pendingctx)] obj.parents = parents obj.stripnodes = stripnodes @@ -165,10 +184,12 @@ fp = repo.vfs(cls._filename, 'wb') fp.write('%i\n' % cls._version) fp.write('%s\n' % name) - fp.write('%s\n' % hex(originalwctx.node())) - fp.write('%s\n' % hex(pendingctx.node())) - fp.write('%s\n' % ' '.join([hex(p) for p in repo.dirstate.parents()])) - fp.write('%s\n' % ' '.join([hex(n) for n in stripnodes])) + fp.write('%s\n' % nodemod.hex(originalwctx.node())) + fp.write('%s\n' % nodemod.hex(pendingctx.node())) + fp.write('%s\n' % + ' '.join([nodemod.hex(p) for p in repo.dirstate.parents()])) + fp.write('%s\n' % + ' '.join([nodemod.hex(n) for n in stripnodes])) fp.close() @classmethod @@ -233,7 +254,7 @@ """return all mutable ancestors for ctx (included) Much faster than the revset ancestors(ctx) & draft()""" - seen = set([nullrev]) + seen = set([nodemod.nullrev]) visit = collections.deque() visit.append(ctx) while visit: @@ -264,7 +285,7 @@ for i in xrange(1, 100): yield '%s-%02d' % (label, i) - if parent.node() != nullid: + if parent.node() != nodemod.nullid: desc = "changes to: %s" % parent.description().split('\n', 1)[0] else: desc = '(changes in empty repository)'
--- a/tests/test-check-py3-compat.t Wed Mar 02 21:26:36 2016 +0000 +++ b/tests/test-check-py3-compat.t Wed Mar 02 21:30:51 2016 +0000 @@ -62,7 +62,6 @@ hgext/relink.py not using absolute_import hgext/schemes.py not using absolute_import hgext/share.py not using absolute_import - hgext/shelve.py not using absolute_import hgext/transplant.py not using absolute_import hgext/win32mbcs.py not using absolute_import hgext/win32text.py not using absolute_import