##// END OF EJS Templates
mq: simplify statusentry(), fix restore broken by ee48e5ef8753
Benoit Boissinot -
r10682:8ed35005 default
parent child Browse files
Show More
@@ -54,16 +54,8 b' commands.norepo += " qclone"'
54 normname = util.normpath
54 normname = util.normpath
55
55
56 class statusentry(object):
56 class statusentry(object):
57 def __init__(self, node, name=None):
57 def __init__(self, node, name):
58 if not name:
58 self.node, self.name = node, name
59 fields = node.split(':', 1)
60 if len(fields) == 2:
61 n, name = fields
62 self.node, self.name = bin(n), name
63 else:
64 self.node, self.name = None, None
65 else:
66 self.node, self.name = node, name
67
59
68 def __str__(self):
60 def __str__(self):
69 return hex(self.node) + ':' + self.name
61 return hex(self.node) + ':' + self.name
@@ -269,8 +261,11 b' class queue(object):'
269 @util.propertycache
261 @util.propertycache
270 def applied(self):
262 def applied(self):
271 if os.path.exists(self.join(self.status_path)):
263 if os.path.exists(self.join(self.status_path)):
264 def parse(l):
265 n, name = l.split(':', 1)
266 return statusentry(bin(n), name)
272 lines = self.opener(self.status_path).read().splitlines()
267 lines = self.opener(self.status_path).read().splitlines()
273 return [statusentry(l) for l in lines]
268 return [parse(l) for l in lines]
274 return []
269 return []
275
270
276 @util.propertycache
271 @util.propertycache
@@ -1493,12 +1488,12 b' class queue(object):'
1493 qpp = [bin(x) for x in l]
1488 qpp = [bin(x) for x in l]
1494 elif datastart != None:
1489 elif datastart != None:
1495 l = line.rstrip()
1490 l = line.rstrip()
1496 se = statusentry(l)
1491 try:
1497 file_ = se.name
1492 n, name = l.split(':', 1)
1498 if se.node:
1493 except ValueError:
1499 applied.append(se)
1494 series.append(l)
1500 else: # XXX file_ is equal to None?
1495 else:
1501 series.append(file_)
1496 applied.append(statusentry(bin(n), name))
1502 if datastart is None:
1497 if datastart is None:
1503 self.ui.warn(_("No saved patch data found\n"))
1498 self.ui.warn(_("No saved patch data found\n"))
1504 return 1
1499 return 1
General Comments 0
You need to be logged in to leave comments. Login now