comparison hgext/extdiff.py @ 43790:765a9c299c44

py3: make a pycompat.osdevnull, use it in extdiff Differential Revision: https://phab.mercurial-scm.org/D7545
author Kyle Lippincott <spectral@google.com>
date Tue, 03 Dec 2019 17:17:57 -0800
parents 7415cd486696
children aac816f584ad
comparison
equal deleted inserted replaced
43789:aea70ca7dd85 43790:765a9c299c44
269 totalfiles = len(commonfiles) 269 totalfiles = len(commonfiles)
270 for idx, commonfile in enumerate(sorted(commonfiles)): 270 for idx, commonfile in enumerate(sorted(commonfiles)):
271 path1a = os.path.join(tmproot, dir1a, commonfile) 271 path1a = os.path.join(tmproot, dir1a, commonfile)
272 label1a = commonfile + rev1a 272 label1a = commonfile + rev1a
273 if not os.path.isfile(path1a): 273 if not os.path.isfile(path1a):
274 path1a = os.devnull 274 path1a = pycompat.osdevnull
275 275
276 path1b = b'' 276 path1b = b''
277 label1b = b'' 277 label1b = b''
278 if do3way: 278 if do3way:
279 path1b = os.path.join(tmproot, dir1b, commonfile) 279 path1b = os.path.join(tmproot, dir1b, commonfile)
280 label1b = commonfile + rev1b 280 label1b = commonfile + rev1b
281 if not os.path.isfile(path1b): 281 if not os.path.isfile(path1b):
282 path1b = os.devnull 282 path1b = pycompat.osdevnull
283 283
284 path2 = os.path.join(dir2root, dir2, commonfile) 284 path2 = os.path.join(dir2root, dir2, commonfile)
285 label2 = commonfile + rev2 285 label2 = commonfile + rev2
286 286
287 if confirm: 287 if confirm:
466 if len(common) == 1: 466 if len(common) == 1:
467 common_file = util.localpath(common.pop()) 467 common_file = util.localpath(common.pop())
468 dir1a = os.path.join(tmproot, dir1a, common_file) 468 dir1a = os.path.join(tmproot, dir1a, common_file)
469 label1a = common_file + rev1a 469 label1a = common_file + rev1a
470 if not os.path.isfile(dir1a): 470 if not os.path.isfile(dir1a):
471 dir1a = os.devnull 471 dir1a = pycompat.osdevnull
472 if do3way: 472 if do3way:
473 dir1b = os.path.join(tmproot, dir1b, common_file) 473 dir1b = os.path.join(tmproot, dir1b, common_file)
474 label1b = common_file + rev1b 474 label1b = common_file + rev1b
475 if not os.path.isfile(dir1b): 475 if not os.path.isfile(dir1b):
476 dir1b = os.devnull 476 dir1b = pycompat.osdevnull
477 dir2 = os.path.join(dir2root, dir2, common_file) 477 dir2 = os.path.join(dir2root, dir2, common_file)
478 label2 = common_file + rev2 478 label2 = common_file + rev2
479 else: 479 else:
480 template = b'hg-%h.patch' 480 template = b'hg-%h.patch'
481 with formatter.nullformatter(ui, b'extdiff', {}) as fm: 481 with formatter.nullformatter(ui, b'extdiff', {}) as fm: