2012-08-01 21:35:05 +04:00
|
|
|
Check that obsolete properly strip heads
|
|
|
|
$ cat >> $HGRCPATH << EOF
|
|
|
|
> [phases]
|
|
|
|
> # public changeset are not obsolete
|
|
|
|
> publish=false
|
|
|
|
> [ui]
|
|
|
|
> logtemplate='{node|short} ({phase}) {desc|firstline}\n'
|
2014-10-15 00:34:25 +04:00
|
|
|
> [experimental]
|
2017-09-28 20:19:06 +03:00
|
|
|
> evolution.createmarkers=True
|
2012-08-01 21:35:05 +04:00
|
|
|
> EOF
|
|
|
|
$ mkcommit() {
|
|
|
|
> echo "$1" > "$1"
|
|
|
|
> hg add "$1"
|
|
|
|
> hg ci -m "add $1"
|
|
|
|
> }
|
|
|
|
$ getid() {
|
|
|
|
> hg id --debug -ir "desc('$1')"
|
|
|
|
> }
|
|
|
|
|
|
|
|
|
|
|
|
$ hg init remote
|
|
|
|
$ cd remote
|
|
|
|
$ mkcommit base
|
|
|
|
$ hg phase --public .
|
|
|
|
$ cd ..
|
2016-11-30 22:25:18 +03:00
|
|
|
$ cp -R remote base
|
2012-08-01 21:35:05 +04:00
|
|
|
$ hg clone remote local
|
|
|
|
updating to branch default
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd local
|
|
|
|
|
|
|
|
New head replaces old head
|
|
|
|
==========================
|
|
|
|
|
|
|
|
setup
|
2012-10-19 02:50:12 +04:00
|
|
|
(we add the 1 flags to prevent bumped error during the test)
|
2012-08-01 21:35:05 +04:00
|
|
|
|
|
|
|
$ mkcommit old
|
|
|
|
$ hg push
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/remote
|
2012-08-01 21:35:05 +04:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
|
|
|
$ hg up -q '.^'
|
|
|
|
$ mkcommit new
|
|
|
|
created new head
|
2012-10-19 02:50:12 +04:00
|
|
|
$ hg debugobsolete --flags 1 `getid old` `getid new`
|
2017-07-16 03:33:14 +03:00
|
|
|
obsoleted 1 changesets
|
2013-11-22 22:14:17 +04:00
|
|
|
$ hg log -G --hidden
|
2012-08-01 21:35:05 +04:00
|
|
|
@ 71e3228bffe1 (draft) add new
|
|
|
|
|
|
|
|
|
| x c70b08862e08 (draft) add old
|
|
|
|
|/
|
|
|
|
o b4952fcf48cf (public) add base
|
|
|
|
|
2016-11-30 22:25:18 +03:00
|
|
|
$ cp -R ../remote ../backup1
|
2012-08-01 21:35:05 +04:00
|
|
|
|
|
|
|
old exists remotely as draft. It is obsoleted by new that we now push.
|
|
|
|
Push should not warn about creating new head
|
|
|
|
|
|
|
|
$ hg push
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/remote
|
2012-08-01 21:35:05 +04:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files (+1 heads)
|
|
|
|
|
2012-08-24 18:52:45 +04:00
|
|
|
old head is now public (public local version)
|
|
|
|
=============================================
|
|
|
|
|
|
|
|
setup
|
|
|
|
|
|
|
|
$ rm -fr ../remote
|
2016-11-30 22:25:18 +03:00
|
|
|
$ cp -R ../backup1 ../remote
|
2012-08-24 18:52:45 +04:00
|
|
|
$ hg -R ../remote phase --public c70b08862e08
|
|
|
|
$ hg pull -v
|
2017-12-11 06:50:57 +03:00
|
|
|
pulling from $TESTTMP/remote
|
2012-08-24 18:52:45 +04:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
2013-11-22 22:14:17 +04:00
|
|
|
$ hg log -G --hidden
|
2012-08-24 18:52:45 +04:00
|
|
|
@ 71e3228bffe1 (draft) add new
|
|
|
|
|
|
|
|
|
| o c70b08862e08 (public) add old
|
|
|
|
|/
|
|
|
|
o b4952fcf48cf (public) add base
|
|
|
|
|
|
|
|
|
|
|
|
Abort: old will still be an head because it's public.
|
|
|
|
|
|
|
|
$ hg push
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/remote
|
2012-08-24 18:52:45 +04:00
|
|
|
searching for changes
|
|
|
|
abort: push creates new remote head 71e3228bffe1!
|
2016-09-21 02:47:30 +03:00
|
|
|
(merge or see 'hg help push' for details about pushing new heads)
|
2012-08-24 18:52:45 +04:00
|
|
|
[255]
|
|
|
|
|
|
|
|
old head is now public (public remote version)
|
|
|
|
==============================================
|
|
|
|
|
|
|
|
TODO: Not implemented yet.
|
|
|
|
|
|
|
|
# setup
|
|
|
|
#
|
|
|
|
# $ rm -fr ../remote
|
2016-11-30 22:25:18 +03:00
|
|
|
# $ cp -R ../backup1 ../remote
|
2012-08-24 18:52:45 +04:00
|
|
|
# $ hg -R ../remote phase --public c70b08862e08
|
|
|
|
# $ hg phase --draft --force c70b08862e08
|
2013-11-22 22:14:17 +04:00
|
|
|
# $ hg log -G --hidden
|
2012-08-24 18:52:45 +04:00
|
|
|
# @ 71e3228bffe1 (draft) add new
|
|
|
|
# |
|
|
|
|
# | x c70b08862e08 (draft) add old
|
|
|
|
# |/
|
|
|
|
# o b4952fcf48cf (public) add base
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Abort: old will still be an head because it's public.
|
|
|
|
#
|
|
|
|
# $ hg push
|
|
|
|
# pushing to $TESTTMP/remote
|
|
|
|
# searching for changes
|
|
|
|
# abort: push creates new remote head 71e3228bffe1!
|
2016-09-21 02:49:20 +03:00
|
|
|
# (merge or see 'hg help push' for details about pushing new heads)
|
2012-08-24 18:52:45 +04:00
|
|
|
# [255]
|
|
|
|
|
|
|
|
old head is obsolete but replacement is not pushed
|
2012-08-01 21:35:05 +04:00
|
|
|
==================================================
|
|
|
|
|
|
|
|
setup
|
|
|
|
|
|
|
|
$ rm -fr ../remote
|
2016-11-30 22:25:18 +03:00
|
|
|
$ cp -R ../backup1 ../remote
|
2012-08-24 18:52:45 +04:00
|
|
|
$ hg phase --draft --force '(0::) - 0'
|
2012-08-01 21:35:05 +04:00
|
|
|
$ hg up -q '.^'
|
|
|
|
$ mkcommit other
|
|
|
|
created new head
|
2013-11-22 22:14:17 +04:00
|
|
|
$ hg log -G --hidden
|
2012-08-01 21:35:05 +04:00
|
|
|
@ d7d41ccbd4de (draft) add other
|
|
|
|
|
|
|
|
|
| o 71e3228bffe1 (draft) add new
|
|
|
|
|/
|
|
|
|
| x c70b08862e08 (draft) add old
|
|
|
|
|/
|
|
|
|
o b4952fcf48cf (public) add base
|
|
|
|
|
|
|
|
|
|
|
|
old exists remotely as draft. It is obsoleted by new but we don't push new.
|
|
|
|
Push should abort on new head
|
|
|
|
|
|
|
|
$ hg push -r 'desc("other")'
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/remote
|
2012-08-01 21:35:05 +04:00
|
|
|
searching for changes
|
|
|
|
abort: push creates new remote head d7d41ccbd4de!
|
2016-09-21 02:47:30 +03:00
|
|
|
(merge or see 'hg help push' for details about pushing new heads)
|
2012-08-01 21:35:05 +04:00
|
|
|
[255]
|
2012-08-26 02:25:33 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Both precursors and successors are already know remotely. Descendant adds heads
|
|
|
|
===============================================================================
|
|
|
|
|
|
|
|
setup. (The obsolete marker is known locally only
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
$ rm -rf local
|
|
|
|
$ hg clone remote local
|
|
|
|
updating to branch default
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd local
|
|
|
|
$ mkcommit old
|
|
|
|
old already tracked!
|
|
|
|
nothing changed
|
|
|
|
[1]
|
|
|
|
$ hg up -q '.^'
|
|
|
|
$ mkcommit new
|
|
|
|
created new head
|
|
|
|
$ hg push -f
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/remote
|
2012-08-26 02:25:33 +04:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files (+1 heads)
|
|
|
|
$ mkcommit desc1
|
|
|
|
$ hg up -q '.^'
|
|
|
|
$ mkcommit desc2
|
|
|
|
created new head
|
|
|
|
$ hg debugobsolete `getid old` `getid new`
|
2017-07-16 03:33:14 +03:00
|
|
|
obsoleted 1 changesets
|
2013-11-22 22:14:17 +04:00
|
|
|
$ hg log -G --hidden
|
2012-08-26 02:25:33 +04:00
|
|
|
@ 5fe37041cc2b (draft) add desc2
|
|
|
|
|
|
|
|
|
| o a3ef1d111c5f (draft) add desc1
|
|
|
|
|/
|
|
|
|
o 71e3228bffe1 (draft) add new
|
|
|
|
|
|
|
|
|
| x c70b08862e08 (draft) add old
|
|
|
|
|/
|
|
|
|
o b4952fcf48cf (public) add base
|
|
|
|
|
2013-11-22 22:14:17 +04:00
|
|
|
$ hg log -G --hidden -R ../remote
|
2012-08-26 02:25:33 +04:00
|
|
|
o 71e3228bffe1 (draft) add new
|
|
|
|
|
|
|
|
|
| o c70b08862e08 (draft) add old
|
|
|
|
|/
|
|
|
|
@ b4952fcf48cf (public) add base
|
|
|
|
|
2016-11-30 22:25:18 +03:00
|
|
|
$ cp -R ../remote ../backup2
|
2012-08-26 02:25:33 +04:00
|
|
|
|
|
|
|
Push should not warn about adding new heads. We create one, but we'll delete
|
|
|
|
one anyway.
|
|
|
|
|
|
|
|
$ hg push
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/remote
|
2012-08-26 02:25:33 +04:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 2 changesets with 2 changes to 2 files (+1 heads)
|
|
|
|
|
|
|
|
|
|
|
|
Remote head is unknown but obsoleted by a local changeset
|
|
|
|
=========================================================
|
|
|
|
|
|
|
|
setup
|
|
|
|
|
|
|
|
$ rm -fr ../remote
|
2016-11-30 22:25:18 +03:00
|
|
|
$ cp -R ../backup1 ../remote
|
2012-08-26 02:25:33 +04:00
|
|
|
$ cd ..
|
|
|
|
$ rm -rf local
|
|
|
|
$ hg clone remote local -r 0
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets b4952fcf48cf
|
2012-08-26 02:25:33 +04:00
|
|
|
updating to branch default
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd local
|
|
|
|
$ mkcommit new
|
|
|
|
$ hg -R ../remote id --debug -r tip
|
|
|
|
c70b08862e0838ea6d7c59c85da2f1ed6c8d67da tip
|
|
|
|
$ hg id --debug -r tip
|
|
|
|
71e3228bffe1886550777233d6c97bb5a6b2a650 tip
|
|
|
|
$ hg debugobsolete c70b08862e0838ea6d7c59c85da2f1ed6c8d67da 71e3228bffe1886550777233d6c97bb5a6b2a650
|
2013-11-22 22:14:17 +04:00
|
|
|
$ hg log -G --hidden
|
2012-08-26 02:25:33 +04:00
|
|
|
@ 71e3228bffe1 (draft) add new
|
|
|
|
|
|
|
|
|
o b4952fcf48cf (public) add base
|
|
|
|
|
2013-11-22 22:14:17 +04:00
|
|
|
$ hg log -G --hidden -R ../remote
|
2012-08-26 02:25:33 +04:00
|
|
|
o c70b08862e08 (draft) add old
|
|
|
|
|
|
|
|
|
@ b4952fcf48cf (public) add base
|
|
|
|
|
|
|
|
|
checkheads: upgrade the obsolescence postprocessing logic (issue4354)
The previous logic had many shortcoming (eg: looking at the head only, not
handling prune, etc...), the new logic use a more robust approach:
For each head, we check if after the push all changesets exclusive to this heads
will be obsolete. If they are, the branch considered be "replaced".
To check if a changeset will be obsolete, we simply checks:
* the changeset phase
* the existence of a marker relevant to the "pushed set" that affects the
changesets..
This fixes two major issues of the previous algorithm:
* branch partially rewritten (eg: head but not root) are no longer detected as
replaced,
* Prune are now properly handled.
(This implementation was introduction in the evolve extension, version 6.0.0.)
This new algorithm has an extended number of tests, a basic one is provided
in this patch. The others will be introduced in their own changeset for clarity.
In addition, we stop trying to process heads unknown locally, we do not have
enough data to take an informed decision so we should stop pretending we do.
This reflect a test that is now update.
2017-04-15 03:55:18 +03:00
|
|
|
We do not have enought data to take the right decision, we should fail
|
2012-08-26 02:25:33 +04:00
|
|
|
|
checkheads: upgrade the obsolescence postprocessing logic (issue4354)
The previous logic had many shortcoming (eg: looking at the head only, not
handling prune, etc...), the new logic use a more robust approach:
For each head, we check if after the push all changesets exclusive to this heads
will be obsolete. If they are, the branch considered be "replaced".
To check if a changeset will be obsolete, we simply checks:
* the changeset phase
* the existence of a marker relevant to the "pushed set" that affects the
changesets..
This fixes two major issues of the previous algorithm:
* branch partially rewritten (eg: head but not root) are no longer detected as
replaced,
* Prune are now properly handled.
(This implementation was introduction in the evolve extension, version 6.0.0.)
This new algorithm has an extended number of tests, a basic one is provided
in this patch. The others will be introduced in their own changeset for clarity.
In addition, we stop trying to process heads unknown locally, we do not have
enough data to take an informed decision so we should stop pretending we do.
This reflect a test that is now update.
2017-04-15 03:55:18 +03:00
|
|
|
$ hg push
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/remote
|
checkheads: upgrade the obsolescence postprocessing logic (issue4354)
The previous logic had many shortcoming (eg: looking at the head only, not
handling prune, etc...), the new logic use a more robust approach:
For each head, we check if after the push all changesets exclusive to this heads
will be obsolete. If they are, the branch considered be "replaced".
To check if a changeset will be obsolete, we simply checks:
* the changeset phase
* the existence of a marker relevant to the "pushed set" that affects the
changesets..
This fixes two major issues of the previous algorithm:
* branch partially rewritten (eg: head but not root) are no longer detected as
replaced,
* Prune are now properly handled.
(This implementation was introduction in the evolve extension, version 6.0.0.)
This new algorithm has an extended number of tests, a basic one is provided
in this patch. The others will be introduced in their own changeset for clarity.
In addition, we stop trying to process heads unknown locally, we do not have
enough data to take an informed decision so we should stop pretending we do.
This reflect a test that is now update.
2017-04-15 03:55:18 +03:00
|
|
|
searching for changes
|
|
|
|
remote has heads on branch 'default' that are not known locally: c70b08862e08
|
|
|
|
abort: push creates new remote head 71e3228bffe1!
|
|
|
|
(pull and merge or see 'hg help push' for details about pushing new heads)
|
|
|
|
[255]
|
|
|
|
|
|
|
|
Pulling the missing data makes it work
|
|
|
|
|
|
|
|
$ hg pull
|
2017-12-11 06:50:57 +03:00
|
|
|
pulling from $TESTTMP/remote
|
checkheads: upgrade the obsolescence postprocessing logic (issue4354)
The previous logic had many shortcoming (eg: looking at the head only, not
handling prune, etc...), the new logic use a more robust approach:
For each head, we check if after the push all changesets exclusive to this heads
will be obsolete. If they are, the branch considered be "replaced".
To check if a changeset will be obsolete, we simply checks:
* the changeset phase
* the existence of a marker relevant to the "pushed set" that affects the
changesets..
This fixes two major issues of the previous algorithm:
* branch partially rewritten (eg: head but not root) are no longer detected as
replaced,
* Prune are now properly handled.
(This implementation was introduction in the evolve extension, version 6.0.0.)
This new algorithm has an extended number of tests, a basic one is provided
in this patch. The others will be introduced in their own changeset for clarity.
In addition, we stop trying to process heads unknown locally, we do not have
enough data to take an informed decision so we should stop pretending we do.
This reflect a test that is now update.
2017-04-15 03:55:18 +03:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files (+1 heads)
|
|
|
|
(run 'hg heads' to see heads)
|
|
|
|
$ hg push
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/remote
|
2012-08-26 02:25:33 +04:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files (+1 heads)
|
2017-04-19 17:10:05 +03:00
|
|
|
|
|
|
|
Old head is pruned without parent data and new unrelated head added
|
|
|
|
===================================================================
|
|
|
|
|
|
|
|
setup
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
$ rm -R remote local
|
|
|
|
$ cp -R backup1 remote
|
|
|
|
$ hg clone remote local -qr c70b08862e08
|
|
|
|
$ cd local
|
|
|
|
$ hg up -q '.^'
|
|
|
|
$ mkcommit new-unrelated
|
|
|
|
created new head
|
|
|
|
$ hg debugobsolete `getid old`
|
2017-07-16 03:33:14 +03:00
|
|
|
obsoleted 1 changesets
|
2017-04-19 17:10:05 +03:00
|
|
|
$ hg log -G --hidden
|
|
|
|
@ 350a93b716be (draft) add new-unrelated
|
|
|
|
|
|
|
|
|
| x c70b08862e08 (draft) add old
|
|
|
|
|/
|
|
|
|
o b4952fcf48cf (public) add base
|
|
|
|
|
|
|
|
|
|
|
|
$ hg push
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/remote
|
2017-04-19 17:10:05 +03:00
|
|
|
searching for changes
|
|
|
|
abort: push creates new remote head 350a93b716be!
|
|
|
|
(merge or see 'hg help push' for details about pushing new heads)
|
|
|
|
[255]
|