hgext/share.py
branchstable
changeset 49366 288de6f5d724
parent 49306 2e726c934fcd
child 50796 7a50e1720f6d
equal deleted inserted replaced
49364:e8ea403b1c46 49366:288de6f5d724
    63 
    63 
    64     For resharing existing shares, make sure your working directory is clean
    64     For resharing existing shares, make sure your working directory is clean
    65     and there are no untracked files, delete that share and create a new share.
    65     and there are no untracked files, delete that share and create a new share.
    66 '''
    66 '''
    67 
    67 
    68 from __future__ import absolute_import
    68 
    69 
       
    70 import errno
       
    71 from mercurial.i18n import _
    69 from mercurial.i18n import _
    72 from mercurial import (
    70 from mercurial import (
    73     bookmarks,
    71     bookmarks,
    74     commands,
    72     commands,
    75     error,
    73     error,
   176         # Kind of a lie, but it means that we skip our custom reads and writes
   174         # Kind of a lie, but it means that we skip our custom reads and writes
   177         # from/to the source repo.
   175         # from/to the source repo.
   178         return False
   176         return False
   179     try:
   177     try:
   180         shared = repo.vfs.read(b'shared').splitlines()
   178         shared = repo.vfs.read(b'shared').splitlines()
   181     except IOError as inst:
   179     except FileNotFoundError:
   182         if inst.errno != errno.ENOENT:
       
   183             raise
       
   184         return False
   180         return False
   185     return hg.sharedbookmarks in shared
   181     return hg.sharedbookmarks in shared
   186 
   182 
   187 
   183 
   188 def getbkfile(orig, repo):
   184 def getbkfile(orig, repo):
   198                 if pending:
   194                 if pending:
   199                     # only in this case, bookmark information in repo
   195                     # only in this case, bookmark information in repo
   200                     # is up-to-date.
   196                     # is up-to-date.
   201                     return fp
   197                     return fp
   202                 fp.close()
   198                 fp.close()
   203             except IOError as inst:
   199             except FileNotFoundError:
   204                 if inst.errno != errno.ENOENT:
   200                 pass
   205                     raise
       
   206 
   201 
   207             # otherwise, we should read bookmarks from srcrepo,
   202             # otherwise, we should read bookmarks from srcrepo,
   208             # because .hg/bookmarks in srcrepo might be already
   203             # because .hg/bookmarks in srcrepo might be already
   209             # changed via another sharing repo
   204             # changed via another sharing repo
   210             repo = srcrepo
   205             repo = srcrepo