Mercurial > hg
changeset 23589:200215cdf7aa
memctx: calculate manifest correctly with newly-removed files (issue4470)
Before this patch, "memctx._manifest" tries to get (and use normally)
filectx also for newly-removed files, even though "memctx.filectx()"
returns None for such files.
To calculate manifest correctly even with newly-removed files, this
patch does:
- replace "man.iteritems()" for the loop by "self._status.modified"
to avoid accessing itself to newly removed files
this also reduces loop cost for large manifest.
- remove files in "self._status.removed" from the manifest
In this patch, amending is confirmed twice to examine both (1) newly
removed files and (2) ones already removed in amended revision.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 17 Dec 2014 15:09:43 +0900 |
parents | 87a76cff7147 |
children | 4440c7cc3728 |
files | mercurial/context.py tests/test-commit-amend.t |
diffstat | 2 files changed, 56 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Wed Dec 17 15:09:43 2014 +0900 +++ b/mercurial/context.py Wed Dec 17 15:09:43 2014 +0900 @@ -1649,6 +1649,10 @@ for f in self._status.added: man[f] = revlog.hash(self[f].data(), nullid, nullid) + for f in self._status.removed: + if f in man: + del man[f] + return man @propertycache
--- a/tests/test-commit-amend.t Wed Dec 17 15:09:43 2014 +0900 +++ b/tests/test-commit-amend.t Wed Dec 17 15:09:43 2014 +0900 @@ -905,6 +905,58 @@ HG: @@ -0,0 +1,1 @@ HG: +y + $ hg rm a + $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y" + expecting diff of a, foo and y + + HG: M: + HG: A: foo y + HG: R: a + HG: diff -r 6de0c1bde1c8 a + HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 + HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 + HG: @@ -1,2 +0,0 @@ + HG: -a + HG: -a + HG: diff -r 6de0c1bde1c8 foo + HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 + HG: @@ -0,0 +1,1 @@ + HG: +foo + HG: diff -r 6de0c1bde1c8 y + HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 + HG: @@ -0,0 +1,1 @@ + HG: +y + + $ hg rm x + $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y" + expecting diff of a, foo, x and y + + HG: M: + HG: A: foo y + HG: R: a x + HG: diff -r 6de0c1bde1c8 a + HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 + HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 + HG: @@ -1,2 +0,0 @@ + HG: -a + HG: -a + HG: diff -r 6de0c1bde1c8 foo + HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 + HG: @@ -0,0 +1,1 @@ + HG: +foo + HG: diff -r 6de0c1bde1c8 x + HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 + HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 + HG: @@ -1,1 +0,0 @@ + HG: -x + HG: diff -r 6de0c1bde1c8 y + HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 + HG: @@ -0,0 +1,1 @@ + HG: +y Check for issue4405 -------------------