comparison mercurial/store.py @ 45483:d252f51ab032

share: introduce config option to store requires in .hg/store This introduces a config option which enabled stores the requirements on a repository in store instead. When enabled, `.hg/requires` will contain the `share-safe` requirement which marks that the requirements are present in the store. This is done so that repository requirements can be shared with shares made using `hg share` command. After this patch, `hg share` checks whether the source repository has share-safe requirement, if yes, it does not copy the requirements. Test for the new functionality is added and a test case in exitsing share tests is also added. Differential Revision: https://phab.mercurial-scm.org/D8633
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 14 Apr 2020 21:07:09 +0530
parents 909dafff6a78
children 89a2afe31e82
comparison
equal deleted inserted replaced
45482:9a99ab8217bd 45483:d252f51ab032
382 b'00manifest.i', 382 b'00manifest.i',
383 b'00changelog.d', 383 b'00changelog.d',
384 b'00changelog.i', 384 b'00changelog.i',
385 b'phaseroots', 385 b'phaseroots',
386 b'obsstore', 386 b'obsstore',
387 b'requires',
387 ] 388 ]
388 389
389 390
390 def isrevlog(f, kind, st): 391 def isrevlog(f, kind, st):
391 return kind == stat.S_IFREG and f[-2:] in (b'.i', b'.d') 392 return kind == stat.S_IFREG and f[-2:] in (b'.i', b'.d')
453 yield x 454 yield x
454 for x in self.topfiles(): 455 for x in self.topfiles():
455 yield x 456 yield x
456 457
457 def copylist(self): 458 def copylist(self):
458 return [b'requires'] + _data 459 return _data
459 460
460 def write(self, tr): 461 def write(self, tr):
461 pass 462 pass
462 463
463 def invalidatecaches(self): 464 def invalidatecaches(self):
702 b'obsstore', 703 b'obsstore',
703 b'00manifest.d', 704 b'00manifest.d',
704 b'00manifest.i', 705 b'00manifest.i',
705 b'00changelog.d', 706 b'00changelog.d',
706 b'00changelog.i', 707 b'00changelog.i',
708 b'requires',
707 ) 709 )
708 return [b'requires', b'00changelog.i'] + [b'store/' + f for f in d] 710 return [b'requires', b'00changelog.i'] + [b'store/' + f for f in d]
709 711
710 def write(self, tr): 712 def write(self, tr):
711 self.fncache.write(tr) 713 self.fncache.write(tr)