Commit 6311ebaf authored by Pulkit Goyal's avatar Pulkit Goyal
Browse files

commit: implement a very crude fix


changes to: commit: implement a very crude fix
parent 270b22ca8057
Pipeline #19053 failed with stages
in 23 minutes and 6 seconds
......@@ -361,6 +361,8 @@ def _filecommit(
elif fparent2 != nullid:
if ms.active() and ms.extras(fname).get(b'filenode-source') == b'other':
fparent1, fparent2 = fparent2, nullid
elif (ms.active() and ms.extras(fname).get(b'merged') != b'yes'):
fparent1, fparent2 = fparent1, nullid
# is one parent an ancestor of the other?
else:
fparentancestors = flog.commonancestorsheads(fparent1, fparent2)
......@@ -369,6 +371,7 @@ def _filecommit(
elif fparent2 in fparentancestors:
fparent2 = nullid
force_new_node = False
# The file might have been deleted by merge code and user explicitly choose
# to revert the file and keep it. The other case can be where there is
......
......@@ -1656,6 +1656,7 @@ def applyupdates(
f1, f2, fa, move, anc = args
if f == b'.hgsubstate': # merged internally
continue
ms.addcommitinfo(f, {b'merged': b'yes'})
if f1 is None:
fcl = filemerge.absentfilectx(wctx, fa)
else:
......
......@@ -947,7 +947,8 @@ about that file should stay unchanged.
(merge variant 3)
$ hg up 'desc("mEAm")'
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1 files updated, 0 files merged, 1 files removed, 0 files unresolved (no-changeset !)
0 files updated, 0 files merged, 1 files removed, 0 files unresolved (changeset !)
$ hg merge 'desc("j-1")'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
......@@ -1671,24 +1672,22 @@ We upgrade a repository that is not using sidedata (the filelog case) and
'\x00\x00\x00\x00'
##### revision "mAEm-0 merge with copies info on both side - A side" #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00f'
merged : f, ;
entry-0014 size 4
'\x00\x00\x00\x00'
##### revision "mEAm-0 merge with copies info on both side - A side" #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00f'
merged : f, ;
entry-0014 size 4
'\x00\x00\x00\x00'
##### revision "mPQm-0 merge with copies info on both side - P side" #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00v'
merged : v, ;
'\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00v'
touched : v, ;
##### revision "mQPm-0 merge with copies info on both side - P side" #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00v'
merged : v, ;
'\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00v'
touched : v, ;
##### revision "f-1" #####
1 sidedata entries
entry-0014 size 24
......@@ -1737,13 +1736,13 @@ We upgrade a repository that is not using sidedata (the filelog case) and
##### revision "mDGm-0 actual content merge, copies on one side - D side" #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
merged : d, ;
'\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00d'
touched : d, ;
##### revision "mGDm-0 actual content merge, copies on one side - D side" #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
merged : d, ;
'\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00d'
touched : d, ;
##### revision "mFGm-0 merge - G side" #####
1 sidedata entries
entry-0014 size 14
......@@ -1791,13 +1790,13 @@ We upgrade a repository that is not using sidedata (the filelog case) and
##### revision "mAE-change-m-0 merge with file update and copies info on both side - A side" #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00f'
merged : f, ;
'\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00f'
touched : f, ;
##### revision "mEA-change-m-0 merge with file update and copies info on both side - A side" #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00f'
merged : f, ;
'\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00f'
touched : f, ;
##### revision "j-1" #####
1 sidedata entries
entry-0014 size 24
......@@ -2205,9 +2204,9 @@ Subcase: new copy information on both side
#if no-changeset
$ hg manifest --debug --rev 'desc("mAEm-0")' | grep '644 f'
2ff93c643948464ee1f871867910ae43a45b0bea 644 f
b76eb76580df486c3d51d63c5c210d4dd43a8ac7 644 f
$ hg manifest --debug --rev 'desc("mEAm-0")' | grep '644 f'
2ff93c643948464ee1f871867910ae43a45b0bea 644 f
e8825b386367b29fec957283a80bb47b47483fe1 644 f
$ hg manifest --debug --rev 'desc("a-2")' | grep '644 f'
b76eb76580df486c3d51d63c5c210d4dd43a8ac7 644 f
$ hg manifest --debug --rev 'desc("e-2")' | grep '644 f'
......@@ -2216,9 +2215,8 @@ Subcase: new copy information on both side
rev linkrev nodeid p1 p2
0 * b76eb76580df 000000000000 000000000000
1 * e8825b386367 000000000000 000000000000
2 * 2ff93c643948 b76eb76580df e8825b386367
3 * 2f649fba7eb2 b76eb76580df e8825b386367
4 * 774e7c1637d5 e8825b386367 b76eb76580df
2 * b22e3a8a9a5c b76eb76580df 000000000000
3 * 5237637b47ab e8825b386367 000000000000
#else
$ hg manifest --debug --rev 'desc("mAEm-0")' | grep '644 f'
ae258f702dfeca05bf9b6a22a97a4b5645570f11 644 f
......@@ -2240,8 +2238,6 @@ Subcase: new copy information on both side
# based on works fine. We have different output.
$ hg status --copies --rev 'desc("a-2")' --rev 'desc("mAEm-0")'
M f (no-changeset !)
b (no-filelog no-changeset !)
R b
$ hg status --copies --rev 'desc("a-2")' --rev 'desc("mEAm-0")'
M f (no-changeset !)
......@@ -2252,8 +2248,6 @@ Subcase: new copy information on both side
d (no-filelog no-changeset !)
R d
$ hg status --copies --rev 'desc("e-2")' --rev 'desc("mEAm-0")'
M f (no-changeset !)
d (no-filelog no-changeset !)
R d
$ hg status --copies --rev 'desc("i-2")' --rev 'desc("a-2")'
A f
......@@ -2282,8 +2276,7 @@ Subcase: new copy information on both side
R d
$ hg status --copies --rev 'desc("i-2")' --rev 'desc("mEAm-0")'
A f
d (filelog !)
b (no-filelog !)
b
R b
R d
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAEm-0")'
......@@ -2296,8 +2289,7 @@ Subcase: new copy information on both side
R p
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEAm-0")'
A f
a (filelog !)
b (no-filelog !)
b
A t
p
R a
......@@ -2540,14 +2532,13 @@ revision numbers)
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mDGm-0")'
A d
a (filelog !)
A t
p
R a
R p
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGDm-0")'
A d
a
a (no-changeset no-compatibility no-sidedata !)
A t
p
R a
......@@ -2565,26 +2556,17 @@ revision numbers)
$ hg log -Gfr 'desc("mDGm-0")' d
o mDGm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - one way
|\
| o g-1: update d
| |
o | d-2 re-add d
|/
o i-2: c -move-> d, s -move-> t
|
o i-1: a -move-> c, p -move-> s
| ~
o d-2 re-add d
|
o i-0 initial commit: a b h p q r
~
#else
BROKEN: `hg log --follow <file>` relies on filelog metadata to work
$ hg log -Gfr 'desc("mDGm-0")' d
o mDGm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - one way
|\
| o g-1: update d
| |
o | d-2 re-add d
|/
o i-2: c -move-> d, s -move-> t
| ~
o d-2 re-add d
|
~
#endif
......@@ -2594,26 +2576,17 @@ BROKEN: `hg log --follow <file>` relies on filelog metadata to work
$ hg log -Gfr 'desc("mDGm-0")' d
o mDGm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - one way
|\
| o g-1: update d
| |
o | d-2 re-add d
|/
o i-2: c -move-> d, s -move-> t
|
o i-1: a -move-> c, p -move-> s
| ~
o d-2 re-add d
|
o i-0 initial commit: a b h p q r
~
#else
BROKEN: `hg log --follow <file>` relies on filelog metadata to work
$ hg log -Gfr 'desc("mDGm-0")' d
o mDGm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - one way
|\
| o g-1: update d
| |
o | d-2 re-add d
|/
o i-2: c -move-> d, s -move-> t
| ~
o d-2 re-add d
|
~
#endif
......@@ -2793,9 +2766,9 @@ Subcase: new copy information on both side with an actual merge happening
#if no-changeset
$ hg manifest --debug --rev 'desc("mPQm-0")' | grep '644 v'
0946c662ef16e4e67397fd717389eb6693d41749 644 v
c0c92617f90a8760844ee02084b7d137ad952540 644 v
$ hg manifest --debug --rev 'desc("mQPm-0")' | grep '644 v'
0db3aad7fcc1ec27fab57060e327b9e864ea0cc9 644 v
f9c0803999aabee7bf5cca22e3bf9353e7742fea 644 v
$ hg manifest --debug --rev 'desc("p-2")' | grep '644 v'
3f91841cd75cadc9a1f1b4e7c1aa6d411f76032e 644 v
$ hg manifest --debug --rev 'desc("q-2")' | grep '644 v'
......@@ -2804,13 +2777,13 @@ Subcase: new copy information on both side with an actual merge happening
rev linkrev nodeid p1 p2
0 * 3f91841cd75c 000000000000 000000000000
1 * c43c088b811f 000000000000 000000000000
2 * 0946c662ef16 3f91841cd75c c43c088b811f
3 * 0db3aad7fcc1 c43c088b811f 3f91841cd75c
2 * c0c92617f90a 3f91841cd75c 000000000000
3 * f9c0803999aa c43c088b811f 000000000000
#else
$ hg manifest --debug --rev 'desc("mPQm-0")' | grep '644 v'
65fde9f6e4d4da23b3f610e07b53673ea9541d75 644 v
c6051c5e374a987727d56909f207f0ed72318891 644 v
$ hg manifest --debug --rev 'desc("mQPm-0")' | grep '644 v'
a098dda6413aecf154eefc976afc38b295acb7e5 644 v
38f69056b140039119237fa07593be5730007a58 644 v
$ hg manifest --debug --rev 'desc("p-2")' | grep '644 v'
5aed6a8dbff0301328c08360d24354d3d064cf0d 644 v
$ hg manifest --debug --rev 'desc("q-2")' | grep '644 v'
......@@ -2819,8 +2792,8 @@ Subcase: new copy information on both side with an actual merge happening
rev linkrev nodeid p1 p2
0 * 5aed6a8dbff0 000000000000 000000000000
1 * a38b2fa17021 000000000000 000000000000
2 * 65fde9f6e4d4 5aed6a8dbff0 a38b2fa17021
3 * a098dda6413a a38b2fa17021 5aed6a8dbff0
2 * c6051c5e374a 5aed6a8dbff0 000000000000
3 * 38f69056b140 a38b2fa17021 000000000000
#endif
# Here the filelog based implementation is not looking at the rename
......@@ -2870,16 +2843,14 @@ Subcase: new copy information on both side with an actual merge happening
R t
$ hg status --copies --rev 'desc("i-2")' --rev 'desc("mQPm-0")'
A v
t (filelog !)
r (no-filelog !)
r
R r
R t
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mPQm-0")'
A d
a
A v
r (filelog !)
p (no-filelog !)
p
R a
R p
R r
......@@ -3091,9 +3062,9 @@ Subcase: merge has same initial content on both side, but merge introduced a cha
#if no-changeset
$ hg manifest --debug --rev 'desc("mAE-change-m-0")' | grep '644 f'
2f649fba7eb284e720d02b61f0546fcef694c045 644 f
b22e3a8a9a5cec639ec24ff91cee47032caa70ab 644 f
$ hg manifest --debug --rev 'desc("mEA-change-m-0")' | grep '644 f'
774e7c1637d536b99e2d8ef16fd731f87a82bd09 644 f
5237637b47abcdb1a937ec5cee7788f991279df5 644 f
$ hg manifest --debug --rev 'desc("a-2")' | grep '644 f'
b76eb76580df486c3d51d63c5c210d4dd43a8ac7 644 f
$ hg manifest --debug --rev 'desc("e-2")' | grep '644 f'
......@@ -3102,9 +3073,8 @@ Subcase: merge has same initial content on both side, but merge introduced a cha
rev linkrev nodeid p1 p2
0 * b76eb76580df 000000000000 000000000000
1 * e8825b386367 000000000000 000000000000
2 * 2ff93c643948 b76eb76580df e8825b386367
3 * 2f649fba7eb2 b76eb76580df e8825b386367
4 * 774e7c1637d5 e8825b386367 b76eb76580df
2 * b22e3a8a9a5c b76eb76580df 000000000000
3 * 5237637b47ab e8825b386367 000000000000
#else
$ hg manifest --debug --rev 'desc("mAE-change-m-0")' | grep '644 f'
d3613c1ec8310a812ac4268fd853ac576b6caea5 644 f
......@@ -3168,8 +3138,7 @@ Subcase: merge has same initial content on both side, but merge introduced a cha
R d
$ hg status --copies --rev 'desc("i-2")' --rev 'desc("mEA-change-m-0")'
A f
d (filelog !)
b (no-filelog !)
b
R b
R d
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAE-change-m-0")'
......@@ -3182,8 +3151,7 @@ Subcase: merge has same initial content on both side, but merge introduced a cha
R p
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEA-change-m-0")'
A f
a (filelog !)
b (no-filelog !)
b
A t
p
R a
......@@ -3231,21 +3199,21 @@ The result from mEAm is the same for the subsequent merge:
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEAm")' f
A f
a (filelog !)
b (filelog !)
b (sidedata !)
b (upgraded !)
b (upgraded-parallel !)
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEA,Jm")' f
A f
a (filelog !)
b (filelog !)
b (sidedata !)
b (upgraded !)
b (upgraded-parallel !)
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mJ,EAm")' f
A f
a (filelog !)
b (filelog !)
b (sidedata !)
b (upgraded !)
b (upgraded-parallel !)
......@@ -3262,21 +3230,21 @@ The result from mPQm is the same for the subsequent merge:
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mPQm")' v
A v
r (filelog !)
p (filelog !)
p (sidedata !)
p (upgraded !)
p (upgraded-parallel !)
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mPQ,Tm")' v
A v
r (filelog !)
p (filelog !)
p (sidedata !)
p (upgraded !)
p (upgraded-parallel !)
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mT,PQm")' v
A v
r (filelog !)
p (filelog !)
p (sidedata !)
p (upgraded !)
p (upgraded-parallel !)
......@@ -3443,21 +3411,21 @@ The result from mEAm is the same for the subsequent merge:
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEA-change-m")' f
A f
a (filelog !)
b (filelog !)
b (sidedata !)
b (upgraded !)
b (upgraded-parallel !)
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEA-change,Jm")' f
A f
a (filelog !)
b (filelog !)
b (sidedata !)
b (upgraded !)
b (upgraded-parallel !)
$ hg status --copies --rev 'desc("i-0")' --rev 'desc("mJ,EA-change-m")' f
A f
a (filelog !)
b (filelog !)
b (sidedata !)
b (upgraded !)
b (upgraded-parallel !)
......@@ -540,6 +540,7 @@ Do all the merge combination (from the deleted or the update side × keeping and
other path: the-file (node 59e363a07dc876278f0e41756236f30213b6b460)
extra: ancestorlinknode = 955800955977bd6c103836ee3e437276e940a589
extra: merge-removal-candidate = yes
extra: merged = yes
extra: other-file (filenode-source = other)
$ hg ci -m "merge-deleting-the-file-from-deleted"
$ hg manifest
......@@ -563,6 +564,7 @@ Do all the merge combination (from the deleted or the update side × keeping and
other path: the-file (node 0000000000000000000000000000000000000000)
extra: ancestorlinknode = 955800955977bd6c103836ee3e437276e940a589
extra: merge-removal-candidate = yes
extra: merged = yes
$ hg ci -m "merge-deleting-the-file-from-updated"
created new head
$ hg manifest
......@@ -586,6 +588,7 @@ Do all the merge combination (from the deleted or the update side × keeping and
other path: the-file (node 59e363a07dc876278f0e41756236f30213b6b460)
extra: ancestorlinknode = 955800955977bd6c103836ee3e437276e940a589
extra: merge-removal-candidate = yes
extra: merged = yes
extra: other-file (filenode-source = other)
$ hg ci -m "merge-keeping-the-file-from-deleted"
created new head
......@@ -614,6 +617,7 @@ Do all the merge combination (from the deleted or the update side × keeping and
other path: the-file (node 0000000000000000000000000000000000000000)
extra: ancestorlinknode = 955800955977bd6c103836ee3e437276e940a589
extra: merge-removal-candidate = yes
extra: merged = yes
$ hg ci -m "merge-keeping-the-file-from-updated"
created new head
$ hg manifest
......@@ -695,6 +699,7 @@ the conflict is properly detected.
other path: the-file (node 885af55420b35d7bf3bbd6f546615295bfe6544a)
extra: ancestorlinknode = 9b610631ab29024c5f44af7d2c19658ef8f8f071
extra: merge-removal-candidate = yes
extra: merged = yes
#else
$ hg debugmergestate
local (working copy): adfd88e5d7d3d3e22bdd26512991ee64d59c1d8f
......@@ -763,6 +768,7 @@ BROKEN: this should result in conflict
other path: the-file (node 885af55420b35d7bf3bbd6f546615295bfe6544a)
extra: ancestorlinknode = 9b610631ab29024c5f44af7d2c19658ef8f8f071
extra: merge-removal-candidate = yes
extra: merged = yes
#else
$ hg debugmergestate
local (working copy): a4e0e44229dc130be2915b92c957c093f8c7ee3e
......@@ -886,6 +892,7 @@ BROKEN: this should result in conflict
other path: the-file (node 0000000000000000000000000000000000000000)
extra: ancestorlinknode = 9b610631ab29024c5f44af7d2c19658ef8f8f071
extra: merge-removal-candidate = yes
extra: merged = yes
#else
$ hg debugmergestate
local (working copy): e9b7081317232edce73f7ad5ae0b7807ff5c326a
......@@ -923,6 +930,7 @@ BROKEN: this should result in conflict
other path: the-file (node 0000000000000000000000000000000000000000)
extra: ancestorlinknode = 9b610631ab29024c5f44af7d2c19658ef8f8f071
extra: merge-removal-candidate = yes
extra: merged = yes
#else
$ hg debugmergestate
local (working copy): e9b7081317232edce73f7ad5ae0b7807ff5c326a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment