comparison mercurial/localrepo.py @ 23666:965788d9ae09

localrepo: introduce shared method to check if a repository is shared Up until now we compared the "path" and "sharedpath" repository properties to check if a repository is shared. This was relying an implementation detail of shared repositories. In order to make it possible to change the way shared repositories are implemented, we encapsulate this check into its own localrepo method, called shared. This new method returns None if the repository is shared, and something else (for now a string describing the short of share) otherwise. The reason why I did not call this method "isshared" and made it return a boolean is that I plan to introduce a new type of shared repository soon. # NOTES: This is the first patch in a series whose purpose is to add support for creating "full repository shares", which are repositories that share everything with the repository source except their current revision, branch and bookmark. This series is RFC because I am not very sure of some of the solutions I took. Comments are welcome!
author Angel Ezquerra <angel.ezquerra@gmail.com>
date Sun, 21 Dec 2014 00:19:10 +0100
parents 915ac9403e13
children f8df993516d0
comparison
equal deleted inserted replaced
23665:a90499a6ad8d 23666:965788d9ae09
756 if not self.ui.configbool('phases', 'publish', True): 756 if not self.ui.configbool('phases', 'publish', True):
757 return True 757 return True
758 # if publishing we can't copy if there is filtered content 758 # if publishing we can't copy if there is filtered content
759 return not self.filtered('visible').changelog.filteredrevs 759 return not self.filtered('visible').changelog.filteredrevs
760 760
761 def shared(self):
762 '''the type of shared repository (None if not shared)'''
763 if self.sharedpath != self.path:
764 return 'store'
765 return None
766
761 def join(self, f, *insidef): 767 def join(self, f, *insidef):
762 return os.path.join(self.path, f, *insidef) 768 return os.path.join(self.path, f, *insidef)
763 769
764 def wjoin(self, f, *insidef): 770 def wjoin(self, f, *insidef):
765 return os.path.join(self.root, f, *insidef) 771 return os.path.join(self.root, f, *insidef)