hgext/narrow/narrowcommands.py
changeset 39482 4062bbb1d10f
parent 39459 ab20ee07b82d
child 39541 294c571490f0
equal deleted inserted replaced
39481:3dd34b401bc2 39482:4062bbb1d10f
    82 
    82 
    83     if narrowspecfile:
    83     if narrowspecfile:
    84         filepath = os.path.join(pycompat.getcwd(), narrowspecfile)
    84         filepath = os.path.join(pycompat.getcwd(), narrowspecfile)
    85         ui.status(_("reading narrowspec from '%s'\n") % filepath)
    85         ui.status(_("reading narrowspec from '%s'\n") % filepath)
    86         try:
    86         try:
    87             fp = open(filepath, 'rb')
    87             fdata = util.readfile(filepath)
    88         except IOError:
    88         except IOError as inst:
    89             raise error.Abort(_("file '%s' not found") % filepath)
    89             raise error.Abort(_("cannot read narrowspecs from '%s': %s") %
    90 
    90                               (filepath, encoding.strtolocal(inst.strerror)))
    91         includes, excludes, profiles = sparse.parseconfig(ui, fp.read(),
    91 
    92                                                           'narrow')
    92         includes, excludes, profiles = sparse.parseconfig(ui, fdata, 'narrow')
    93         if profiles:
    93         if profiles:
    94             raise error.Abort(_("cannot specify other files using '%include' in"
    94             raise error.Abort(_("cannot specify other files using '%include' in"
    95                                 " narrowspec"))
    95                                 " narrowspec"))
    96 
    96 
    97         # narrowspec is passed so we should assume that user wants narrow clone
    97         # narrowspec is passed so we should assume that user wants narrow clone