mercurial/localrepo.py
changeset 39849 d3d4b4b5f725
parent 39848 4ece3cdfd907
child 39850 d89d5bc06eaa
equal deleted inserted replaced
39848:4ece3cdfd907 39849:d3d4b4b5f725
  2784     """
  2784     """
  2785     known = {
  2785     known = {
  2786         'narrowfiles',
  2786         'narrowfiles',
  2787         'sharedrepo',
  2787         'sharedrepo',
  2788         'sharedrelative',
  2788         'sharedrelative',
       
  2789         'shareditems',
  2789     }
  2790     }
  2790 
  2791 
  2791     return {k: v for k, v in createopts.items() if k not in known}
  2792     return {k: v for k, v in createopts.items() if k not in known}
  2792 
  2793 
  2793 def createrepository(ui, path, createopts=None):
  2794 def createrepository(ui, path, createopts=None):
  2804        Repository object from which storage should be shared.
  2805        Repository object from which storage should be shared.
  2805     sharedrelative
  2806     sharedrelative
  2806        Boolean indicating if the path to the shared repo should be
  2807        Boolean indicating if the path to the shared repo should be
  2807        stored as relative. By default, the pointer to the "parent" repo
  2808        stored as relative. By default, the pointer to the "parent" repo
  2808        is stored as an absolute path.
  2809        is stored as an absolute path.
       
  2810     shareditems
       
  2811        Set of items to share to the new repository (in addition to storage).
  2809     """
  2812     """
  2810     createopts = createopts or {}
  2813     createopts = createopts or {}
  2811 
  2814 
  2812     unknownopts = filterknowncreateopts(ui, createopts)
  2815     unknownopts = filterknowncreateopts(ui, createopts)
  2813 
  2816 
  2865 
  2868 
  2866     # Write out file telling readers where to find the shared store.
  2869     # Write out file telling readers where to find the shared store.
  2867     if 'sharedrepo' in createopts:
  2870     if 'sharedrepo' in createopts:
  2868         hgvfs.write(b'sharedpath', sharedpath)
  2871         hgvfs.write(b'sharedpath', sharedpath)
  2869 
  2872 
       
  2873     if createopts.get('shareditems'):
       
  2874         shared = b'\n'.join(sorted(createopts['shareditems'])) + b'\n'
       
  2875         hgvfs.write(b'shared', shared)
       
  2876 
  2870 def poisonrepository(repo):
  2877 def poisonrepository(repo):
  2871     """Poison a repository instance so it can no longer be used."""
  2878     """Poison a repository instance so it can no longer be used."""
  2872     # Perform any cleanup on the instance.
  2879     # Perform any cleanup on the instance.
  2873     repo.close()
  2880     repo.close()
  2874 
  2881