Mercurial > public > mercurial-scm > hg
comparison mercurial/patch.py @ 5482:e5eedd74e70f
Use both the from and to name in mdiff.unidiff.
This fixes a compatibility issue with git diffs.
* * *
author | Dustin Sallings <dustin@spy.net> |
---|---|
date | Thu, 01 Nov 2007 12:17:59 -0700 |
parents | 003d1f174fe1 |
children | 777996744942 |
comparison
equal
deleted
inserted
replaced
5481:003d1f174fe1 | 5482:e5eedd74e70f |
---|---|
1228 header = [] | 1228 header = [] |
1229 if f in man1: | 1229 if f in man1: |
1230 to = getfilectx(f, ctx1).data() | 1230 to = getfilectx(f, ctx1).data() |
1231 if f not in removed: | 1231 if f not in removed: |
1232 tn = getfilectx(f, ctx2).data() | 1232 tn = getfilectx(f, ctx2).data() |
1233 a, b = f, f | |
1233 if opts.git: | 1234 if opts.git: |
1234 def gitmode(x, l): | 1235 def gitmode(x, l): |
1235 return l and '120000' or (x and '100755' or '100644') | 1236 return l and '120000' or (x and '100755' or '100644') |
1236 def addmodehdr(header, omode, nmode): | 1237 def addmodehdr(header, omode, nmode): |
1237 if omode != nmode: | 1238 if omode != nmode: |
1238 header.append('old mode %s\n' % omode) | 1239 header.append('old mode %s\n' % omode) |
1239 header.append('new mode %s\n' % nmode) | 1240 header.append('new mode %s\n' % nmode) |
1240 | 1241 |
1241 a, b = f, f | |
1242 if f in added: | 1242 if f in added: |
1243 mode = gitmode(execf2(f), linkf2(f)) | 1243 mode = gitmode(execf2(f), linkf2(f)) |
1244 if f in copied: | 1244 if f in copied: |
1245 a = copied[f] | 1245 a = copied[f] |
1246 omode = gitmode(man1.execf(a), man1.linkf(a)) | 1246 omode = gitmode(man1.execf(a), man1.linkf(a)) |
1276 text = b85diff(to, tn) | 1276 text = b85diff(to, tn) |
1277 else: | 1277 else: |
1278 text = mdiff.unidiff(to, date1, | 1278 text = mdiff.unidiff(to, date1, |
1279 # ctx2 date may be dynamic | 1279 # ctx2 date may be dynamic |
1280 tn, util.datestr(ctx2.date()), | 1280 tn, util.datestr(ctx2.date()), |
1281 f, r, opts=opts) | 1281 a, b, r, opts=opts) |
1282 if text or len(header) > 1: | 1282 if text or len(header) > 1: |
1283 fp.write(''.join(header)) | 1283 fp.write(''.join(header)) |
1284 fp.write(text) | 1284 fp.write(text) |
1285 | 1285 |
1286 def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False, | 1286 def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False, |