sapling/eden/scm/tests/test-remotenames-cleanup.t
Jun Wu e006af173d debugresetheads: remove local bookmarks too
Summary:
`debugresetheads` is expected to remove all non-essential heads. That
includes bookmarks.

Reviewed By: kulshrax

Differential Revision: D27861548

fbshipit-source-id: 045976a5a9e27e7eee7ee48448c44552da439983
2021-04-19 15:19:41 -07:00

133 lines
2.8 KiB
Perl

#chg-compatible
$ configure modern
$ setconfig 'infinitepush.branchpattern=re:(^hack/.*)'
$ newserver server
$ clone server client1
$ clone server client2
$ clone server client3
$ clone server client4
$ clone server client5
Push 3 branches to the server.
$ cd client1
$ drawdag << 'EOS'
> B C D
> \|/
> A H
> |/
> Z
> EOS
$ hg push -r $Z --to release --create -q
$ hg push -r $B --to master --create -q
$ hg push -r $C --to other --create -q
$ hg push -r $D --to another --create -q
$ hg push -r $H --to hack/foo --create -q
Fetch all remote names:
$ cd $TESTTMP/client2
$ hg pull -B other -B master -B another -B release -B hack/foo -q
Commit (draft) on "another":
$ drawdag << 'EOS'
> E
> |
> desc(D)
> EOS
Cleanup: another is kept because of draft E, master is kept because it is
selectivepull default:
$ hg debugcleanremotenames
removed 3 non-essential remote bookmarks: remote/hack/foo, remote/other, remote/release
$ hg log -T '{desc} {remotenames} {phase}' -Gr 'all()'
o E draft
o D remote/another public
o B remote/master public
o A public
o Z public
'hide --cleanup' does the same thing:
$ cd $TESTTMP/client3
$ hg pull -B other -B master -B another -B release -q
$ enable amend
$ hg hide --cleanup
removed 3 non-essential remote bookmarks: remote/another, remote/other, remote/release
$ hg log -T '{desc} {remotenames} {phase}' -Gr 'all()'
o B remote/master public
o A public
o Z public
Auto cleanup triggered by remotenames.autocleanupthreshold:
$ cd $TESTTMP/client4
$ hg pull -B other -B master -B another -B release -q
$ hg log -T '{desc} {remotenames} {phase}' -Gr 'all()' --config remotenames.autocleanupthreshold=1
attempt to clean up remote bookmarks since they exceed threshold 1
removed 3 non-essential remote bookmarks: remote/another, remote/other, remote/release
o B remote/master public
o A public
o Z public
Resethead command to reset all heads (including draft heads):
$ cd $TESTTMP
$ cd client5
$ hg pull -B other -B master -B another -B release -q
$ drawdag << 'EOS'
> E
> |
> desc(D)
> EOS
$ hg log -T '{desc} {remotenames} {phase}' -Gr 'all()'
o E draft
o D remote/another public
o C remote/other public
o B remote/master public
o A public
o Z remote/release public
$ hg debugresetheads
Notice that only the "master" head is left:
$ hg log -T '{desc} {remotenames} {phase}' -Gr 'all()'
o B remote/master public
o A public
o Z public
Resethead command removes local bookmarks too:
$ hg bookmark -r 'desc(A)' book-A
$ hg bookmarks
book-A ac2f7407182b
$ hg debugresetheads
$ hg bookmarks
no bookmarks set