##// 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 return result
348 return result
349
349
350 def addchangegroup(self, *args, **kwargs):
350 def addchangegroup(self, *args, **kwargs):
351 parents = self.dirstate.parents()
352
353 result = super(bookmark_repo, self).addchangegroup(*args, **kwargs)
351 result = super(bookmark_repo, self).addchangegroup(*args, **kwargs)
354 if result > 1:
352 if result > 1:
355 # We have more heads than before
353 # We have more heads than before
356 return result
354 return result
357 node = self.changelog.tip()
355 node = self.changelog.tip()
358
356 parents = self.dirstate.parents()
359 self._bookmarksupdate(parents, node)
357 self._bookmarksupdate(parents, node)
360 return result
358 return result
361
359
@@ -36,7 +36,7 b' def _decdirs(dirs, path):'
36
36
37 class dirstate(object):
37 class dirstate(object):
38
38
39 def __init__(self, opener, ui, root):
39 def __init__(self, opener, ui, root, validate):
40 '''Create a new dirstate object.
40 '''Create a new dirstate object.
41
41
42 opener is an open()-like callable that can be used to open the
42 opener is an open()-like callable that can be used to open the
@@ -44,6 +44,7 b' class dirstate(object):'
44 the dirstate.
44 the dirstate.
45 '''
45 '''
46 self._opener = opener
46 self._opener = opener
47 self._validate = validate
47 self._root = root
48 self._root = root
48 self._rootdir = os.path.join(root, '')
49 self._rootdir = os.path.join(root, '')
49 self._dirty = False
50 self._dirty = False
@@ -197,7 +198,7 b' class dirstate(object):'
197 yield x
198 yield x
198
199
199 def parents(self):
200 def parents(self):
200 return self._pl
201 return [self._validate(p) for p in self._pl]
201
202
202 def branch(self):
203 def branch(self):
203 return self._branch
204 return self._branch
@@ -178,7 +178,19 b' class localrepository(repo.repository):'
178
178
179 @propertycache
179 @propertycache
180 def dirstate(self):
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 def __getitem__(self, changeid):
195 def __getitem__(self, changeid):
184 if changeid is None:
196 if changeid is None:
General Comments 0
You need to be logged in to leave comments. Login now