** Test for handling of phase divergent changesets by `hg evolve` **
====================================================================
$ cat >> $HGRCPATH <<EOF
> [alias]
> glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
> EOF
Setting up a public repo
------------------------
$ hg init public
$ cd public
$ echo a > a
$ mkcommit() {
> echo "$1" > "$1"
> hg add "$1"
> hg ci -m "add $1"
> }
$ hg commit -A -m init
adding a
$ cd ..
$ evolvepath=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/
Setting up a private non-publishing repo
----------------------------------------
$ hg clone -U public private
$ cd private
$ cat >> .hg/hgrc <<EOF
> [extensions]
> evolve = $evolvepath
> [ui]
> logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline}\n
> [phases]
> publish = false
> EOF
$ cd ..
Setting up couple of more instances of private repo
---------------------------------------------------
$ cp -a private alice
$ cp -a private bob
Creating a phase-divergence changeset
-------------------------------------
Alice creating a draft changeset and pushing to main private repo
$ cd alice
$ hg update
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo a >> a
$ hg commit -u alice -m 'modify a'
$ hg push ../private
pushing to ../private
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
$ hg glog
@ 1:4d1169d82e47 modify a
| () draft
o 0:d3873e73d99e init
() public
Bob pulling from private repo and pushing to the main public repo making the
changeset public
$ cd ../bob
$ hg pull ../private
pulling from ../private
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
new changesets 4d1169d82e47
(run 'hg update' to get a working copy)
$ hg glog
o 1:4d1169d82e47 modify a
| () draft
o 0:d3873e73d99e init
() public
$ hg push ../public
pushing to ../public
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
$ hg glog
o 1:4d1169d82e47 modify a
| () public
o 0:d3873e73d99e init
() public
*But* Alice decided to amend the changeset she had and then pulling from public
repo creating phase-divergent changeset locally
$ cd ../alice
$ hg amend -m 'tweak a'
XXX: pull should tell us how to see what is the new phase-divergent changeset
$ hg pull ../public
pulling from ../public
searching for changes
no changes found
1 new phase-divergent changesets
$ hg glog
@ 2:98bb3a6cfe1a tweak a
| () draft
| o 1:4d1169d82e47 modify a
|/ () public
o 0:d3873e73d99e init
() public
Using evolve --list to list phase-divergent changesets
------------------------------------------------------
$ hg evolve --list
98bb3a6cfe1a: tweak a
phase-divergent: 4d1169d82e47 (immutable precursor)
XXX-Pulkit: Trying to see instability on public changeset
XXX-Pulkit: this is not helpful
XXX-Marmoute: public changeset "instable themself"
XXX-Marmoute: I'm not sure if we store this information and it is useful to show it.
XXX-Marmoute: We should maybe point the user toward `hg obslog` instead`
$ hg evolve -r 4d1169d8 --list
4d1169d82e47: modify a
Understanding phasedivergence using obslog
------------------------------------------
XXX: There must be mention of phase-divergence here
$ hg obslog -r . --all
@ 98bb3a6cfe1a (2) tweak a
|
o 4d1169d82e47 (1) modify a
rewritten(description) as 98bb3a6cfe1a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
Solving the phase divergence using evolve command
--------------------------------------------------
(We do not solve evolution other than orphan by default because it turned out
it was too confusing for users. We used to behave this way, but having multiple
possible outcome to evolve end up scaring people)
$ hg evolve
nothing to evolve on current working copy parent
(do you want to use --phase-divergent)
[2]
testing the --confirm option
$ hg evolve --phase-divergent --confirm <<EOF
> n
> EOF
recreate:[2] tweak a
atop:[1] modify a
perform evolve? [Ny] n
abort: evolve aborted by user
[255]
testing the --dry-run option
$ hg evolve --phase-divergent --dry-run
recreate:[2] tweak a
atop:[1] modify a
hg rebase --rev 98bb3a6cfe1a --dest d3873e73d99e;
hg update 4d1169d82e47;
hg revert --all --rev 98bb3a6cfe1a;
hg commit --msg "phase-divergent update to 98bb3a6cfe1a"
XXX: evolve should have mentioned that draft commit is just obsoleted in favour
of public one. From the message it looks like a new commit is created.
$ hg evolve --phase-divergent
recreate:[2] tweak a
atop:[1] modify a
computing new diff
committed as 4d1169d82e47
working directory is now at 4d1169d82e47
$ hg glog
@ 1:4d1169d82e47 modify a
| () public
o 0:d3873e73d99e init
() public
Bumped Merge changeset:
-----------------------
We currently cannot automatically solve bumped changeset that is the
product of a merge, we add a test for it.
$ mkcommit _a
$ hg up .^
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ mkcommit _b
created new head
$ mkcommit _c
$ hg log -G
@ 5:eeaf70969381@default(draft) add _c
|
o 4:6612fc0ddeb6@default(draft) add _b
|
| o 3:154ad198ff4a@default(draft) add _a
|/
o 1:4d1169d82e47@default(public) modify a
|
o 0:d3873e73d99e@default(public) init
$ hg merge 3
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg commit -m "merge"
$ hg commit --amend -m "New message"
$ hg phase --public 551127da2a8a --hidden
1 new phase-divergent changesets
$ hg log -G
@ 7:b28e84916d8c@default(draft) New message
|\
+---o 6:551127da2a8a@default(public) merge
| |/
| o 5:eeaf70969381@default(public) add _c
| |
| o 4:6612fc0ddeb6@default(public) add _b
| |
o | 3:154ad198ff4a@default(public) add _a
|/
o 1:4d1169d82e47@default(public) modify a
|
o 0:d3873e73d99e@default(public) init
$ hg evolve --all --phase-divergent
skipping b28e84916d8c : we do not handle merge yet