2016-11-16 05:46:56 +03:00
|
|
|
Set up test environment.
|
|
|
|
$ cat >> $HGRCPATH << EOF
|
|
|
|
> [extensions]
|
2018-10-11 16:55:19 +03:00
|
|
|
> amend=
|
2016-11-16 05:46:56 +03:00
|
|
|
> rebase=
|
|
|
|
> [experimental]
|
|
|
|
> evolution = createmarkers
|
2018-10-31 20:25:06 +03:00
|
|
|
> [ui]
|
|
|
|
> disallowemptyupdate = True
|
2016-11-16 05:46:56 +03:00
|
|
|
> EOF
|
2018-10-11 16:55:19 +03:00
|
|
|
$ hg init amendprevious && cd amendprevious
|
2016-11-16 05:46:56 +03:00
|
|
|
|
|
|
|
Check help text for new options and removal of unsupported options.
|
|
|
|
$ hg previous --help
|
2017-06-14 03:09:16 +03:00
|
|
|
hg previous [OPTIONS]... [STEPS]
|
2016-11-16 05:46:56 +03:00
|
|
|
|
2018-11-08 06:57:38 +03:00
|
|
|
check out the parent commit
|
2016-11-16 05:46:56 +03:00
|
|
|
|
2018-10-15 19:35:15 +03:00
|
|
|
Options:
|
2016-11-16 05:46:56 +03:00
|
|
|
|
|
|
|
--newest always pick the newest parent when a changeset has
|
|
|
|
multiple parents
|
|
|
|
--bottom update to the lowest non-public ancestor of the
|
|
|
|
current changeset
|
|
|
|
--bookmark update to the first ancestor with a bookmark
|
|
|
|
--no-activate-bookmark do not activate the bookmark on the destination
|
|
|
|
changeset
|
2019-02-21 01:45:26 +03:00
|
|
|
-C --clean discard uncommitted changes (no backup)
|
2017-06-14 03:09:16 +03:00
|
|
|
-B --move-bookmark move active bookmark
|
2019-02-21 01:45:26 +03:00
|
|
|
-m --merge merge uncommitted changes
|
2016-11-16 05:46:56 +03:00
|
|
|
|
|
|
|
(some details hidden, use --verbose to show complete help)
|
|
|
|
|
|
|
|
Create stack of commits and go to the top.
|
2019-02-21 00:46:26 +03:00
|
|
|
$ hg debugbuilddag --mergeable-file +6
|
|
|
|
$ hg up tip
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2016-11-16 05:46:56 +03:00
|
|
|
$ hg book top
|
|
|
|
|
|
|
|
Test invalid argument combinations.
|
|
|
|
$ hg previous --bottom 1
|
|
|
|
abort: cannot use both number and --bottom
|
|
|
|
[255]
|
|
|
|
$ hg previous --bookmark 1
|
|
|
|
abort: cannot use both number and --bookmark
|
|
|
|
[255]
|
|
|
|
$ hg previous --bottom --bookmark
|
|
|
|
abort: cannot use both --bottom and --bookmark
|
|
|
|
[255]
|
|
|
|
|
|
|
|
Test basic usage.
|
|
|
|
$ hg previous
|
2019-02-21 00:46:26 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2016-11-16 05:46:56 +03:00
|
|
|
(leaving bookmark top)
|
2019-02-21 00:46:26 +03:00
|
|
|
[*] r4 (glob)
|
2016-11-16 05:46:56 +03:00
|
|
|
|
|
|
|
With positional argument.
|
|
|
|
$ hg previous 2
|
2019-02-21 00:46:26 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
[*] r2 (glob)
|
2016-11-16 05:46:56 +03:00
|
|
|
|
|
|
|
Overshoot bottom of repo.
|
|
|
|
$ hg previous 5
|
|
|
|
reached root changeset
|
2019-02-21 00:46:26 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
[*] r0 (glob)
|
2016-11-16 05:46:56 +03:00
|
|
|
|
|
|
|
Test --bottom flag.
|
|
|
|
$ hg up top
|
2019-02-21 00:46:26 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2016-11-16 05:46:56 +03:00
|
|
|
(activating bookmark top)
|
|
|
|
$ hg previous --bottom
|
2019-02-21 00:46:26 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2018-10-31 20:25:07 +03:00
|
|
|
(leaving bookmark top)
|
2019-02-21 00:46:26 +03:00
|
|
|
[*] r0 (glob)
|
2016-11-16 05:46:56 +03:00
|
|
|
|
|
|
|
Test bookmark navigation.
|
2019-02-21 00:46:26 +03:00
|
|
|
$ hg book -r 0 root
|
|
|
|
$ hg book -r 2 bookmark
|
2016-11-16 05:46:56 +03:00
|
|
|
$ hg up top
|
2019-02-21 00:46:26 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2018-10-31 20:25:07 +03:00
|
|
|
(activating bookmark top)
|
2016-11-16 05:46:56 +03:00
|
|
|
$ hg previous --bookmark
|
2019-02-21 00:46:26 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2016-11-16 05:46:56 +03:00
|
|
|
(leaving bookmark top)
|
2019-02-21 00:46:26 +03:00
|
|
|
[*] (bookmark) r2 (glob)
|
2016-11-16 05:46:56 +03:00
|
|
|
(activating bookmark bookmark)
|
|
|
|
$ hg previous --bookmark
|
2019-02-21 00:46:26 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2018-10-31 20:25:07 +03:00
|
|
|
(leaving bookmark bookmark)
|
2019-02-21 00:46:26 +03:00
|
|
|
[*] (root) r0 (glob)
|
2018-10-31 20:25:07 +03:00
|
|
|
(activating bookmark root)
|
2016-11-16 05:46:56 +03:00
|
|
|
|
|
|
|
Test bookmark activation.
|
|
|
|
$ hg up top
|
2019-02-21 00:46:26 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2016-11-16 05:46:56 +03:00
|
|
|
(activating bookmark top)
|
|
|
|
$ hg previous 3
|
2019-02-21 00:46:26 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2016-11-16 05:46:56 +03:00
|
|
|
(leaving bookmark top)
|
2019-02-21 00:46:26 +03:00
|
|
|
[*] (bookmark) r2 (glob)
|
2016-11-16 05:46:56 +03:00
|
|
|
(activating bookmark bookmark)
|
|
|
|
$ hg previous 2 --no-activate-bookmark
|
2019-02-21 00:46:26 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2018-10-31 20:25:07 +03:00
|
|
|
(leaving bookmark bookmark)
|
2019-02-21 00:46:26 +03:00
|
|
|
[*] (root) r0 (glob)
|
2016-11-16 05:46:56 +03:00
|
|
|
|
|
|
|
Test dirty working copy and --merge.
|
|
|
|
$ hg up top
|
2019-02-21 00:46:26 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2016-11-16 05:46:56 +03:00
|
|
|
(activating bookmark top)
|
2019-02-21 00:46:26 +03:00
|
|
|
$ echo "test" >> mf
|
2016-11-16 05:46:56 +03:00
|
|
|
$ hg st
|
2019-02-21 00:46:26 +03:00
|
|
|
M mf
|
2016-11-16 05:46:56 +03:00
|
|
|
$ hg previous
|
|
|
|
abort: uncommitted changes
|
2017-07-19 06:13:25 +03:00
|
|
|
(use --clean to discard uncommitted changes or --merge to bring them along)
|
2016-11-16 05:46:56 +03:00
|
|
|
[255]
|
|
|
|
$ hg previous --merge
|
2019-02-21 00:46:26 +03:00
|
|
|
merging mf
|
|
|
|
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
|
2016-11-16 05:46:56 +03:00
|
|
|
(leaving bookmark top)
|
2019-02-21 00:46:26 +03:00
|
|
|
[*] r4 (glob)
|
2016-11-16 05:46:56 +03:00
|
|
|
$ hg st
|
2019-02-21 00:46:26 +03:00
|
|
|
M mf
|
2017-07-19 06:13:25 +03:00
|
|
|
|
|
|
|
Test dirty working copy and --clean.
|
|
|
|
$ hg previous
|
|
|
|
abort: uncommitted changes
|
|
|
|
(use --clean to discard uncommitted changes or --merge to bring them along)
|
|
|
|
[255]
|
|
|
|
$ hg previous --clean
|
2019-02-21 00:46:26 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
[*] r3 (glob)
|
2017-07-19 06:13:25 +03:00
|
|
|
$ hg st
|