hgext/convert/darcs.py
changeset 49306 2e726c934fcd
parent 48934 06de08b36c82
child 49370 1572f790ee5e
equal deleted inserted replaced
49305:53e9422a9b45 49306:2e726c934fcd
     3 #  Copyright 2007-2009 Olivia Mackall <olivia@selenic.com> and others
     3 #  Copyright 2007-2009 Olivia Mackall <olivia@selenic.com> and others
     4 #
     4 #
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 import errno
       
     9 import os
     8 import os
    10 import re
     9 import re
    11 import shutil
    10 import shutil
    12 
    11 
    13 from mercurial.i18n import _
    12 from mercurial.i18n import _
   228             raise error.Abort(_(b'internal calling inconsistency'))
   227             raise error.Abort(_(b'internal calling inconsistency'))
   229         path = os.path.join(self.tmppath, name)
   228         path = os.path.join(self.tmppath, name)
   230         try:
   229         try:
   231             data = util.readfile(path)
   230             data = util.readfile(path)
   232             mode = os.lstat(path).st_mode
   231             mode = os.lstat(path).st_mode
   233         except IOError as inst:
   232         except FileNotFoundError:
   234             if inst.errno == errno.ENOENT:
   233             return None, None
   235                 return None, None
       
   236             raise
       
   237         mode = (mode & 0o111) and b'x' or b''
   234         mode = (mode & 0o111) and b'x' or b''
   238         return data, mode
   235         return data, mode
   239 
   236 
   240     def gettags(self):
   237     def gettags(self):
   241         return self.tags
   238         return self.tags