##// END OF EJS Templates
narrow: use util.readfile() and improve error message using --narrowspec...
Pulkit Goyal -
r39501:4062bbb1 default
parent child Browse files
Show More
@@ -84,12 +84,12 b' def clonenarrowcmd(orig, ui, repo, *args'
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 (filepath, encoding.strtolocal(inst.strerror)))
90
91
91 includes, excludes, profiles = sparse.parseconfig(ui, fp.read(),
92 includes, excludes, profiles = sparse.parseconfig(ui, fdata, 'narrow')
92 '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"))
General Comments 0
You need to be logged in to leave comments. Login now