Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 10466:d1f209bb9564 stable
patch: separate reverse copy data (issue1959)
author | Wagner Bruna <wbruna@softwareexpress.com.br> |
---|---|
date | Thu, 11 Feb 2010 11:22:57 -0200 |
parents | 832f35386067 |
children | 16c68fd720ab |
comparison
equal
deleted
inserted
replaced
10465:5d7e84e7ac6d | 10466:d1f209bb9564 |
---|---|
1434 | 1434 |
1435 copy = {} | 1435 copy = {} |
1436 if opts.git or opts.upgrade: | 1436 if opts.git or opts.upgrade: |
1437 copy = copies.copies(repo, ctx1, ctx2, repo[nullid])[0] | 1437 copy = copies.copies(repo, ctx1, ctx2, repo[nullid])[0] |
1438 copy = copy.copy() | 1438 copy = copy.copy() |
1439 for k, v in copy.items(): | |
1440 copy[v] = k | |
1441 | 1439 |
1442 difffn = lambda opts, losedata: trydiff(repo, revs, ctx1, ctx2, | 1440 difffn = lambda opts, losedata: trydiff(repo, revs, ctx1, ctx2, |
1443 modified, added, removed, copy, getfilectx, opts, losedata) | 1441 modified, added, removed, copy, getfilectx, opts, losedata) |
1444 if opts.upgrade and not opts.git: | 1442 if opts.upgrade and not opts.git: |
1445 try: | 1443 try: |
1465 man1 = ctx1.manifest() | 1463 man1 = ctx1.manifest() |
1466 | 1464 |
1467 gone = set() | 1465 gone = set() |
1468 gitmode = {'l': '120000', 'x': '100755', '': '100644'} | 1466 gitmode = {'l': '120000', 'x': '100755', '': '100644'} |
1469 | 1467 |
1468 copyto = dict([(v, k) for k, v in copy.items()]) | |
1469 | |
1470 if opts.git: | 1470 if opts.git: |
1471 revs = None | 1471 revs = None |
1472 | 1472 |
1473 for f in sorted(modified + added + removed): | 1473 for f in sorted(modified + added + removed): |
1474 to = None | 1474 to = None |
1481 tn = getfilectx(f, ctx2).data() | 1481 tn = getfilectx(f, ctx2).data() |
1482 a, b = f, f | 1482 a, b = f, f |
1483 if opts.git or losedatafn: | 1483 if opts.git or losedatafn: |
1484 if f in added: | 1484 if f in added: |
1485 mode = gitmode[ctx2.flags(f)] | 1485 mode = gitmode[ctx2.flags(f)] |
1486 if f in copy: | 1486 if f in copy or f in copyto: |
1487 if opts.git: | 1487 if opts.git: |
1488 a = copy[f] | 1488 if f in copy: |
1489 a = copy[f] | |
1490 else: | |
1491 a = copyto[f] | |
1489 omode = gitmode[man1.flags(a)] | 1492 omode = gitmode[man1.flags(a)] |
1490 _addmodehdr(header, omode, mode) | 1493 _addmodehdr(header, omode, mode) |
1491 if a in removed and a not in gone: | 1494 if a in removed and a not in gone: |
1492 op = 'rename' | 1495 op = 'rename' |
1493 gone.add(a) | 1496 gone.add(a) |
1512 # regular diffs cannot represent new empty file | 1515 # regular diffs cannot represent new empty file |
1513 losedatafn(f) | 1516 losedatafn(f) |
1514 elif f in removed: | 1517 elif f in removed: |
1515 if opts.git: | 1518 if opts.git: |
1516 # have we already reported a copy above? | 1519 # have we already reported a copy above? |
1517 if f in copy and copy[f] in added and copy[copy[f]] == f: | 1520 if f in copy and copy[f] in added and copyto[copy[f]] == f: |
1521 dodiff = False | |
1522 elif f in copyto and copyto[f] in added and copy[copyto[f]] == f: | |
1518 dodiff = False | 1523 dodiff = False |
1519 else: | 1524 else: |
1520 header.append('deleted file mode %s\n' % | 1525 header.append('deleted file mode %s\n' % |
1521 gitmode[man1.flags(f)]) | 1526 gitmode[man1.flags(f)]) |
1522 elif not to: | 1527 elif not to: |