##// END OF EJS Templates
shelve: use absolute_import
timeless -
r28378:96a7368a default
parent child Browse files
Show More
@@ -20,17 +20,36 b' You can have more than one shelved chang'
20 shelved change has a distinct name. For details, see the help for "hg
20 shelved change has a distinct name. For details, see the help for "hg
21 shelve".
21 shelve".
22 """
22 """
23 from __future__ import absolute_import
23
24
24 import collections
25 import collections
26 import errno
25 import itertools
27 import itertools
28 from mercurial import (
29 bundle2,
30 bundlerepo,
31 changegroup,
32 cmdutil,
33 commands,
34 error,
35 exchange,
36 hg,
37 lock as lockmod,
38 mdiff,
39 merge,
40 node as nodemod,
41 patch,
42 phases,
43 repair,
44 scmutil,
45 templatefilters,
46 util,
47 )
26 from mercurial.i18n import _
48 from mercurial.i18n import _
27 from mercurial.node import nullid, nullrev, bin, hex
49
28 from mercurial import changegroup, cmdutil, scmutil, phases, commands
50 from . import (
29 from mercurial import error, hg, mdiff, merge, patch, repair, util
51 rebase,
30 from mercurial import templatefilters, exchange, bundlerepo, bundle2
52 )
31 from mercurial import lock as lockmod
32 from hgext import rebase
33 import errno
34
53
35 cmdtable = {}
54 cmdtable = {}
36 command = cmdutil.command(cmdtable)
55 command = cmdutil.command(cmdtable)
@@ -146,15 +165,15 b' class shelvedstate(object):'
146 name = fp.readline().strip()
165 name = fp.readline().strip()
147 wctx = fp.readline().strip()
166 wctx = fp.readline().strip()
148 pendingctx = fp.readline().strip()
167 pendingctx = fp.readline().strip()
149 parents = [bin(h) for h in fp.readline().split()]
168 parents = [nodemod.bin(h) for h in fp.readline().split()]
150 stripnodes = [bin(h) for h in fp.readline().split()]
169 stripnodes = [nodemod.bin(h) for h in fp.readline().split()]
151 finally:
170 finally:
152 fp.close()
171 fp.close()
153
172
154 obj = cls()
173 obj = cls()
155 obj.name = name
174 obj.name = name
156 obj.wctx = repo[bin(wctx)]
175 obj.wctx = repo[nodemod.bin(wctx)]
157 obj.pendingctx = repo[bin(pendingctx)]
176 obj.pendingctx = repo[nodemod.bin(pendingctx)]
158 obj.parents = parents
177 obj.parents = parents
159 obj.stripnodes = stripnodes
178 obj.stripnodes = stripnodes
160
179
@@ -165,10 +184,12 b' class shelvedstate(object):'
165 fp = repo.vfs(cls._filename, 'wb')
184 fp = repo.vfs(cls._filename, 'wb')
166 fp.write('%i\n' % cls._version)
185 fp.write('%i\n' % cls._version)
167 fp.write('%s\n' % name)
186 fp.write('%s\n' % name)
168 fp.write('%s\n' % hex(originalwctx.node()))
187 fp.write('%s\n' % nodemod.hex(originalwctx.node()))
169 fp.write('%s\n' % hex(pendingctx.node()))
188 fp.write('%s\n' % nodemod.hex(pendingctx.node()))
170 fp.write('%s\n' % ' '.join([hex(p) for p in repo.dirstate.parents()]))
189 fp.write('%s\n' %
171 fp.write('%s\n' % ' '.join([hex(n) for n in stripnodes]))
190 ' '.join([nodemod.hex(p) for p in repo.dirstate.parents()]))
191 fp.write('%s\n' %
192 ' '.join([nodemod.hex(n) for n in stripnodes]))
172 fp.close()
193 fp.close()
173
194
174 @classmethod
195 @classmethod
@@ -233,7 +254,7 b' def _docreatecmd(ui, repo, pats, opts):'
233 """return all mutable ancestors for ctx (included)
254 """return all mutable ancestors for ctx (included)
234
255
235 Much faster than the revset ancestors(ctx) & draft()"""
256 Much faster than the revset ancestors(ctx) & draft()"""
236 seen = set([nullrev])
257 seen = set([nodemod.nullrev])
237 visit = collections.deque()
258 visit = collections.deque()
238 visit.append(ctx)
259 visit.append(ctx)
239 while visit:
260 while visit:
@@ -264,7 +285,7 b' def _docreatecmd(ui, repo, pats, opts):'
264 for i in xrange(1, 100):
285 for i in xrange(1, 100):
265 yield '%s-%02d' % (label, i)
286 yield '%s-%02d' % (label, i)
266
287
267 if parent.node() != nullid:
288 if parent.node() != nodemod.nullid:
268 desc = "changes to: %s" % parent.description().split('\n', 1)[0]
289 desc = "changes to: %s" % parent.description().split('\n', 1)[0]
269 else:
290 else:
270 desc = '(changes in empty repository)'
291 desc = '(changes in empty repository)'
@@ -62,7 +62,6 b''
62 hgext/relink.py not using absolute_import
62 hgext/relink.py not using absolute_import
63 hgext/schemes.py not using absolute_import
63 hgext/schemes.py not using absolute_import
64 hgext/share.py not using absolute_import
64 hgext/share.py not using absolute_import
65 hgext/shelve.py not using absolute_import
66 hgext/transplant.py not using absolute_import
65 hgext/transplant.py not using absolute_import
67 hgext/win32mbcs.py not using absolute_import
66 hgext/win32mbcs.py not using absolute_import
68 hgext/win32text.py not using absolute_import
67 hgext/win32text.py not using absolute_import
General Comments 0
You need to be logged in to leave comments. Login now