2010-10-01 18:10:06 +04:00
|
|
|
$ cat >> $HGRCPATH <<EOF
|
|
|
|
> [extensions]
|
|
|
|
> rebase=
|
2012-05-18 23:45:47 +04:00
|
|
|
> mq=
|
2010-10-01 18:10:06 +04:00
|
|
|
>
|
2011-12-27 03:11:22 +04:00
|
|
|
> [phases]
|
|
|
|
> publish=False
|
|
|
|
>
|
2010-10-01 18:10:06 +04:00
|
|
|
> [alias]
|
|
|
|
> tglog = log -G --template "{rev}: '{desc}' {branches}\n"
|
2012-01-17 12:12:14 +04:00
|
|
|
> tglogp = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
|
2010-10-01 18:10:06 +04:00
|
|
|
> EOF
|
|
|
|
|
|
|
|
Create repo a:
|
|
|
|
|
|
|
|
$ hg init a
|
|
|
|
$ cd a
|
2012-04-03 21:06:35 +04:00
|
|
|
$ hg unbundle "$TESTDIR/bundles/rebase.hg"
|
2011-04-30 19:38:06 +04:00
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 8 changesets with 7 changes to 7 files (+2 heads)
|
|
|
|
(run 'hg heads' to see heads, 'hg merge' to merge)
|
|
|
|
$ hg up tip
|
|
|
|
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
|
|
$ hg tglog
|
|
|
|
@ 7: 'H'
|
|
|
|
|
|
|
|
|
| o 6: 'G'
|
|
|
|
|/|
|
|
|
|
o | 5: 'F'
|
|
|
|
| |
|
|
|
|
| o 4: 'E'
|
|
|
|
|/
|
|
|
|
| o 3: 'D'
|
|
|
|
| |
|
|
|
|
| o 2: 'C'
|
|
|
|
| |
|
|
|
|
| o 1: 'B'
|
|
|
|
|/
|
|
|
|
o 0: 'A'
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
Rebasing B onto H and collapsing changesets with different phases:
|
|
|
|
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
|
|
$ hg clone -q -u 3 a a1
|
|
|
|
$ cd a1
|
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
$ hg phase --force --secret 3
|
|
|
|
|
2014-03-18 20:07:41 +04:00
|
|
|
$ cat > $TESTTMP/editor.sh <<EOF
|
|
|
|
> echo "==== before editing"
|
|
|
|
> cat \$1
|
|
|
|
> echo "===="
|
|
|
|
> echo "edited manually" >> \$1
|
|
|
|
> EOF
|
|
|
|
$ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 1:42ccdea3bb16 "B"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 1:42ccdea3bb16 created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 2:5fddd98957c8 "C"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 2:5fddd98957c8 created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 3:32af7686d403 "D"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 3:32af7686d403 created no changes to commit
|
2014-03-18 20:07:41 +04:00
|
|
|
==== before editing
|
|
|
|
Collapsed revision
|
|
|
|
* B
|
|
|
|
* C
|
|
|
|
* D
|
|
|
|
|
|
|
|
|
|
|
|
HG: Enter commit message. Lines beginning with 'HG:' are removed.
|
|
|
|
HG: Leave message empty to abort commit.
|
|
|
|
HG: --
|
|
|
|
HG: user: Nicolas Dumazet <nicdumz.commits@gmail.com>
|
|
|
|
HG: branch 'default'
|
2014-10-10 22:05:50 +04:00
|
|
|
HG: added B
|
|
|
|
HG: added C
|
|
|
|
HG: added D
|
2014-03-18 20:07:41 +04:00
|
|
|
====
|
2015-01-09 21:52:14 +03:00
|
|
|
saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-backup.hg (glob)
|
2010-10-01 18:10:06 +04:00
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
$ hg tglogp
|
2013-11-02 04:08:06 +04:00
|
|
|
@ 5:secret 'Collapsed revision
|
2010-10-01 18:10:06 +04:00
|
|
|
| * B
|
|
|
|
| * C
|
2014-03-18 20:07:41 +04:00
|
|
|
| * D
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| edited manually'
|
2013-11-02 04:08:06 +04:00
|
|
|
o 4:draft 'H'
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
| o 3:draft 'G'
|
2010-10-01 18:10:06 +04:00
|
|
|
|/|
|
2012-01-17 12:12:14 +04:00
|
|
|
o | 2:draft 'F'
|
2010-10-01 18:10:06 +04:00
|
|
|
| |
|
2012-01-17 12:12:14 +04:00
|
|
|
| o 1:draft 'E'
|
2010-10-01 18:10:06 +04:00
|
|
|
|/
|
2012-01-17 12:12:14 +04:00
|
|
|
o 0:draft 'A'
|
2010-10-01 18:10:06 +04:00
|
|
|
|
2013-10-14 18:49:54 +04:00
|
|
|
$ hg manifest --rev tip
|
2010-10-01 18:10:06 +04:00
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
|
|
|
D
|
|
|
|
F
|
|
|
|
H
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
|
2011-10-15 21:07:51 +04:00
|
|
|
Rebasing E onto H:
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
|
|
$ hg clone -q -u . a a2
|
|
|
|
$ cd a2
|
|
|
|
|
2012-01-17 12:12:14 +04:00
|
|
|
$ hg phase --force --secret 6
|
2011-10-15 21:07:51 +04:00
|
|
|
$ hg rebase --source 4 --collapse
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 4:9520eea781bc "E"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 4:9520eea781bc created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 6:eea13746799a "G"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 6:eea13746799a created no changes to commit
|
2015-01-09 21:52:14 +03:00
|
|
|
saved backup bundle to $TESTTMP/a2/.hg/strip-backup/9520eea781bc-fcd8edd4-backup.hg (glob)
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
|
|
$ hg tglog
|
2013-10-14 18:12:29 +04:00
|
|
|
o 6: 'Collapsed revision
|
2010-10-01 18:10:06 +04:00
|
|
|
| * E
|
|
|
|
| * G'
|
2013-10-14 18:12:29 +04:00
|
|
|
@ 5: 'H'
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
|
|
|
o 4: 'F'
|
|
|
|
|
|
|
|
|
| o 3: 'D'
|
|
|
|
| |
|
|
|
|
| o 2: 'C'
|
|
|
|
| |
|
|
|
|
| o 1: 'B'
|
|
|
|
|/
|
|
|
|
o 0: 'A'
|
|
|
|
|
2013-10-14 18:49:54 +04:00
|
|
|
$ hg manifest --rev tip
|
2010-10-01 18:10:06 +04:00
|
|
|
A
|
|
|
|
E
|
|
|
|
F
|
|
|
|
H
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
2011-03-15 20:33:36 +03:00
|
|
|
Rebasing G onto H with custom message:
|
|
|
|
|
|
|
|
$ hg clone -q -u . a a3
|
|
|
|
$ cd a3
|
|
|
|
|
|
|
|
$ hg rebase --base 6 -m 'custom message'
|
|
|
|
abort: message can only be specified with collapse
|
|
|
|
[255]
|
|
|
|
|
2014-08-15 18:05:53 +04:00
|
|
|
$ cat > $TESTTMP/checkeditform.sh <<EOF
|
|
|
|
> env | grep HGEDITFORM
|
|
|
|
> true
|
|
|
|
> EOF
|
|
|
|
$ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --source 4 --collapse -m 'custom message' -e
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 4:9520eea781bc "E"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 4:9520eea781bc created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 6:eea13746799a "G"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 6:eea13746799a created no changes to commit
|
2014-08-15 18:05:53 +04:00
|
|
|
HGEDITFORM=rebase.collapse
|
2015-01-09 21:52:14 +03:00
|
|
|
saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-backup.hg (glob)
|
2011-03-15 20:33:36 +03:00
|
|
|
|
|
|
|
$ hg tglog
|
2013-10-14 18:12:29 +04:00
|
|
|
o 6: 'custom message'
|
2011-03-15 20:33:36 +03:00
|
|
|
|
|
2013-10-14 18:12:29 +04:00
|
|
|
@ 5: 'H'
|
2011-03-15 20:33:36 +03:00
|
|
|
|
|
|
|
|
o 4: 'F'
|
|
|
|
|
|
|
|
|
| o 3: 'D'
|
|
|
|
| |
|
|
|
|
| o 2: 'C'
|
|
|
|
| |
|
|
|
|
| o 1: 'B'
|
|
|
|
|/
|
|
|
|
o 0: 'A'
|
|
|
|
|
2013-10-14 18:49:54 +04:00
|
|
|
$ hg manifest --rev tip
|
2011-03-15 20:33:36 +03:00
|
|
|
A
|
|
|
|
E
|
|
|
|
F
|
|
|
|
H
|
|
|
|
|
|
|
|
$ cd ..
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
|
|
Create repo b:
|
|
|
|
|
|
|
|
$ hg init b
|
|
|
|
$ cd b
|
|
|
|
|
|
|
|
$ echo A > A
|
|
|
|
$ hg ci -Am A
|
|
|
|
adding A
|
|
|
|
$ echo B > B
|
|
|
|
$ hg ci -Am B
|
|
|
|
adding B
|
|
|
|
|
|
|
|
$ hg up -q 0
|
|
|
|
|
|
|
|
$ echo C > C
|
|
|
|
$ hg ci -Am C
|
|
|
|
adding C
|
|
|
|
created new head
|
|
|
|
|
|
|
|
$ hg merge
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
|
|
|
|
$ echo D > D
|
|
|
|
$ hg ci -Am D
|
|
|
|
adding D
|
|
|
|
|
|
|
|
$ hg up -q 1
|
|
|
|
|
|
|
|
$ echo E > E
|
|
|
|
$ hg ci -Am E
|
|
|
|
adding E
|
|
|
|
created new head
|
|
|
|
|
|
|
|
$ echo F > F
|
|
|
|
$ hg ci -Am F
|
|
|
|
adding F
|
|
|
|
|
|
|
|
$ hg merge
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
$ hg ci -m G
|
|
|
|
|
|
|
|
$ hg up -q 0
|
|
|
|
|
|
|
|
$ echo H > H
|
|
|
|
$ hg ci -Am H
|
|
|
|
adding H
|
|
|
|
created new head
|
|
|
|
|
|
|
|
$ hg tglog
|
|
|
|
@ 7: 'H'
|
|
|
|
|
|
|
|
|
| o 6: 'G'
|
|
|
|
| |\
|
|
|
|
| | o 5: 'F'
|
|
|
|
| | |
|
|
|
|
| | o 4: 'E'
|
|
|
|
| | |
|
|
|
|
| o | 3: 'D'
|
|
|
|
| |\|
|
|
|
|
| o | 2: 'C'
|
|
|
|
|/ /
|
|
|
|
| o 1: 'B'
|
|
|
|
|/
|
|
|
|
o 0: 'A'
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
|
|
|
|
Rebase and collapse - more than one external (fail):
|
|
|
|
|
|
|
|
$ hg clone -q -u . b b1
|
|
|
|
$ cd b1
|
|
|
|
|
|
|
|
$ hg rebase -s 2 --collapse
|
2013-10-23 19:42:13 +04:00
|
|
|
abort: unable to collapse on top of 7, there is more than one external parent: 1, 5
|
2010-10-01 18:10:06 +04:00
|
|
|
[255]
|
|
|
|
|
|
|
|
Rebase and collapse - E onto H:
|
|
|
|
|
2012-06-20 22:08:57 +04:00
|
|
|
$ hg rebase -s 4 --collapse # root (4) is not a merge
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 4:8a5212ebc852 "E"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 4:8a5212ebc852 created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 5:7f219660301f "F"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 5:7f219660301f created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 6:c772a8b2dc17 "G"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 6:c772a8b2dc17 created no changes to commit
|
2015-01-09 21:52:14 +03:00
|
|
|
saved backup bundle to $TESTTMP/b1/.hg/strip-backup/8a5212ebc852-75046b61-backup.hg (glob)
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
|
|
$ hg tglog
|
2013-10-14 18:12:29 +04:00
|
|
|
o 5: 'Collapsed revision
|
2010-10-01 18:10:06 +04:00
|
|
|
|\ * E
|
|
|
|
| | * F
|
|
|
|
| | * G'
|
2013-10-14 18:12:29 +04:00
|
|
|
| @ 4: 'H'
|
2010-10-01 18:10:06 +04:00
|
|
|
| |
|
|
|
|
o | 3: 'D'
|
|
|
|
|\ \
|
|
|
|
| o | 2: 'C'
|
|
|
|
| |/
|
|
|
|
o / 1: 'B'
|
|
|
|
|/
|
|
|
|
o 0: 'A'
|
|
|
|
|
2013-10-14 18:49:54 +04:00
|
|
|
$ hg manifest --rev tip
|
2010-10-01 18:10:06 +04:00
|
|
|
A
|
|
|
|
C
|
|
|
|
D
|
|
|
|
E
|
|
|
|
F
|
|
|
|
H
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
|
2012-05-18 23:45:47 +04:00
|
|
|
|
|
|
|
|
|
|
|
Test that branchheads cache is updated correctly when doing a strip in which
|
2013-01-16 03:09:26 +04:00
|
|
|
the parent of the ancestor node to be stripped does not become a head and also,
|
|
|
|
the parent of a node that is a child of the node stripped becomes a head (node
|
|
|
|
3). The code is now much simpler and we could just test a simpler scenario
|
|
|
|
We keep it the test this way in case new complexity is injected.
|
2012-05-18 23:45:47 +04:00
|
|
|
|
|
|
|
$ hg clone -q -u . b b2
|
|
|
|
$ cd b2
|
|
|
|
|
|
|
|
$ hg heads --template="{rev}:{node} {branch}\n"
|
|
|
|
7:c65502d4178782309ce0574c5ae6ee9485a9bafa default
|
|
|
|
6:c772a8b2dc17629cec88a19d09c926c4814b12c7 default
|
|
|
|
|
2013-09-16 12:08:29 +04:00
|
|
|
$ cat $TESTTMP/b2/.hg/cache/branch2-served
|
2012-05-18 23:45:47 +04:00
|
|
|
c65502d4178782309ce0574c5ae6ee9485a9bafa 7
|
2013-09-16 12:08:29 +04:00
|
|
|
c772a8b2dc17629cec88a19d09c926c4814b12c7 o default
|
|
|
|
c65502d4178782309ce0574c5ae6ee9485a9bafa o default
|
2012-05-18 23:45:47 +04:00
|
|
|
|
|
|
|
$ hg strip 4
|
2015-01-09 21:52:14 +03:00
|
|
|
saved backup bundle to $TESTTMP/b2/.hg/strip-backup/8a5212ebc852-75046b61-backup.hg (glob)
|
2012-05-18 23:45:47 +04:00
|
|
|
|
2013-09-16 12:08:29 +04:00
|
|
|
$ cat $TESTTMP/b2/.hg/cache/branch2-served
|
2012-05-18 23:45:47 +04:00
|
|
|
c65502d4178782309ce0574c5ae6ee9485a9bafa 4
|
2013-09-16 12:08:29 +04:00
|
|
|
2870ad076e541e714f3c2bc32826b5c6a6e5b040 o default
|
|
|
|
c65502d4178782309ce0574c5ae6ee9485a9bafa o default
|
2012-05-18 23:45:47 +04:00
|
|
|
|
|
|
|
$ hg heads --template="{rev}:{node} {branch}\n"
|
|
|
|
4:c65502d4178782309ce0574c5ae6ee9485a9bafa default
|
|
|
|
3:2870ad076e541e714f3c2bc32826b5c6a6e5b040 default
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-10-01 18:10:06 +04:00
|
|
|
Create repo c:
|
|
|
|
|
|
|
|
$ hg init c
|
|
|
|
$ cd c
|
|
|
|
|
|
|
|
$ echo A > A
|
|
|
|
$ hg ci -Am A
|
|
|
|
adding A
|
|
|
|
$ echo B > B
|
|
|
|
$ hg ci -Am B
|
|
|
|
adding B
|
|
|
|
|
|
|
|
$ hg up -q 0
|
|
|
|
|
|
|
|
$ echo C > C
|
|
|
|
$ hg ci -Am C
|
|
|
|
adding C
|
|
|
|
created new head
|
|
|
|
|
|
|
|
$ hg merge
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
|
|
|
|
$ echo D > D
|
|
|
|
$ hg ci -Am D
|
|
|
|
adding D
|
|
|
|
|
|
|
|
$ hg up -q 1
|
|
|
|
|
|
|
|
$ echo E > E
|
|
|
|
$ hg ci -Am E
|
|
|
|
adding E
|
|
|
|
created new head
|
|
|
|
$ echo F > E
|
|
|
|
$ hg ci -m 'F'
|
|
|
|
|
|
|
|
$ echo G > G
|
|
|
|
$ hg ci -Am G
|
|
|
|
adding G
|
|
|
|
|
|
|
|
$ hg merge
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
|
|
|
|
$ hg ci -m H
|
|
|
|
|
|
|
|
$ hg up -q 0
|
|
|
|
|
|
|
|
$ echo I > I
|
|
|
|
$ hg ci -Am I
|
|
|
|
adding I
|
|
|
|
created new head
|
|
|
|
|
|
|
|
$ hg tglog
|
|
|
|
@ 8: 'I'
|
|
|
|
|
|
|
|
|
| o 7: 'H'
|
|
|
|
| |\
|
|
|
|
| | o 6: 'G'
|
|
|
|
| | |
|
|
|
|
| | o 5: 'F'
|
|
|
|
| | |
|
|
|
|
| | o 4: 'E'
|
|
|
|
| | |
|
|
|
|
| o | 3: 'D'
|
|
|
|
| |\|
|
|
|
|
| o | 2: 'C'
|
|
|
|
|/ /
|
|
|
|
| o 1: 'B'
|
|
|
|
|/
|
|
|
|
o 0: 'A'
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
|
|
|
|
Rebase and collapse - E onto I:
|
|
|
|
|
|
|
|
$ hg clone -q -u . c c1
|
|
|
|
$ cd c1
|
|
|
|
|
2012-06-20 22:08:57 +04:00
|
|
|
$ hg rebase -s 4 --collapse # root (4) is not a merge
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 4:8a5212ebc852 "E"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 4:8a5212ebc852 created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 5:dca5924bb570 "F"
|
2010-10-01 18:10:06 +04:00
|
|
|
merging E
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 5:dca5924bb570 created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 6:55a44ad28289 "G"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 6:55a44ad28289 created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 7:417d3b648079 "H"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 7:417d3b648079 created no changes to commit
|
2015-01-09 21:52:14 +03:00
|
|
|
saved backup bundle to $TESTTMP/c1/.hg/strip-backup/8a5212ebc852-f95d0879-backup.hg (glob)
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
|
|
$ hg tglog
|
2013-10-14 18:12:29 +04:00
|
|
|
o 5: 'Collapsed revision
|
2010-10-01 18:10:06 +04:00
|
|
|
|\ * E
|
|
|
|
| | * F
|
|
|
|
| | * G
|
|
|
|
| | * H'
|
2013-10-14 18:12:29 +04:00
|
|
|
| @ 4: 'I'
|
2010-10-01 18:10:06 +04:00
|
|
|
| |
|
|
|
|
o | 3: 'D'
|
|
|
|
|\ \
|
|
|
|
| o | 2: 'C'
|
|
|
|
| |/
|
|
|
|
o / 1: 'B'
|
|
|
|
|/
|
|
|
|
o 0: 'A'
|
|
|
|
|
2013-10-14 18:49:54 +04:00
|
|
|
$ hg manifest --rev tip
|
2010-10-01 18:10:06 +04:00
|
|
|
A
|
|
|
|
C
|
|
|
|
D
|
|
|
|
E
|
|
|
|
G
|
|
|
|
I
|
|
|
|
|
2013-10-14 18:49:54 +04:00
|
|
|
$ hg up tip -q
|
2010-10-01 18:10:06 +04:00
|
|
|
$ cat E
|
|
|
|
F
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
|
|
|
|
Create repo d:
|
|
|
|
|
|
|
|
$ hg init d
|
|
|
|
$ cd d
|
|
|
|
|
|
|
|
$ echo A > A
|
|
|
|
$ hg ci -Am A
|
|
|
|
adding A
|
|
|
|
$ echo B > B
|
|
|
|
$ hg ci -Am B
|
|
|
|
adding B
|
|
|
|
$ echo C > C
|
|
|
|
$ hg ci -Am C
|
|
|
|
adding C
|
|
|
|
|
|
|
|
$ hg up -q 1
|
|
|
|
|
|
|
|
$ echo D > D
|
|
|
|
$ hg ci -Am D
|
|
|
|
adding D
|
|
|
|
created new head
|
|
|
|
$ hg merge
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
|
|
|
|
$ hg ci -m E
|
|
|
|
|
|
|
|
$ hg up -q 0
|
|
|
|
|
|
|
|
$ echo F > F
|
|
|
|
$ hg ci -Am F
|
|
|
|
adding F
|
|
|
|
created new head
|
|
|
|
|
|
|
|
$ hg tglog
|
|
|
|
@ 5: 'F'
|
|
|
|
|
|
|
|
|
| o 4: 'E'
|
|
|
|
| |\
|
|
|
|
| | o 3: 'D'
|
|
|
|
| | |
|
|
|
|
| o | 2: 'C'
|
|
|
|
| |/
|
|
|
|
| o 1: 'B'
|
|
|
|
|/
|
|
|
|
o 0: 'A'
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
|
|
|
|
Rebase and collapse - B onto F:
|
|
|
|
|
|
|
|
$ hg clone -q -u . d d1
|
|
|
|
$ cd d1
|
|
|
|
|
|
|
|
$ hg rebase -s 1 --collapse
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 1:27547f69f254 "B"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 1:27547f69f254 created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 2:f838bfaca5c7 "C"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 2:f838bfaca5c7 created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 3:7bbcd6078bcc "D"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 3:7bbcd6078bcc created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 4:0a42590ed746 "E"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 4:0a42590ed746 created no changes to commit
|
2015-01-09 21:52:14 +03:00
|
|
|
saved backup bundle to $TESTTMP/d1/.hg/strip-backup/27547f69f254-9a3f7d92-backup.hg (glob)
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
|
|
$ hg tglog
|
2013-10-14 18:12:29 +04:00
|
|
|
o 2: 'Collapsed revision
|
2010-10-01 18:10:06 +04:00
|
|
|
| * B
|
|
|
|
| * C
|
|
|
|
| * D
|
|
|
|
| * E'
|
2013-10-14 18:12:29 +04:00
|
|
|
@ 1: 'F'
|
2010-10-01 18:10:06 +04:00
|
|
|
|
|
|
|
|
o 0: 'A'
|
|
|
|
|
2013-10-14 18:49:54 +04:00
|
|
|
$ hg manifest --rev tip
|
2010-10-01 18:10:06 +04:00
|
|
|
A
|
|
|
|
B
|
|
|
|
C
|
|
|
|
D
|
|
|
|
F
|
|
|
|
|
2011-07-19 00:58:21 +04:00
|
|
|
Interactions between collapse and keepbranches
|
|
|
|
$ cd ..
|
|
|
|
$ hg init e
|
|
|
|
$ cd e
|
|
|
|
$ echo 'a' > a
|
|
|
|
$ hg ci -Am 'A'
|
|
|
|
adding a
|
|
|
|
|
2013-02-06 04:22:53 +04:00
|
|
|
$ hg branch 'one'
|
|
|
|
marked working directory as branch one
|
2011-12-09 00:32:44 +04:00
|
|
|
(branches are permanent and global, did you want a bookmark?)
|
2011-07-19 00:58:21 +04:00
|
|
|
$ echo 'b' > b
|
|
|
|
$ hg ci -Am 'B'
|
|
|
|
adding b
|
|
|
|
|
2013-02-06 04:22:53 +04:00
|
|
|
$ hg branch 'two'
|
|
|
|
marked working directory as branch two
|
2011-07-19 00:58:21 +04:00
|
|
|
$ echo 'c' > c
|
|
|
|
$ hg ci -Am 'C'
|
|
|
|
adding c
|
|
|
|
|
|
|
|
$ hg up -q 0
|
|
|
|
$ echo 'd' > d
|
|
|
|
$ hg ci -Am 'D'
|
|
|
|
adding d
|
|
|
|
|
|
|
|
$ hg tglog
|
|
|
|
@ 3: 'D'
|
|
|
|
|
|
2013-02-06 04:22:53 +04:00
|
|
|
| o 2: 'C' two
|
2011-07-19 00:58:21 +04:00
|
|
|
| |
|
2013-02-06 04:22:53 +04:00
|
|
|
| o 1: 'B' one
|
2011-07-19 00:58:21 +04:00
|
|
|
|/
|
|
|
|
o 0: 'A'
|
|
|
|
|
|
|
|
$ hg rebase --keepbranches --collapse -s 1 -d 3
|
|
|
|
abort: cannot collapse multiple named branches
|
|
|
|
[255]
|
|
|
|
|
2012-01-23 22:26:01 +04:00
|
|
|
$ repeatchange() {
|
|
|
|
> hg checkout $1
|
|
|
|
> hg cp d z
|
|
|
|
> echo blah >> z
|
|
|
|
> hg commit -Am "$2" --user "$3"
|
|
|
|
> }
|
|
|
|
$ repeatchange 3 "E" "user1"
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ repeatchange 3 "E" "user2"
|
|
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
created new head
|
|
|
|
$ hg tglog
|
|
|
|
@ 5: 'E'
|
|
|
|
|
|
|
|
|
| o 4: 'E'
|
|
|
|
|/
|
|
|
|
o 3: 'D'
|
|
|
|
|
|
2013-02-06 04:22:53 +04:00
|
|
|
| o 2: 'C' two
|
2012-01-23 22:26:01 +04:00
|
|
|
| |
|
2013-02-06 04:22:53 +04:00
|
|
|
| o 1: 'B' one
|
2012-01-23 22:26:01 +04:00
|
|
|
|/
|
|
|
|
o 0: 'A'
|
|
|
|
|
|
|
|
$ hg rebase -s 5 -d 4
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 5:fbfb97b1089a "E" (tip)
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 5:fbfb97b1089a created no changes to commit
|
2015-01-09 21:52:14 +03:00
|
|
|
saved backup bundle to $TESTTMP/e/.hg/strip-backup/fbfb97b1089a-553e1d85-backup.hg (glob)
|
2012-01-23 22:26:01 +04:00
|
|
|
$ hg tglog
|
|
|
|
@ 4: 'E'
|
|
|
|
|
|
|
|
|
o 3: 'D'
|
|
|
|
|
|
2013-02-06 04:22:53 +04:00
|
|
|
| o 2: 'C' two
|
2012-01-23 22:26:01 +04:00
|
|
|
| |
|
2013-02-06 04:22:53 +04:00
|
|
|
| o 1: 'B' one
|
2012-01-23 22:26:01 +04:00
|
|
|
|/
|
|
|
|
o 0: 'A'
|
|
|
|
|
|
|
|
$ hg export tip
|
|
|
|
# HG changeset patch
|
|
|
|
# User user1
|
|
|
|
# Date 0 0
|
2013-02-09 01:54:17 +04:00
|
|
|
# Thu Jan 01 00:00:00 1970 +0000
|
2012-01-23 22:26:01 +04:00
|
|
|
# Node ID f338eb3c2c7cc5b5915676a2376ba7ac558c5213
|
|
|
|
# Parent 41acb9dca9eb976e84cd21fcb756b4afa5a35c09
|
|
|
|
E
|
|
|
|
|
|
|
|
diff -r 41acb9dca9eb -r f338eb3c2c7c z
|
|
|
|
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/z Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
@@ -0,0 +1,2 @@
|
|
|
|
+d
|
|
|
|
+blah
|
2012-04-30 00:25:55 +04:00
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
Rebase, collapse and copies
|
|
|
|
|
|
|
|
$ hg init copies
|
|
|
|
$ cd copies
|
|
|
|
$ hg unbundle "$TESTDIR/bundles/renames.hg"
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 4 changesets with 11 changes to 7 files (+1 heads)
|
|
|
|
(run 'hg heads' to see heads, 'hg merge' to merge)
|
|
|
|
$ hg up -q tip
|
|
|
|
$ hg tglog
|
|
|
|
@ 3: 'move2'
|
|
|
|
|
|
|
|
|
o 2: 'move1'
|
|
|
|
|
|
|
|
|
| o 1: 'change'
|
|
|
|
|/
|
|
|
|
o 0: 'add'
|
|
|
|
|
|
|
|
$ hg rebase --collapse -d 1
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 2:6e7340ee38c0 "move1"
|
2012-04-30 00:25:55 +04:00
|
|
|
merging a and d to d
|
|
|
|
merging b and e to e
|
|
|
|
merging c and f to f
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 2:6e7340ee38c0 created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 3:338e84e2e558 "move2" (tip)
|
2012-04-30 00:25:55 +04:00
|
|
|
merging f and c to c
|
2014-03-02 21:52:16 +04:00
|
|
|
merging e and g to g
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 3:338e84e2e558 created no changes to commit
|
2015-01-09 21:52:14 +03:00
|
|
|
saved backup bundle to $TESTTMP/copies/.hg/strip-backup/6e7340ee38c0-ef8ef003-backup.hg (glob)
|
2012-04-30 00:25:55 +04:00
|
|
|
$ hg st
|
2013-10-14 18:49:54 +04:00
|
|
|
$ hg st --copies --change tip
|
2012-04-30 00:25:55 +04:00
|
|
|
A d
|
|
|
|
a
|
|
|
|
A g
|
|
|
|
b
|
|
|
|
R b
|
2013-10-14 18:49:54 +04:00
|
|
|
$ hg up tip -q
|
2012-04-30 00:25:55 +04:00
|
|
|
$ cat c
|
|
|
|
c
|
|
|
|
c
|
|
|
|
$ cat d
|
|
|
|
a
|
|
|
|
a
|
|
|
|
$ cat g
|
|
|
|
b
|
|
|
|
b
|
|
|
|
$ hg log -r . --template "{file_copies}\n"
|
|
|
|
d (a)g (b)
|
rebase: allow collapsing branches in place (issue3111)
We allow rebase plus collapse, but not collapse only? I imagine people would
rebase first then collapse once they are sure the rebase is correct and it is
the right time to finish it.
I was reluctant to submit this patch for reasons detailed below, but it
improves rebase --collapse usefulness so much it is worth the ugliness.
The fix is ugly because we should be fixing the collapse code path rather than
the merge. Collapsing by merging changesets repeatedly is inefficient compared
to what commit --amend does: commitctx(), update, strip. The problem with the
latter is, to generate the synthetic changeset, copy records are gathered with
copies.pathcopies(). copies.pathcopies() is still implemented with merging in
mind and discards information like file replaced by the copy of another,
criss-cross copies and so forth. I believe this information should not be lost,
even if we decide not to interpret it fully later, at merge time.
The second issue with improving rebase --collapse is the option should not be
there to begin with. Rebasing and collapsing are orthogonal and a dedicated
command would probably enable a better, simpler ui. We should avoid advertizing
rebase --collapse, but with this fix it becomes the best shipped solution to
collapse changesets.
And for the record, available techniques are:
- revert + commit + strip: lose copies
- mq/qfold: repeated patching() (mostly correct, fragile)
- rebase: repeated merges (mostly correct, fragile)
- collapse: revert + tag rewriting wizardry, lose copies
- histedit: repeated patching() (mostly correct, fragile)
- amend: copies.pathcopies() + commitctx() + update + strip
2012-05-03 17:14:58 +04:00
|
|
|
|
|
|
|
Test collapsing a middle revision in-place
|
|
|
|
|
|
|
|
$ hg tglog
|
|
|
|
@ 2: 'Collapsed revision
|
|
|
|
| * move1
|
|
|
|
| * move2'
|
|
|
|
o 1: 'change'
|
|
|
|
|
|
|
|
|
o 0: 'add'
|
|
|
|
|
|
|
|
$ hg rebase --collapse -r 1 -d 0
|
|
|
|
abort: can't remove original changesets with unrebased descendants
|
|
|
|
(use --keep to keep original changesets)
|
|
|
|
[255]
|
|
|
|
|
|
|
|
Test collapsing in place
|
|
|
|
|
|
|
|
$ hg rebase --collapse -b . -d 0
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 1:1352765a01d4 "change"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 1:1352765a01d4 created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 2:64b456429f67 "Collapsed revision" (tip)
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 2:64b456429f67 created no changes to commit
|
2015-01-09 21:52:14 +03:00
|
|
|
saved backup bundle to $TESTTMP/copies/.hg/strip-backup/1352765a01d4-45a352ea-backup.hg (glob)
|
2013-10-14 18:49:54 +04:00
|
|
|
$ hg st --change tip --copies
|
rebase: allow collapsing branches in place (issue3111)
We allow rebase plus collapse, but not collapse only? I imagine people would
rebase first then collapse once they are sure the rebase is correct and it is
the right time to finish it.
I was reluctant to submit this patch for reasons detailed below, but it
improves rebase --collapse usefulness so much it is worth the ugliness.
The fix is ugly because we should be fixing the collapse code path rather than
the merge. Collapsing by merging changesets repeatedly is inefficient compared
to what commit --amend does: commitctx(), update, strip. The problem with the
latter is, to generate the synthetic changeset, copy records are gathered with
copies.pathcopies(). copies.pathcopies() is still implemented with merging in
mind and discards information like file replaced by the copy of another,
criss-cross copies and so forth. I believe this information should not be lost,
even if we decide not to interpret it fully later, at merge time.
The second issue with improving rebase --collapse is the option should not be
there to begin with. Rebasing and collapsing are orthogonal and a dedicated
command would probably enable a better, simpler ui. We should avoid advertizing
rebase --collapse, but with this fix it becomes the best shipped solution to
collapse changesets.
And for the record, available techniques are:
- revert + commit + strip: lose copies
- mq/qfold: repeated patching() (mostly correct, fragile)
- rebase: repeated merges (mostly correct, fragile)
- collapse: revert + tag rewriting wizardry, lose copies
- histedit: repeated patching() (mostly correct, fragile)
- amend: copies.pathcopies() + commitctx() + update + strip
2012-05-03 17:14:58 +04:00
|
|
|
M a
|
|
|
|
M c
|
|
|
|
A d
|
|
|
|
a
|
|
|
|
A g
|
|
|
|
b
|
|
|
|
R b
|
2013-10-14 18:49:54 +04:00
|
|
|
$ hg up tip -q
|
rebase: allow collapsing branches in place (issue3111)
We allow rebase plus collapse, but not collapse only? I imagine people would
rebase first then collapse once they are sure the rebase is correct and it is
the right time to finish it.
I was reluctant to submit this patch for reasons detailed below, but it
improves rebase --collapse usefulness so much it is worth the ugliness.
The fix is ugly because we should be fixing the collapse code path rather than
the merge. Collapsing by merging changesets repeatedly is inefficient compared
to what commit --amend does: commitctx(), update, strip. The problem with the
latter is, to generate the synthetic changeset, copy records are gathered with
copies.pathcopies(). copies.pathcopies() is still implemented with merging in
mind and discards information like file replaced by the copy of another,
criss-cross copies and so forth. I believe this information should not be lost,
even if we decide not to interpret it fully later, at merge time.
The second issue with improving rebase --collapse is the option should not be
there to begin with. Rebasing and collapsing are orthogonal and a dedicated
command would probably enable a better, simpler ui. We should avoid advertizing
rebase --collapse, but with this fix it becomes the best shipped solution to
collapse changesets.
And for the record, available techniques are:
- revert + commit + strip: lose copies
- mq/qfold: repeated patching() (mostly correct, fragile)
- rebase: repeated merges (mostly correct, fragile)
- collapse: revert + tag rewriting wizardry, lose copies
- histedit: repeated patching() (mostly correct, fragile)
- amend: copies.pathcopies() + commitctx() + update + strip
2012-05-03 17:14:58 +04:00
|
|
|
$ cat a
|
|
|
|
a
|
|
|
|
a
|
|
|
|
$ cat c
|
|
|
|
c
|
|
|
|
c
|
|
|
|
$ cat d
|
|
|
|
a
|
|
|
|
a
|
|
|
|
$ cat g
|
|
|
|
b
|
|
|
|
b
|
2012-04-30 00:25:55 +04:00
|
|
|
$ cd ..
|
2012-05-18 23:45:47 +04:00
|
|
|
|
|
|
|
|
|
|
|
Test stripping a revision with another child
|
|
|
|
|
|
|
|
$ hg init f
|
|
|
|
$ cd f
|
|
|
|
|
|
|
|
$ echo A > A
|
|
|
|
$ hg ci -Am A
|
|
|
|
adding A
|
|
|
|
$ echo B > B
|
|
|
|
$ hg ci -Am B
|
|
|
|
adding B
|
|
|
|
|
|
|
|
$ hg up -q 0
|
|
|
|
|
|
|
|
$ echo C > C
|
|
|
|
$ hg ci -Am C
|
|
|
|
adding C
|
|
|
|
created new head
|
|
|
|
|
|
|
|
$ hg tglog
|
|
|
|
@ 2: 'C'
|
|
|
|
|
|
|
|
|
| o 1: 'B'
|
|
|
|
|/
|
|
|
|
o 0: 'A'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$ hg heads --template="{rev}:{node} {branch}: {desc}\n"
|
|
|
|
2:c5cefa58fd557f84b72b87f970135984337acbc5 default: C
|
|
|
|
1:27547f69f25460a52fff66ad004e58da7ad3fb56 default: B
|
|
|
|
|
|
|
|
$ hg strip 2
|
|
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
2015-01-09 21:52:14 +03:00
|
|
|
saved backup bundle to $TESTTMP/f/.hg/strip-backup/c5cefa58fd55-629429f4-backup.hg (glob)
|
2012-05-18 23:45:47 +04:00
|
|
|
|
|
|
|
$ hg tglog
|
|
|
|
o 1: 'B'
|
|
|
|
|
|
|
|
|
@ 0: 'A'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$ hg heads --template="{rev}:{node} {branch}: {desc}\n"
|
|
|
|
1:27547f69f25460a52fff66ad004e58da7ad3fb56 default: B
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
2013-03-15 22:23:29 +04:00
|
|
|
Test collapsing changes that add then remove a file
|
2012-05-18 23:45:47 +04:00
|
|
|
|
2013-03-15 22:23:29 +04:00
|
|
|
$ hg init collapseaddremove
|
|
|
|
$ cd collapseaddremove
|
2012-05-18 23:45:47 +04:00
|
|
|
|
2013-03-15 22:23:29 +04:00
|
|
|
$ touch base
|
|
|
|
$ hg commit -Am base
|
|
|
|
adding base
|
|
|
|
$ touch a
|
|
|
|
$ hg commit -Am a
|
|
|
|
adding a
|
|
|
|
$ hg rm a
|
|
|
|
$ touch b
|
|
|
|
$ hg commit -Am b
|
|
|
|
adding b
|
2013-11-02 04:08:06 +04:00
|
|
|
$ hg book foo
|
2013-03-15 22:23:29 +04:00
|
|
|
$ hg rebase -d 0 -r "1::2" --collapse -m collapsed
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 1:6d8d9f24eec3 "a"
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 1:6d8d9f24eec3 created no changes to commit
|
2014-12-09 05:45:26 +03:00
|
|
|
rebasing 2:1cc73eca5ecc "b" (tip foo)
|
2014-12-10 08:20:35 +03:00
|
|
|
note: rebase of 2:1cc73eca5ecc created no changes to commit
|
2015-01-09 21:52:14 +03:00
|
|
|
saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/6d8d9f24eec3-77d3b6e2-backup.hg (glob)
|
2013-11-02 04:08:06 +04:00
|
|
|
$ hg log -G --template "{rev}: '{desc}' {bookmarks}"
|
|
|
|
@ 1: 'collapsed' foo
|
2013-03-15 22:23:29 +04:00
|
|
|
|
|
2013-11-02 04:08:06 +04:00
|
|
|
o 0: 'base'
|
2013-03-15 22:23:29 +04:00
|
|
|
|
2013-10-14 18:49:54 +04:00
|
|
|
$ hg manifest --rev tip
|
2013-03-15 22:23:29 +04:00
|
|
|
b
|
|
|
|
base
|
2012-05-18 23:45:47 +04:00
|
|
|
|
2013-03-15 22:23:29 +04:00
|
|
|
$ cd ..
|