mercurial/patch.py
changeset 10151 c7355a0e1f39
parent 10136 270367ec4d30
child 10189 e451e599fbcf
equal deleted inserted replaced
10150:926c436964b4 10151:c7355a0e1f39
  1291         return
  1291         return
  1292 
  1292 
  1293     date1 = util.datestr(ctx1.date())
  1293     date1 = util.datestr(ctx1.date())
  1294     man1 = ctx1.manifest()
  1294     man1 = ctx1.manifest()
  1295 
  1295 
  1296     if repo.ui.quiet:
  1296     revs = None
  1297         r = None
  1297     if not repo.ui.quiet and not opts.git:
  1298     else:
       
  1299         hexfunc = repo.ui.debugflag and hex or short
  1298         hexfunc = repo.ui.debugflag and hex or short
  1300         r = [hexfunc(node) for node in [node1, node2] if node]
  1299         revs = [hexfunc(node) for node in [node1, node2] if node]
  1301 
  1300 
  1302     if opts.git:
  1301     if opts.git:
  1303         copy, diverge = copies.copies(repo, ctx1, ctx2, repo[nullid])
  1302         copy, diverge = copies.copies(repo, ctx1, ctx2, repo[nullid])
  1304         copy = copy.copy()
  1303         copy = copy.copy()
  1305         for k, v in copy.items():
  1304         for k, v in copy.items():
  1348                 omode = gitmode[man1.flags(f)]
  1347                 omode = gitmode[man1.flags(f)]
  1349                 nmode = gitmode[ctx2.flags(f)]
  1348                 nmode = gitmode[ctx2.flags(f)]
  1350                 _addmodehdr(header, omode, nmode)
  1349                 _addmodehdr(header, omode, nmode)
  1351                 if util.binary(to) or util.binary(tn):
  1350                 if util.binary(to) or util.binary(tn):
  1352                     dodiff = 'binary'
  1351                     dodiff = 'binary'
  1353             r = None
  1352             header.insert(0, mdiff.diffline(revs, a, b, opts))
  1354             header.insert(0, mdiff.diffline(r, a, b, opts))
       
  1355         if dodiff:
  1353         if dodiff:
  1356             if dodiff == 'binary':
  1354             if dodiff == 'binary':
  1357                 text = b85diff(to, tn)
  1355                 text = b85diff(to, tn)
  1358             else:
  1356             else:
  1359                 text = mdiff.unidiff(to, date1,
  1357                 text = mdiff.unidiff(to, date1,
  1360                                     # ctx2 date may be dynamic
  1358                                     # ctx2 date may be dynamic
  1361                                     tn, util.datestr(ctx2.date()),
  1359                                     tn, util.datestr(ctx2.date()),
  1362                                     a, b, r, opts=opts)
  1360                                     a, b, revs, opts=opts)
  1363             if header and (text or len(header) > 1):
  1361             if header and (text or len(header) > 1):
  1364                 yield ''.join(header)
  1362                 yield ''.join(header)
  1365             if text:
  1363             if text:
  1366                 yield text
  1364                 yield text
  1367 
  1365