Mercurial > hg
changeset 29181:dae38633eba8 stable
localrepo: prevent executable-bit only changes from being lost on amend
If you have just executable-bit change and amend it twice it will vanish:
* After the first amend the commit will have the proper executable bit set
in manifest but it won't have the the file on the list of files in
changelog.
* The second amend will read the wrong list of files from changelog and it
will copy the manifest entry from parent for this file.
* Voila! The change is lost.
This change repairs the bug in localrepo causing this and adds a test for it.
author | Mateusz Kwapich <mitrandir@fb.com> |
---|---|
date | Thu, 19 May 2016 14:35:22 -0700 |
parents | 8c5e880c7e25 |
children | bf7b8157c483 |
files | mercurial/localrepo.py tests/test-commit-amend.t |
diffstat | 2 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Sat May 21 02:48:51 2016 +0900 +++ b/mercurial/localrepo.py Thu May 19 14:35:22 2016 -0700 @@ -1404,6 +1404,8 @@ node = fctx.filenode() if node in [fparent1, fparent2]: self.ui.debug('reusing %s filelog entry\n' % fname) + if manifest1.flags(fname) != fctx.flags(): + changelist.append(fname) return node flog = self.file(fname)
--- a/tests/test-commit-amend.t Sat May 21 02:48:51 2016 +0900 +++ b/tests/test-commit-amend.t Thu May 19 14:35:22 2016 -0700 @@ -1156,3 +1156,21 @@ rev offset length delta linkrev nodeid p1 p2 0 0 88 -1 3 34a4d536c0c0 000000000000 000000000000 +Test if amend preserves executable bit changes + $ chmod +x newdirname/commonfile.py + $ hg ci -m chmod + $ hg ci --amend -m "chmod amended" + $ hg ci --amend -m "chmod amended second time" + $ hg log -p --git -r . + changeset: 8:b1326f52dddf + branch: newdirname + tag: tip + parent: 5:7fd235f7cb2f + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: chmod amended second time + + diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py + old mode 100644 + new mode 100755 +