sapling/eden/hg-server/tests/test-amend-next.t
Durham Goode 98d9269874 server: copy hg to a new hg-server directory
Summary:
Create a fork of the Mercurial code that we can use to build server
rpms. The hg servers will continue to exist for a few more months while we move
the darkstorm and ediscovery use cases off them. In the mean time, we want to
start making breaking changes to the client, so let's create a stable copy of
the hg code to produce rpms for the hg servers.

The fork is based off c7770c78d, the latest hg release.

This copies the files as is, then adds some minor tweaks to get it to build:
- Disables some lint checks that appear to be bypassed by path
- sed replace eden/scm with eden/hg-server
- Removed a dependency on scm/telemetry from the edenfs-client tests since
  scm/telemetry pulls in the original eden/scm/lib/configparser which conflicts
  with the hg-server conflict parser.

allow-large-files

Reviewed By: quark-zju

Differential Revision: D27632557

fbshipit-source-id: b2f442f4ec000ea08e4d62de068750832198e1f4
2021-04-09 10:09:06 -07:00

292 lines
7.3 KiB
Perl

#chg-compatible
Set up test environment.
$ configure mutation-norecord
$ enable amend rebase
$ showgraph() {
> hg log --graph -T "{bookmarks} {desc|firstline}" | sed \$d
> }
$ newrepo
Check help text for new options and removal of unsupported options.
$ hg next --help
hg next [OPTIONS]... [STEPS]
aliases: n
check out a child commit
Options:
--newest always pick the newest child when a changeset has
multiple children
--rebase rebase each changeset if necessary
--top update to the head of the current stack
--bookmark update to the first changeset with a bookmark
--no-activate-bookmark do not activate the bookmark on the destination
changeset
--towards VALUE move linearly towards the specified head
-C --clean discard uncommitted changes (no backup)
-B --move-bookmark move active bookmark
-m --merge merge uncommitted changes
-c --check require clean working directory
(some details hidden, use --verbose to show complete help)
Create stack of commits and go to the bottom.
$ hg debugbuilddag --mergeable-file +6
$ hg up 'desc(r0)'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg book bottom
$ showgraph
o r5
o r4
o r3
o r2
o r1
@ bottom r0
Test invalid argument combinations.
$ hg next --top 1
abort: cannot use both number and --top
[255]
$ hg next --bookmark 1
abort: cannot use both number and --bookmark
[255]
$ hg next --top --bookmark
abort: cannot use both --top and --bookmark
[255]
$ hg next --top --towards top
abort: cannot use both --top and --towards
[255]
Test basic usage.
$ hg next
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(leaving bookmark bottom)
[*] r1 (glob)
With positional argument.
$ hg next 2
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
[*] r3 (glob)
Overshoot top of repo.
$ hg next 5
reached head changeset
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
[*] r5 (glob)
Test --top flag.
$ hg up bottom
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(activating bookmark bottom)
$ hg next --top
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(leaving bookmark bottom)
[*] r5 (glob)
Test bookmark navigation.
$ hg book -r 'desc(r5)' top
$ hg book -r 'desc(r3)' bookmark
$ showgraph
@ top r5
o r4
o bookmark r3
o r2
o r1
o bottom r0
$ hg up bottom
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(activating bookmark bottom)
$ hg next --bookmark
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(leaving bookmark bottom)
[*] (bookmark) r3 (glob)
(activating bookmark bookmark)
$ hg next --bookmark
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(leaving bookmark bookmark)
[*] (top) r5 (glob)
(activating bookmark top)
Test bookmark activation.
$ hg up bottom
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(activating bookmark bottom)
$ hg next 3
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(leaving bookmark bottom)
[*] (bookmark) r3 (glob)
(activating bookmark bookmark)
$ hg next 2 --no-activate-bookmark
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(leaving bookmark bookmark)
[*] (top) r5 (glob)
Test dirty working copy and --clean.
$ hg up bottom
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(activating bookmark bottom)
$ touch test
$ hg add test
$ hg st
A test
$ hg next --check
abort: uncommitted changes
[255]
$ hg next --clean
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(leaving bookmark bottom)
[*] r1 (glob)
$ hg st
? test
$ rm test
Test dirty working copy and --merge.
$ hg up bottom
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(activating bookmark bottom)
$ echo test >> mf
$ hg st
M mf
$ hg next --check
abort: uncommitted changes
[255]
$ hg next --merge
merging mf
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(leaving bookmark bottom)
[*] r1 (glob)
$ hg st
M mf
$ hg up -C .
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Test --newest flag.
$ hg up 'desc(r3)'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ touch test
$ hg add test
$ hg commit -m "test"
$ hg book other
$ showgraph
@ other test
o top r5
o r4
o bookmark r3
o r2
o r1
o bottom r0
$ hg up bottom
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
(activating bookmark bottom)
$ hg next --top
current stack has multiple heads, namely:
[*] (top) r5 (glob)
[*] (other) test (glob)
abort: ambiguous next changeset
(use the --newest flag to always pick the newest child at each step)
[255]
$ hg log -r .
commit: fdaccbb26270
bookmark: bottom
user: debugbuilddag
date: Thu Jan 01 00:00:00 1970 +0000
summary: r0
$ hg next --top --newest
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
(leaving bookmark bottom)
[*] (other) test (glob)
(activating bookmark other)
Test --towards flag.
$ hg up bottom
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
(activating bookmark bottom)
$ showgraph
o other test
o top r5
o r4
o bookmark r3
o r2
o r1
@ bottom r0
$ hg next 4 --towards 'desc(r1)'
changeset * has multiple children, namely: (glob)
[*] r4 (glob)
[*] (other) test (glob)
abort: ambiguous next changeset
(use the --newest or --towards flags to specify which child to pick)
[255]
$ hg next 4 --towards 'top+other'
abort: 'top+other' refers to multiple changesets
[255]
$ hg next 4 --towards top
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(leaving bookmark bottom)
[*] r4 (glob)
$ hg next --towards other
abort: the current changeset is not an ancestor of 'other'
[255]
Test next prefer draft commit.
$ hg up 'desc(r3)'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ showgraph
o other test
o top r5
o r4
@ bookmark r3
o r2
o r1
o bottom r0
Here we have 2 draft children.
$ hg next
changeset * has multiple children, namely: (glob)
[*] r4 (glob)
[*] (other) test (glob)
abort: ambiguous next changeset
(use the --newest or --towards flags to specify which child to pick)
[255]
Let's make one of child commits public.
$ hg debugmakepublic top
Now we have only 1 draft child.
$ hg next
changeset * has multiple children, namely: (glob)
[*] r4 (glob)
[*] (other) test (glob)
choosing the only draft child: * (glob)
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
[*] (other) test (glob)
(activating bookmark other)