hgext/extdiff.py
changeset 45129 30c31de4d1db
parent 45128 d23881b17388
child 45130 33524b6bef53
equal deleted inserted replaced
45128:d23881b17388 45129:30c31de4d1db
   348         with ui.timeblockedsection(b'extdiff'):
   348         with ui.timeblockedsection(b'extdiff'):
   349             for proc in waitprocs:
   349             for proc in waitprocs:
   350                 proc.wait()
   350                 proc.wait()
   351 
   351 
   352 
   352 
   353 def diffpatch(ui, repo, node1a, node2, tmproot, matcher, cmdline):
   353 def diffpatch(ui, repo, node1, node2, tmproot, matcher, cmdline):
   354     template = b'hg-%h.patch'
   354     template = b'hg-%h.patch'
       
   355     # write patches to temporary files
   355     with formatter.nullformatter(ui, b'extdiff', {}) as fm:
   356     with formatter.nullformatter(ui, b'extdiff', {}) as fm:
   356         cmdutil.export(
   357         cmdutil.export(
   357             repo,
   358             repo,
   358             [repo[node1a].rev(), repo[node2].rev()],
   359             [repo[node1].rev(), repo[node2].rev()],
   359             fm,
   360             fm,
   360             fntemplate=repo.vfs.reljoin(tmproot, template),
   361             fntemplate=repo.vfs.reljoin(tmproot, template),
   361             match=matcher,
   362             match=matcher,
   362         )
   363         )
   363     label1a = cmdutil.makefilename(repo[node1a], template)
   364     label1 = cmdutil.makefilename(repo[node1], template)
   364     label2 = cmdutil.makefilename(repo[node2], template)
   365     label2 = cmdutil.makefilename(repo[node2], template)
   365     dir1a = repo.vfs.reljoin(tmproot, label1a)
   366     file1 = repo.vfs.reljoin(tmproot, label1)
   366     dir2 = repo.vfs.reljoin(tmproot, label2)
   367     file2 = repo.vfs.reljoin(tmproot, label2)
   367     dir1b = None
       
   368     label1b = None
       
   369     cmdline = formatcmdline(
   368     cmdline = formatcmdline(
   370         cmdline,
   369         cmdline,
   371         repo.root,
   370         repo.root,
   372         parent1=dir1a,
       
   373         plabel1=label1a,
       
   374         parent2=dir1b,
       
   375         plabel2=label1b,
       
   376         child=dir2,
       
   377         # no 3way while comparing patches
   371         # no 3way while comparing patches
   378         do3way=False,
   372         do3way=False,
       
   373         parent1=file1,
       
   374         plabel1=label1,
       
   375         # while comparing patches, there is no second parent
       
   376         parent2=None,
       
   377         plabel2=None,
       
   378         child=file2,
   379         clabel=label2,
   379         clabel=label2,
   380     )
   380     )
   381     ui.debug(b'running %r in %s\n' % (pycompat.bytestr(cmdline), tmproot))
   381     ui.debug(b'running %r in %s\n' % (pycompat.bytestr(cmdline), tmproot))
   382     ui.system(cmdline, cwd=tmproot, blockedtag=b'extdiff')
   382     ui.system(cmdline, cwd=tmproot, blockedtag=b'extdiff')
   383     return 1
   383     return 1