hgext/journal.py
changeset 36197 0fe7e39dc683
parent 35993 386c1e45e671
child 36636 c6061cadb400
equal deleted inserted replaced
36196:802742769680 36197:0fe7e39dc683
    34     pycompat,
    34     pycompat,
    35     registrar,
    35     registrar,
    36     util,
    36     util,
    37 )
    37 )
    38 
    38 
    39 from . import share
       
    40 
       
    41 cmdtable = {}
    39 cmdtable = {}
    42 command = registrar.command(cmdtable)
    40 command = registrar.command(cmdtable)
    43 
    41 
    44 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    42 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    45 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    43 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
   167 
   165 
   168 def unsharejournal(orig, ui, repo, repopath):
   166 def unsharejournal(orig, ui, repo, repopath):
   169     """Copy shared journal entries into this repo when unsharing"""
   167     """Copy shared journal entries into this repo when unsharing"""
   170     if (repo.path == repopath and repo.shared() and
   168     if (repo.path == repopath and repo.shared() and
   171             util.safehasattr(repo, 'journal')):
   169             util.safehasattr(repo, 'journal')):
   172         sharedrepo = share._getsrcrepo(repo)
   170         sharedrepo = hg.sharedreposource(repo)
   173         sharedfeatures = _readsharedfeatures(repo)
   171         sharedfeatures = _readsharedfeatures(repo)
   174         if sharedrepo and sharedfeatures > {'journal'}:
   172         if sharedrepo and sharedfeatures > {'journal'}:
   175             # there is a shared repository and there are shared journal entries
   173             # there is a shared repository and there are shared journal entries
   176             # to copy. move shared date over from source to destination but
   174             # to copy. move shared date over from source to destination but
   177             # move the local file first
   175             # move the local file first
   256 
   254 
   257         # is this working copy using a shared storage?
   255         # is this working copy using a shared storage?
   258         self.sharedfeatures = self.sharedvfs = None
   256         self.sharedfeatures = self.sharedvfs = None
   259         if repo.shared():
   257         if repo.shared():
   260             features = _readsharedfeatures(repo)
   258             features = _readsharedfeatures(repo)
   261             sharedrepo = share._getsrcrepo(repo)
   259             sharedrepo = hg.sharedreposource(repo)
   262             if sharedrepo is not None and 'journal' in features:
   260             if sharedrepo is not None and 'journal' in features:
   263                 self.sharedvfs = sharedrepo.vfs
   261                 self.sharedvfs = sharedrepo.vfs
   264                 self.sharedfeatures = features
   262                 self.sharedfeatures = features
   265 
   263 
   266     # track the current command for recording in journal entries
   264     # track the current command for recording in journal entries