test: add test for content divergence involving a date update
In this case, each side update the date.
Content divergence and trying to relocate a node on top of itself (issue5958)
https://bz.mercurial-scm.org/show_bug.cgi?id=5958
$ . $TESTDIR/testlib/common.sh
$ cat << EOF >> $HGRCPATH
> [extensions]
> rebase =
> evolve =
> EOF
$ hg init issue5958
$ cd issue5958
$ echo hi > r0
$ hg ci -qAm 'add r0'
$ echo hi > foo.txt
$ hg ci -qAm 'add foo.txt'
$ hg metaedit -r . -d '0 2'
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
(Make changes in unrelated files so that we don't have any merge conflicts
during the rebase, but the two touched revisions aren't identical)
date: updated on both side to the same value
$ echo hi > bar.txt
$ hg add -q bar.txt
$ hg amend -q
$ hg metaedit -r 1 -d '0 1' --hidden
2 new content-divergent changesets
$ hg log -r tip
changeset: 4:c17bf400a278
tag: tip
parent: 0:a24ed8ad918c
user: test
date: Wed Dec 31 23:59:59 1969 -0000
instability: content-divergent
summary: add foo.txt
$ echo hi > baz.txt
$ hg add -q baz.txt
$ hg amend -q
$ hg rebase -qr tip -d 4
$ hg log -G
@ changeset: 6:08bc7ba82799
| tag: tip
| parent: 4:c17bf400a278
| user: test
| date: Wed Dec 31 23:59:58 1969 -0000
| instability: content-divergent
| summary: add foo.txt
|
* changeset: 4:c17bf400a278
| parent: 0:a24ed8ad918c
| user: test
| date: Wed Dec 31 23:59:59 1969 -0000
| instability: content-divergent
| summary: add foo.txt
|
o changeset: 0:a24ed8ad918c
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add r0
$ hg obslog -a -r .
@ 08bc7ba82799 (6) add foo.txt
|
| * c17bf400a278 (4) add foo.txt
| |
x | 1d1fc409af98 (5) add foo.txt
| | rewritten(parent, content) as 08bc7ba82799 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
| |
x | a25dd7af6cf6 (3) add foo.txt
| | rewritten(content) as 1d1fc409af98 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
| |
x | 0065551bd38f (2) add foo.txt
|/ rewritten(content) as a25dd7af6cf6 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
|
x cc71ffbc7c00 (1) add foo.txt
rewritten(date) as 0065551bd38f using metaedit by test (Thu Jan 01 00:00:00 1970 +0000)
rewritten(date) as c17bf400a278 using metaedit by test (Thu Jan 01 00:00:00 1970 +0000)
$ hg evolve --list --rev .
08bc7ba82799: add foo.txt
content-divergent: c17bf400a278 (draft) (precursor cc71ffbc7c00)
$ hg log --hidden -r cc71ffbc7c00 -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
1 cc71ffbc7c00 1970-01-01 00:00 +0000: date-changed using metaedit as 4:c17bf400a278; date-changed using metaedit as 2:0065551bd38f
$ hg log -r 'desc("add foo.txt")' -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
4 c17bf400a278 1969-12-31 23:59 -0000:
6 08bc7ba82799 1969-12-31 23:59 -0000:
$ hg evolve --content-divergent
merge:[6] add foo.txt
with: [4] add foo.txt
base: [1] add foo.txt
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1 new orphan changesets
working directory is now at 2372e6d39855
$ hg log -r 'desc("add foo.txt")' -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
4 c17bf400a278 1969-12-31 23:59 -0000: rewritten using evolve as 7:2372e6d39855
7 2372e6d39855 1970-01-01 00:00 +0000:
7 bb2424887202 1969-12-31 23:59 +0000: (false !)
date: updated one one side to an older value
$ hg evolve -r .
move:[7] add foo.txt
atop:[0] add r0
working directory is now at 2b9788beff53
$ hg update --hidden --rev 'predecessors(.)'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
updated to hidden changeset 2372e6d39855
(hidden revision '2372e6d39855' was rewritten as: 2b9788beff53)
working directory parent is obsolete! (2372e6d39855)
(use 'hg evolve' to update to its successor: 2b9788beff53)
$ hg amend --date "0 2"
1 new orphan changesets
2 new content-divergent changesets
$ hg rebase -r . -d 0
rebasing 9:88085147662e "add foo.txt" (tip)
$ hg log -G
@ changeset: 10:873d828420d8
| tag: tip
| parent: 0:a24ed8ad918c
| user: test
| date: Wed Dec 31 23:59:58 1969 -0000
| instability: content-divergent
| summary: add foo.txt
|
| * changeset: 8:2b9788beff53
|/ parent: 0:a24ed8ad918c
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| instability: content-divergent
| summary: add foo.txt
|
o changeset: 0:a24ed8ad918c
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add r0
$ hg evolve --list -r .
873d828420d8: add foo.txt
content-divergent: 2b9788beff53 (draft) (precursor 2372e6d39855)
$ hg log -r 2372e6d39855+873d828420d8+2b9788beff53 --hidden -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
7 2372e6d39855 1970-01-01 00:00 +0000: date-changed using amend as 9:88085147662e; rebased using evolve as 8:2b9788beff53
10 873d828420d8 1969-12-31 23:59 -0000:
8 2b9788beff53 1970-01-01 00:00 +0000:
$ hg evolve --content-divergent
merge:[8] add foo.txt
with: [10] add foo.txt
base: [7] add foo.txt
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
working directory is now at bb2424887202
$ hg log -r . --hidden -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
11 bb2424887202 1970-01-01 00:00 +0000:
11 bb2424887202 1969-12-31 23:59 +0000: (false !)
date: updated one side to an newer value
$ hg update --hidden --rev 'predecessors(.)'
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
updated to hidden changeset 873d828420d8
(hidden revision '873d828420d8' was rewritten as: bb2424887202)
working directory parent is obsolete! (873d828420d8)
(use 'hg evolve' to update to its successor: bb2424887202)
$ hg amend --date "120 0"
2 new content-divergent changesets
$ hg log -G
@ changeset: 12:902e190ef559
| tag: tip
| parent: 0:a24ed8ad918c
| user: test
| date: Thu Jan 01 00:02:00 1970 +0000
| instability: content-divergent
| summary: add foo.txt
|
| * changeset: 11:bb2424887202
|/ parent: 0:a24ed8ad918c
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| instability: content-divergent
| summary: add foo.txt
|
o changeset: 0:a24ed8ad918c
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add r0
$ hg evolve --list -r .
902e190ef559: add foo.txt
content-divergent: bb2424887202 (draft) (precursor 873d828420d8)
$ hg up bb2424887202
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg log -r 873d828420d8+bb2424887202+902e190ef559 --hidden -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
10 873d828420d8 1969-12-31 23:59 -0000: date-changed using evolve as 11:bb2424887202; date-changed using amend as 12:902e190ef559
11 bb2424887202 1970-01-01 00:00 +0000:
12 902e190ef559 1970-01-01 00:02 +0000:
$ hg evolve --content-divergent
merge:[11] add foo.txt
with: [12] add foo.txt
base: [10] add foo.txt
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
nothing changed
$ hg log -r . --hidden -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
11 bb2424887202 1970-01-01 00:00 +0000:
13 bb2424887202 1970-01-01 00:02 +0000: (false !)
date: updated each side to a different value, newer should win
$ hg amend --date "235 0"
$ hg update --hidden --rev 'predecessors(.)'
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
updated to hidden changeset bb2424887202
(hidden revision 'bb2424887202' was rewritten as: 48132e92d706)
working directory parent is obsolete! (bb2424887202)
(use 'hg evolve' to update to its successor: 48132e92d706)
$ hg amend --date "784 0"
2 new content-divergent changesets
$ hg log -G
@ changeset: 14:694c3cf6b929
| tag: tip
| parent: 0:a24ed8ad918c
| user: test
| date: Thu Jan 01 00:13:04 1970 +0000
| instability: content-divergent
| summary: add foo.txt
|
| * changeset: 13:48132e92d706
|/ parent: 0:a24ed8ad918c
| user: test
| date: Thu Jan 01 00:03:55 1970 +0000
| instability: content-divergent
| summary: add foo.txt
|
o changeset: 0:a24ed8ad918c
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add r0
$ hg evolve --list -r .
694c3cf6b929: add foo.txt
content-divergent: 48132e92d706 (draft) (precursor bb2424887202)
$ hg log -r bb2424887202+48132e92d706+694c3cf6b929 --hidden -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
11 bb2424887202 1970-01-01 00:00 +0000: date-changed using amend as 14:694c3cf6b929; date-changed using amend as 13:48132e92d706
13 48132e92d706 1970-01-01 00:03 +0000:
14 694c3cf6b929 1970-01-01 00:13 +0000:
$ hg evolve --content-divergent
merge:[13] add foo.txt
with: [14] add foo.txt
base: [12] add foo.txt
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
working directory is now at a24ed8ad918c
$ hg log -r . --hidden -T '{rev} {node|short} {date|isodate}: {join(obsfate, "; ")}\n'
0 a24ed8ad918c 1970-01-01 00:00 +0000:
16 bb2424887202 1970-01-01 00:13 +0000: (false !)