Show More
@@ -21,13 +21,8 b' shelved change has a distinct name. For ' | |||||
21 | shelve". |
|
21 | shelve". | |
22 | """ |
|
22 | """ | |
23 |
|
23 | |||
24 | try: |
|
|||
25 | import cPickle as pickle |
|
|||
26 | pickle.dump # import now |
|
|||
27 | except ImportError: |
|
|||
28 | import pickle |
|
|||
29 | from mercurial.i18n import _ |
|
24 | from mercurial.i18n import _ | |
30 | from mercurial.node import nullid |
|
25 | from mercurial.node import nullid, bin, hex | |
31 | from mercurial import changegroup, cmdutil, scmutil, phases |
|
26 | from mercurial import changegroup, cmdutil, scmutil, phases | |
32 | from mercurial import error, hg, mdiff, merge, patch, repair, util |
|
27 | from mercurial import error, hg, mdiff, merge, patch, repair, util | |
33 | from mercurial import templatefilters |
|
28 | from mercurial import templatefilters | |
@@ -88,11 +83,17 b' class shelvedstate(object):' | |||||
88 | @classmethod |
|
83 | @classmethod | |
89 | def load(cls, repo): |
|
84 | def load(cls, repo): | |
90 | fp = repo.opener(cls._filename) |
|
85 | fp = repo.opener(cls._filename) | |
91 | (version, name, parents, stripnodes) = pickle.load(fp) |
|
86 | try: | |
|
87 | version = int(fp.readline().strip()) | |||
92 |
|
88 | |||
93 | if version != cls._version: |
|
89 | if version != cls._version: | |
94 | raise util.Abort(_('this version of shelve is incompatible ' |
|
90 | raise util.Abort(_('this version of shelve is incompatible ' | |
95 | 'with the version used in this repo')) |
|
91 | 'with the version used in this repo')) | |
|
92 | name = fp.readline().strip() | |||
|
93 | parents = [bin(h) for h in fp.readline().split()] | |||
|
94 | stripnodes = [bin(h) for h in fp.readline().split()] | |||
|
95 | finally: | |||
|
96 | fp.close() | |||
96 |
|
97 | |||
97 | obj = cls() |
|
98 | obj = cls() | |
98 | obj.name = name |
|
99 | obj.name = name | |
@@ -104,9 +105,10 b' class shelvedstate(object):' | |||||
104 | @classmethod |
|
105 | @classmethod | |
105 | def save(cls, repo, name, stripnodes): |
|
106 | def save(cls, repo, name, stripnodes): | |
106 | fp = repo.opener(cls._filename, 'wb') |
|
107 | fp = repo.opener(cls._filename, 'wb') | |
107 |
p |
|
108 | fp.write('%i\n' % cls._version) | |
108 | repo.dirstate.parents(), |
|
109 | fp.write('%s\n' % name) | |
109 | stripnodes), fp) |
|
110 | fp.write('%s\n' % ' '.join([hex(p) for p in repo.dirstate.parents()])) | |
|
111 | fp.write('%s\n' % ' '.join([hex(n) for n in stripnodes])) | |||
110 | fp.close() |
|
112 | fp.close() | |
111 |
|
113 | |||
112 | @staticmethod |
|
114 | @staticmethod |
General Comments 0
You need to be logged in to leave comments.
Login now