equal
deleted
inserted
replaced
1164 for l in chunk(zlib.compress(tn)): |
1164 for l in chunk(zlib.compress(tn)): |
1165 ret.append(fmtline(l)) |
1165 ret.append(fmtline(l)) |
1166 ret.append('\n') |
1166 ret.append('\n') |
1167 return ''.join(ret) |
1167 return ''.join(ret) |
1168 |
1168 |
|
1169 def _addmodehdr(header, omode, nmode): |
|
1170 if omode != nmode: |
|
1171 header.append('old mode %s\n' % omode) |
|
1172 header.append('new mode %s\n' % nmode) |
|
1173 |
1169 def diff(repo, node1=None, node2=None, match=None, |
1174 def diff(repo, node1=None, node2=None, match=None, |
1170 fp=None, changes=None, opts=None): |
1175 fp=None, changes=None, opts=None): |
1171 '''print diff of changes to files between two nodes, or node and |
1176 '''print diff of changes to files between two nodes, or node and |
1172 working directory. |
1177 working directory. |
1173 |
1178 |
1228 to = getfilectx(f, ctx1).data() |
1233 to = getfilectx(f, ctx1).data() |
1229 if f not in removed: |
1234 if f not in removed: |
1230 tn = getfilectx(f, ctx2).data() |
1235 tn = getfilectx(f, ctx2).data() |
1231 a, b = f, f |
1236 a, b = f, f |
1232 if opts.git: |
1237 if opts.git: |
1233 def addmodehdr(header, omode, nmode): |
|
1234 if omode != nmode: |
|
1235 header.append('old mode %s\n' % omode) |
|
1236 header.append('new mode %s\n' % nmode) |
|
1237 |
|
1238 if f in added: |
1238 if f in added: |
1239 mode = gitmode[ctx2.flags(f)] |
1239 mode = gitmode[ctx2.flags(f)] |
1240 if f in copy: |
1240 if f in copy: |
1241 a = copy[f] |
1241 a = copy[f] |
1242 omode = gitmode[man1.flags(a)] |
1242 omode = gitmode[man1.flags(a)] |
1243 addmodehdr(header, omode, mode) |
1243 _addmodehdr(header, omode, mode) |
1244 if a in removed and a not in gone: |
1244 if a in removed and a not in gone: |
1245 op = 'rename' |
1245 op = 'rename' |
1246 gone[a] = 1 |
1246 gone[a] = 1 |
1247 else: |
1247 else: |
1248 op = 'copy' |
1248 op = 'copy' |
1261 header.append('deleted file mode %s\n' % |
1261 header.append('deleted file mode %s\n' % |
1262 gitmode[man1.flags(f)]) |
1262 gitmode[man1.flags(f)]) |
1263 else: |
1263 else: |
1264 omode = gitmode[man1.flags(f)] |
1264 omode = gitmode[man1.flags(f)] |
1265 nmode = gitmode[ctx2.flags(f)] |
1265 nmode = gitmode[ctx2.flags(f)] |
1266 addmodehdr(header, omode, nmode) |
1266 _addmodehdr(header, omode, nmode) |
1267 if util.binary(to) or util.binary(tn): |
1267 if util.binary(to) or util.binary(tn): |
1268 dodiff = 'binary' |
1268 dodiff = 'binary' |
1269 r = None |
1269 r = None |
1270 header.insert(0, 'diff --git a/%s b/%s\n' % (a, b)) |
1270 header.insert(0, 'diff --git a/%s b/%s\n' % (a, b)) |
1271 if dodiff: |
1271 if dodiff: |