diff mercurial/dirstate.py @ 13032:e41e2b79883d

dirstate: warn on invalid parents rather than aborting This allows more graceful recovery from some mangled dirstates
author Matt Mackall <mpm@selenic.com>
date Mon, 22 Nov 2010 12:43:31 -0600
parents e255a5dc29e6
children 6c375e07d673
line wrap: on
line diff
--- a/mercurial/dirstate.py	Mon Nov 22 18:15:58 2010 +0100
+++ b/mercurial/dirstate.py	Mon Nov 22 12:43:31 2010 -0600
@@ -36,7 +36,7 @@
 
 class dirstate(object):
 
-    def __init__(self, opener, ui, root):
+    def __init__(self, opener, ui, root, validate):
         '''Create a new dirstate object.
 
         opener is an open()-like callable that can be used to open the
@@ -44,6 +44,7 @@
         the dirstate.
         '''
         self._opener = opener
+        self._validate = validate
         self._root = root
         self._rootdir = os.path.join(root, '')
         self._dirty = False
@@ -197,7 +198,7 @@
             yield x
 
     def parents(self):
-        return self._pl
+        return [self._validate(p) for p in self._pl]
 
     def branch(self):
         return self._branch