##// END OF EJS Templates
dirstate: warn on invalid parents rather than aborting...
Matt Mackall -
r13032:e41e2b79 default
parent child Browse files
Show More
@@ -348,14 +348,12 b' def reposetup(ui, repo):'
348 348 return result
349 349
350 350 def addchangegroup(self, *args, **kwargs):
351 parents = self.dirstate.parents()
352
353 351 result = super(bookmark_repo, self).addchangegroup(*args, **kwargs)
354 352 if result > 1:
355 353 # We have more heads than before
356 354 return result
357 355 node = self.changelog.tip()
358
356 parents = self.dirstate.parents()
359 357 self._bookmarksupdate(parents, node)
360 358 return result
361 359
@@ -36,7 +36,7 b' def _decdirs(dirs, path):'
36 36
37 37 class dirstate(object):
38 38
39 def __init__(self, opener, ui, root):
39 def __init__(self, opener, ui, root, validate):
40 40 '''Create a new dirstate object.
41 41
42 42 opener is an open()-like callable that can be used to open the
@@ -44,6 +44,7 b' class dirstate(object):'
44 44 the dirstate.
45 45 '''
46 46 self._opener = opener
47 self._validate = validate
47 48 self._root = root
48 49 self._rootdir = os.path.join(root, '')
49 50 self._dirty = False
@@ -197,7 +198,7 b' class dirstate(object):'
197 198 yield x
198 199
199 200 def parents(self):
200 return self._pl
201 return [self._validate(p) for p in self._pl]
201 202
202 203 def branch(self):
203 204 return self._branch
@@ -178,7 +178,19 b' class localrepository(repo.repository):'
178 178
179 179 @propertycache
180 180 def dirstate(self):
181 return dirstate.dirstate(self.opener, self.ui, self.root)
181 warned = [0]
182 def validate(node):
183 try:
184 r = self.changelog.rev(node)
185 return node
186 except error.LookupError:
187 if not warned[0]:
188 warned[0] = True
189 self.ui.warn(_("warning: ignoring unknown"
190 " working parent %s!\n" % short(node)))
191 return nullid
192
193 return dirstate.dirstate(self.opener, self.ui, self.root, validate)
182 194
183 195 def __getitem__(self, changeid):
184 196 if changeid is None:
General Comments 0
You need to be logged in to leave comments. Login now