##// END OF EJS Templates
patch.makepatchmeta: accept a prefix parameter...
Siddharth Agarwal -
r24245:740a17f8 default
parent child Browse files
Show More
@@ -1123,14 +1123,14 b' def pathtransform(path, strip, prefix):'
1123 count -= 1
1123 count -= 1
1124 return path[:i].lstrip(), prefix + path[i:].rstrip()
1124 return path[:i].lstrip(), prefix + path[i:].rstrip()
1125
1125
1126 def makepatchmeta(backend, afile_orig, bfile_orig, hunk, strip):
1126 def makepatchmeta(backend, afile_orig, bfile_orig, hunk, strip, prefix):
1127 nulla = afile_orig == "/dev/null"
1127 nulla = afile_orig == "/dev/null"
1128 nullb = bfile_orig == "/dev/null"
1128 nullb = bfile_orig == "/dev/null"
1129 create = nulla and hunk.starta == 0 and hunk.lena == 0
1129 create = nulla and hunk.starta == 0 and hunk.lena == 0
1130 remove = nullb and hunk.startb == 0 and hunk.lenb == 0
1130 remove = nullb and hunk.startb == 0 and hunk.lenb == 0
1131 abase, afile = pathtransform(afile_orig, strip, '')
1131 abase, afile = pathtransform(afile_orig, strip, prefix)
1132 gooda = not nulla and backend.exists(afile)
1132 gooda = not nulla and backend.exists(afile)
1133 bbase, bfile = pathtransform(bfile_orig, strip, '')
1133 bbase, bfile = pathtransform(bfile_orig, strip, prefix)
1134 if afile == bfile:
1134 if afile == bfile:
1135 goodb = gooda
1135 goodb = gooda
1136 else:
1136 else:
@@ -1393,7 +1393,7 b' def _applydiff(ui, fp, patcher, backend,'
1393 if gp.oldpath:
1393 if gp.oldpath:
1394 gp.oldpath = pstrip(gp.oldpath)
1394 gp.oldpath = pstrip(gp.oldpath)
1395 else:
1395 else:
1396 gp = makepatchmeta(backend, afile, bfile, first_hunk, strip)
1396 gp = makepatchmeta(backend, afile, bfile, first_hunk, strip, '')
1397 if gp.op == 'RENAME':
1397 if gp.op == 'RENAME':
1398 backend.unlink(gp.oldpath)
1398 backend.unlink(gp.oldpath)
1399 if not first_hunk:
1399 if not first_hunk:
@@ -1563,7 +1563,8 b' def changedfiles(ui, repo, patchpath, st'
1563 if gp.oldpath:
1563 if gp.oldpath:
1564 gp.oldpath = pathtransform(gp.oldpath, strip - 1, '')[1]
1564 gp.oldpath = pathtransform(gp.oldpath, strip - 1, '')[1]
1565 else:
1565 else:
1566 gp = makepatchmeta(backend, afile, bfile, first_hunk, strip)
1566 gp = makepatchmeta(backend, afile, bfile, first_hunk, strip,
1567 '')
1567 changed.add(gp.path)
1568 changed.add(gp.path)
1568 if gp.op == 'RENAME':
1569 if gp.op == 'RENAME':
1569 changed.add(gp.oldpath)
1570 changed.add(gp.oldpath)
General Comments 0
You need to be logged in to leave comments. Login now