Show More
@@ -1625,9 +1625,10 b' class memctx(committablectx):' | |||
|
1625 | 1625 | |
|
1626 | 1626 | # keep this simple for now; just worry about p1 |
|
1627 | 1627 | pctx = self._parents[0] |
|
1628 | pman = pctx.manifest() | |
|
1628 | 1629 | man = pctx.manifest().copy() |
|
1629 | 1630 | |
|
1630 | for f, fnode in man.iteritems(): | |
|
1631 | for f, fnode in pman.iteritems(): | |
|
1631 | 1632 | p1node = nullid |
|
1632 | 1633 | p2node = nullid |
|
1633 | 1634 | p = pctx[f].parents() # if file isn't in pctx, check p2? |
@@ -1635,7 +1636,12 b' class memctx(committablectx):' | |||
|
1635 | 1636 | p1node = p[0].node() |
|
1636 | 1637 | if len(p) > 1: |
|
1637 | 1638 | p2node = p[1].node() |
|
1638 | man[f] = revlog.hash(self[f].data(), p1node, p2node) | |
|
1639 | fctx = self[f] | |
|
1640 | if fctx is None: | |
|
1641 | # removed file | |
|
1642 | del man[f] | |
|
1643 | else: | |
|
1644 | man[f] = revlog.hash(fctx.data(), p1node, p2node) | |
|
1639 | 1645 | |
|
1640 | 1646 | return man |
|
1641 | 1647 |
@@ -429,6 +429,67 b' specific template keywords work well' | |||
|
429 | 429 | abort: empty commit message |
|
430 | 430 | [255] |
|
431 | 431 | |
|
432 | prove that we can show a diff of an amend using committemplate: | |
|
433 | ||
|
434 | $ hg init issue4470 | |
|
435 | $ cd issue4470 | |
|
436 | $ cat >> .hg/hgrc <<EOF | |
|
437 | > [committemplate] | |
|
438 | > changeset = {desc}\n\n | |
|
439 | > HG: {extramsg} | |
|
440 | > HG: user: {author}\n{ifeq(p2rev, "-1", "", | |
|
441 | > "HG: branch merge\n") | |
|
442 | > }HG: branch '{branch}'\n{if(currentbookmark, | |
|
443 | > "HG: bookmark '{currentbookmark}'\n") }{subrepos % | |
|
444 | > "HG: subrepo {subrepo}\n" } | |
|
445 | > {splitlines(diff()) % 'HG: {line}\n'} | |
|
446 | > EOF | |
|
447 | $ echo a > a | |
|
448 | $ echo b > b | |
|
449 | $ hg addr | |
|
450 | adding a | |
|
451 | adding b | |
|
452 | $ hg ci -m 'init' | |
|
453 | $ hg rm b | |
|
454 | $ hg ci -m 'rm b' | |
|
455 | $ hg export . | |
|
456 | # HG changeset patch | |
|
457 | # User test | |
|
458 | # Date 0 0 | |
|
459 | # Thu Jan 01 00:00:00 1970 +0000 | |
|
460 | # Node ID 88d0ffa85e7a92ccc7c9cc187f9b17858bd206a7 | |
|
461 | # Parent 9118d25c26b1ca5cab5683b02100e7eb2c0d9471 | |
|
462 | rm b | |
|
463 | ||
|
464 | diff -r 9118d25c26b1 -r 88d0ffa85e7a b | |
|
465 | --- a/b Thu Jan 01 00:00:00 1970 +0000 | |
|
466 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
|
467 | @@ -1,1 +0,0 @@ | |
|
468 | -b | |
|
469 | $ echo a >> a | |
|
470 | $ HGEDITOR=cat hg commit --amend | |
|
471 | rm b | |
|
472 | ||
|
473 | ||
|
474 | HG: Leave message empty to abort commit. | |
|
475 | HG: user: test | |
|
476 | HG: branch 'default' | |
|
477 | ||
|
478 | HG: diff -r 9118d25c26b1 a | |
|
479 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
|
480 | HG: +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
|
481 | HG: @@ -1,1 +1,2 @@ | |
|
482 | HG: a | |
|
483 | HG: +a | |
|
484 | HG: diff -r 9118d25c26b1 b | |
|
485 | HG: --- a/b Thu Jan 01 00:00:00 1970 +0000 | |
|
486 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
|
487 | HG: @@ -1,1 +0,0 @@ | |
|
488 | HG: -b | |
|
489 | saved backup bundle to $TESTTMP/*/*-amend-backup.hg (glob) | |
|
490 | $ cd .. | |
|
491 | ||
|
492 | cleanup | |
|
432 | 493 | $ cat >> .hg/hgrc <<EOF |
|
433 | 494 | > # disable customizing for subsequent tests |
|
434 | 495 | > [committemplate] |
General Comments 0
You need to be logged in to leave comments.
Login now