##// END OF EJS Templates
flags: read flag from dirstate/disk for workingcopyctx (issue5743)...
flags: read flag from dirstate/disk for workingcopyctx (issue5743) In 491855ea9d62, various piece of code are moved from committablectx to workingctx. The reason given is "These read from the dirstate, so they shouldn't be used in other subclasses." At least for `flags` this change introduce a bug, because the value flags end up being read from `_manifest` disregarding the actual state in the working copy (ie: on disk). When merging exec flag change with renames, this means a new files (the local content, renamed) is properly written on disk, with the right flags, but the flags part is later ignored when actually reading flags during merge. It is not clear to me why the `flags` function was moved, because the code does not actually hit the dirstate (the reason given in the changeset description). So I am moving it back to were it comes from and we use a simpler version of that code (that hit the dirstate everytime) in workingcopyctx. This fix the last know bug with merging rename and executable byte changes. Other similar bug might be lurking in 491855ea9d62, but I have not investigated them. Differential Revision: https://phab.mercurial-scm.org/D8534

File last commit:

r45399:4234c9af stable
r45399:4234c9af stable
Show More
test-merge-exec.t
213 lines | 4.4 KiB | text/troff | Tads3Lexer
/ tests / test-merge-exec.t
flags: introduce explicit testing for merging change to exec flag...
r45394 ===============================================
Testing merge involving change to the exec flag
===============================================
#require execbit
Initial setup
==============
$ hg init base-repo
$ cd base-repo
$ cat << EOF > a
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> EOF
$ touch b
$ hg add a b
$ hg commit -m "initial commit"
$ cd ..
Testing merging mode change
===========================
setup
Change on one side, executable bit on the other
$ hg clone base-repo simple-merge-repo
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd simple-merge-repo
$ chmod +x a
$ hg ci -m "make a executable, no change"
$ [ -x a ] || echo "executable bit not recorded"
$ hg up ".^"
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cat << EOF > a
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> x
> 9
> EOF
$ hg commit -m "edit end of file"
created new head
merge them (from the update side)
$ hg merge 'desc("make a executable, no change")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg st
M a
$ [ -x a ] || echo "executable bit lost"
merge them (from the chmod side)
$ hg up -C 'desc("make a executable, no change")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge 'desc("edit end of file")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg st
M a
$ [ -x a ] || echo "executable bit lost"
$ cd ..
flags: also test merging a rename with and exec flag change...
r45395 Testing merging mode change with rename
=======================================
$ hg clone base-repo rename-merge-repo
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd rename-merge-repo
make "a" executable on one side
$ chmod +x a
$ hg status
M a
$ hg ci -m "make a executable"
$ [ -x a ] || echo "executable bit not recorded"
$ hg up ".^"
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
make "a" renamed on the other side
$ hg mv a z
$ hg st --copies
A z
a
R a
$ hg ci -m "rename a to z"
created new head
merge them (from the rename side)
$ hg merge 'desc("make a executable")'
flags: account for flag change when tracking rename relevant to merge...
r45396 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
flags: also test merging a rename with and exec flag change...
r45395 (branch merge, don't forget to commit)
$ hg st --copies
flags: account for flag change when tracking rename relevant to merge...
r45396 M z
a
flags: also test merging a rename with and exec flag change...
r45395 $ [ -x z ] || echo "executable bit lost"
merge them (from the chmod side)
$ hg up -C 'desc("make a executable")'
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg merge 'desc("rename a to z")'
flags: account for flag change when tracking rename relevant to merge...
r45396 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
flags: also test merging a rename with and exec flag change...
r45395 (branch merge, don't forget to commit)
$ hg st --copies
M z
flags: account for flag change when tracking rename relevant to merge...
r45396 a
flags: also test merging a rename with and exec flag change...
r45395 R a
$ [ -x z ] || echo "executable bit lost"
$ cd ..
flags: add a test for merging exec flag change with rename and file change...
r45397
Testing merging mode change with rename + modification on both side
===================================================================
$ hg clone base-repo rename+mod-merge-repo
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd rename+mod-merge-repo
make "a" executable on one side
$ chmod +x a
$ cat << EOF > a
> 1
> x
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> EOF
$ hg status
M a
$ hg ci -m "make a executable, and change start"
$ [ -x a ] || echo "executable bit not recorded"
$ hg up ".^"
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
make "a" renamed on the other side
$ hg mv a z
$ hg st --copies
A z
a
R a
$ cat << EOF > z
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> x
> 9
> EOF
$ hg ci -m "rename a to z, and change end"
created new head
merge them (from the rename side)
$ hg merge 'desc("make a executable")'
merging z and a to z
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg st --copies
M z
a
$ [ -x z ] || echo "executable bit lost"
merge them (from the chmod side)
$ hg up -C 'desc("make a executable")'
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg merge 'desc("rename a to z")'
merging a and z to z
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg st --copies
M z
a
R a
$ [ -x z ] || echo "executable bit lost"
$ cd ..