Mercurial > hg
comparison mercurial/localrepo.py @ 26155:51a30cae2bff
localrepo: move dirstate validate function to class scope
This will allow the function to be referred to by subclasses, as required for
upcoming patches.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 02 Sep 2015 22:05:23 -0700 |
parents | 049005de325e |
children | bc1f8a79b4e4 |
comparison
equal
deleted
inserted
replaced
26154:242853e14804 | 26155:51a30cae2bff |
---|---|
298 self.vfs.createmode = self.store.createmode | 298 self.vfs.createmode = self.store.createmode |
299 self._applyopenerreqs() | 299 self._applyopenerreqs() |
300 if create: | 300 if create: |
301 self._writerequirements() | 301 self._writerequirements() |
302 | 302 |
303 self._dirstatevalidatewarned = False | |
303 | 304 |
304 self._branchcaches = {} | 305 self._branchcaches = {} |
305 self._revbranchcache = None | 306 self._revbranchcache = None |
306 self.filterpats = {} | 307 self.filterpats = {} |
307 self._datafilters = {} | 308 self._datafilters = {} |
471 def dirlog(self, dir): | 472 def dirlog(self, dir): |
472 return self.manifest.dirlog(dir) | 473 return self.manifest.dirlog(dir) |
473 | 474 |
474 @repofilecache('dirstate') | 475 @repofilecache('dirstate') |
475 def dirstate(self): | 476 def dirstate(self): |
476 warned = [0] | 477 return dirstate.dirstate(self.vfs, self.ui, self.root, |
477 def validate(node): | 478 self._dirstatevalidate) |
478 try: | 479 |
479 self.changelog.rev(node) | 480 def _dirstatevalidate(self, node): |
480 return node | 481 try: |
481 except error.LookupError: | 482 self.changelog.rev(node) |
482 if not warned[0]: | 483 return node |
483 warned[0] = True | 484 except error.LookupError: |
484 self.ui.warn(_("warning: ignoring unknown" | 485 if not self._dirstatevalidatewarned: |
485 " working parent %s!\n") % short(node)) | 486 self._dirstatevalidatewarned = True |
486 return nullid | 487 self.ui.warn(_("warning: ignoring unknown" |
487 | 488 " working parent %s!\n") % short(node)) |
488 return dirstate.dirstate(self.vfs, self.ui, self.root, validate) | 489 return nullid |
489 | 490 |
490 def __getitem__(self, changeid): | 491 def __getitem__(self, changeid): |
491 if changeid is None or changeid == wdirrev: | 492 if changeid is None or changeid == wdirrev: |
492 return context.workingctx(self) | 493 return context.workingctx(self) |
493 if isinstance(changeid, slice): | 494 if isinstance(changeid, slice): |