##// END OF EJS Templates
mq: gracefully handle malformated status file...
Pierre-Yves David -
r13507:375ba42f stable
parent child Browse files
Show More
@@ -282,11 +282,17 b' class queue(object):'
282 282 @util.propertycache
283 283 def applied(self):
284 284 if os.path.exists(self.join(self.status_path)):
285 def parse(l):
286 n, name = l.split(':', 1)
287 return statusentry(bin(n), name)
285 def parselines(lines):
286 for l in lines:
287 entry = l.split(':', 1)
288 if len(entry) > 1:
289 n, name = entry
290 yield statusentry(bin(n), name)
291 elif l.strip():
292 self.ui.warn(_('malformated mq status line: %s\n') % entry)
293 # else we ignore empty lines
288 294 lines = self.opener(self.status_path).read().splitlines()
289 return [parse(l) for l in lines]
295 return list(parselines(lines))
290 296 return []
291 297
292 298 @util.propertycache
@@ -917,6 +917,25 b' bad node in status'
917 917 copy to copy
918 918 $ cd ..
919 919
920 empty lines in status
921
922 $ hg init emptystatus
923 $ cd emptystatus
924 $ hg qinit
925 $ printf '\n\n' > .hg/patches/status
926 $ hg qser
927 $ cd ..
928
929 bad line in status (without ":")
930
931 $ hg init badstatus
932 $ cd badstatus
933 $ hg qinit
934 $ printf 'babar has no colon in this line\n' > .hg/patches/status
935 $ hg qser
936 malformated mq status line: ['babar has no colon in this line']
937 $ cd ..
938
920 939
921 940 test file addition in slow path
922 941
General Comments 0
You need to be logged in to leave comments. Login now