##// END OF EJS Templates
hgk: stop using util.bytesinput() to read a single line from stdin...
Yuya Nishihara -
r36808:cb0afaf1 default
parent child Browse files
Show More
@@ -51,7 +51,6 b' from mercurial import ('
51 pycompat,
51 pycompat,
52 registrar,
52 registrar,
53 scmutil,
53 scmutil,
54 util,
55 )
54 )
56
55
57 cmdtable = {}
56 cmdtable = {}
@@ -105,15 +104,15 b' def difftree(ui, repo, node1=None, node2'
105
104
106 while True:
105 while True:
107 if opts[r'stdin']:
106 if opts[r'stdin']:
108 try:
107 line = ui.fin.readline()
109 line = util.bytesinput(ui.fin, ui.fout).split(' ')
108 if not line:
110 node1 = line[0]
111 if len(line) > 1:
112 node2 = line[1]
113 else:
114 node2 = None
115 except EOFError:
116 break
109 break
110 line = line.rstrip(pycompat.oslinesep).split(b' ')
111 node1 = line[0]
112 if len(line) > 1:
113 node2 = line[1]
114 else:
115 node2 = None
117 node1 = repo.lookup(node1)
116 node1 = repo.lookup(node1)
118 if node2:
117 if node2:
119 node2 = repo.lookup(node2)
118 node2 = repo.lookup(node2)
@@ -186,12 +185,11 b' def catfile(ui, repo, type=None, r=None,'
186 #
185 #
187 prefix = ""
186 prefix = ""
188 if opts[r'stdin']:
187 if opts[r'stdin']:
189 try:
188 line = ui.fin.readline()
190 (type, r) = util.bytesinput(ui.fin, ui.fout).split(' ')
189 if not line:
191 prefix = " "
192 except EOFError:
193 return
190 return
194
191 (type, r) = line.rstrip(pycompat.oslinesep).split(b' ')
192 prefix = " "
195 else:
193 else:
196 if not type or not r:
194 if not type or not r:
197 ui.warn(_("cat-file: type or revision not supplied\n"))
195 ui.warn(_("cat-file: type or revision not supplied\n"))
@@ -204,10 +202,10 b' def catfile(ui, repo, type=None, r=None,'
204 n = repo.lookup(r)
202 n = repo.lookup(r)
205 catcommit(ui, repo, n, prefix)
203 catcommit(ui, repo, n, prefix)
206 if opts[r'stdin']:
204 if opts[r'stdin']:
207 try:
205 line = ui.fin.readline()
208 (type, r) = util.bytesinput(ui.fin, ui.fout).split(' ')
206 if not line:
209 except EOFError:
210 break
207 break
208 (type, r) = line.rstrip(pycompat.oslinesep).split(b' ')
211 else:
209 else:
212 break
210 break
213
211
General Comments 0
You need to be logged in to leave comments. Login now