Show More
@@ -1436,8 +1436,6 b' def diff(repo, node1=None, node2=None, m' | |||||
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) | |
@@ -1467,6 +1465,8 b' def trydiff(repo, revs, ctx1, ctx2, modi' | |||||
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 | |||
@@ -1483,9 +1483,12 b' def trydiff(repo, revs, ctx1, ctx2, modi' | |||||
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 |
|
|
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: | |
@@ -1514,7 +1517,9 b' def trydiff(repo, revs, ctx1, ctx2, modi' | |||||
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' % |
@@ -210,6 +210,13 b' hg rename d1/bb d1/b' | |||||
210 | hg status -C |
|
210 | hg status -C | |
211 | hg update -C |
|
211 | hg update -C | |
212 |
|
212 | |||
|
213 | echo '# overwriting with renames (issue1959)' | |||
|
214 | hg rename d1/a d1/c | |||
|
215 | hg rename d1/b d1/a | |||
|
216 | hg status -C | |||
|
217 | hg diff --git | |||
|
218 | hg update -C | |||
|
219 | ||||
213 | echo "# check illegal path components" |
|
220 | echo "# check illegal path components" | |
214 |
|
221 | |||
215 | hg rename d1/d11/a1 .hg/foo |
|
222 | hg rename d1/d11/a1 .hg/foo |
@@ -300,6 +300,19 b' 1 files updated, 0 files merged, 0 files' | |||||
300 | # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b) |
|
300 | # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b) | |
301 | M d1/b |
|
301 | M d1/b | |
302 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
302 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
303 | # overwriting with renames (issue1959) | |||
|
304 | A d1/a | |||
|
305 | d1/b | |||
|
306 | A d1/c | |||
|
307 | d1/a | |||
|
308 | R d1/b | |||
|
309 | diff --git a/d1/b b/d1/a | |||
|
310 | rename from d1/b | |||
|
311 | rename to d1/a | |||
|
312 | diff --git a/d1/a b/d1/c | |||
|
313 | copy from d1/a | |||
|
314 | copy to d1/c | |||
|
315 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
303 | # check illegal path components |
|
316 | # check illegal path components | |
304 | abort: path contains illegal component: .hg/foo |
|
317 | abort: path contains illegal component: .hg/foo | |
305 | abort: ../foo not under root |
|
318 | abort: ../foo not under root |
General Comments 0
You need to be logged in to leave comments.
Login now