mirror of
https://github.com/facebook/sapling.git
synced 2024-12-29 08:02:24 +03:00
856e8ab3ef
Summary: Re-implement the `findcommonheads` logic using `changelog` APIs that are going to have native support from Rust. This decouples from revlog-based Python DAG logic, namely `dagutil.revlogdag`, and `ancestor.incrementalmissingancestors`, unblocking Rust DAG progress, and cleans up the algorithm to not use revision numbers. The core algorithm is unchanged. The sampling logic is simplified and tweaked a bit (ex. no 'initial' / 'quick initial' special cases). The debug and progress messages are more verbose, and variable names are chosen to match the docstrings. I improved the doc a bit, and added some TODO notes about where I think can be improved. Reviewed By: sfilipco Differential Revision: D22519582 fbshipit-source-id: ac8cc8bebad91b4045d69f402e69b7ca28146414
181 lines
4.2 KiB
Perl
181 lines
4.2 KiB
Perl
#chg-compatible
|
|
|
|
> mkcommit()
|
|
> {
|
|
> echo $1 > $1
|
|
> hg add $1
|
|
> hg ci -m "add $1"
|
|
> }
|
|
|
|
Set up extension and repos to clone over wire protocol
|
|
|
|
$ configure dummyssh
|
|
$ enable remotenames
|
|
$ setconfig phases.publish=false
|
|
|
|
$ hg init repo1
|
|
$ hg clone ssh://user@dummy/repo1 repo2
|
|
no changes found
|
|
updating to branch default
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
$ cd repo2
|
|
|
|
Test that anonymous heads are disallowed by default
|
|
|
|
$ echo a > a
|
|
$ hg add a
|
|
$ hg commit -m a
|
|
$ hg push
|
|
pushing to ssh://user@dummy/repo1
|
|
searching for changes
|
|
abort: push would create new anonymous heads (cb9a9f314b8b)
|
|
(use --allow-anon to override this warning)
|
|
[255]
|
|
|
|
Create a remote bookmark
|
|
|
|
$ hg push --to @ --create
|
|
pushing rev cb9a9f314b8b to destination ssh://user@dummy/repo1 bookmark @
|
|
searching for changes
|
|
exporting bookmark @
|
|
remote: adding changesets
|
|
remote: adding manifests
|
|
remote: adding file changes
|
|
remote: added 1 changesets with 1 changes to 1 files
|
|
|
|
Test that we can still push a head that advances a remote bookmark
|
|
|
|
$ echo b >> a
|
|
$ hg commit -m b
|
|
$ hg book @
|
|
$ hg push
|
|
pushing to ssh://user@dummy/repo1
|
|
searching for changes
|
|
updating bookmark @
|
|
remote: adding changesets
|
|
remote: adding manifests
|
|
remote: adding file changes
|
|
remote: added 1 changesets with 1 changes to 1 files
|
|
|
|
Test --delete
|
|
|
|
$ hg push --delete @
|
|
pushing to ssh://user@dummy/repo1
|
|
searching for changes
|
|
no changes found
|
|
deleting remote bookmark @
|
|
[1]
|
|
|
|
Test that we don't get an abort if we're doing a bare push that does nothing
|
|
|
|
$ hg bookmark -d @
|
|
$ hg push
|
|
pushing to ssh://user@dummy/repo1
|
|
searching for changes
|
|
no changes found
|
|
[1]
|
|
|
|
Test that we can still push a head if there are no bookmarks in either the
|
|
remote or local repo
|
|
|
|
$ echo c >> a
|
|
$ hg commit -m c
|
|
$ hg push --allow-anon
|
|
pushing to ssh://user@dummy/repo1
|
|
searching for changes
|
|
remote: adding changesets
|
|
remote: adding manifests
|
|
remote: adding file changes
|
|
remote: added 1 changesets with 1 changes to 1 files
|
|
|
|
|
|
$ hg log -G -T '{rev} {node|short} {bookmarks} {remotebookmarks}\n'
|
|
@ 2 2d95304fed5d
|
|
|
|
|
o 1 1846eede8b68
|
|
|
|
|
o 0 cb9a9f314b8b
|
|
|
|
$ hg bookmark foo
|
|
$ hg push -B foo
|
|
pushing to ssh://user@dummy/repo1
|
|
searching for changes
|
|
no changes found
|
|
exporting bookmark foo
|
|
[1]
|
|
$ hg log -G -T '{rev} {node|short} {bookmarks} {remotebookmarks}\n'
|
|
@ 2 2d95304fed5d foo default/foo
|
|
|
|
|
o 1 1846eede8b68
|
|
|
|
|
o 0 cb9a9f314b8b
|
|
|
|
$ hg boo -d foo
|
|
$ hg debugstrip . -q
|
|
$ hg log -G -T '{rev} {node|short} {bookmarks} {remotebookmarks}\n'
|
|
@ 1 1846eede8b68
|
|
|
|
|
o 0 cb9a9f314b8b
|
|
|
|
$ hg push
|
|
pushing to ssh://user@dummy/repo1
|
|
searching for changes
|
|
no changes found
|
|
[1]
|
|
|
|
Test pushrev configuration option
|
|
|
|
$ setglobalconfig remotenames.pushrev=.
|
|
$ echo d >> a
|
|
$ hg commit -qm 'da'
|
|
$ hg push
|
|
pushing to ssh://user@dummy/repo1
|
|
searching for changes
|
|
abort: push would create new anonymous heads (7481df5f123a)
|
|
(use --allow-anon to override this warning)
|
|
[255]
|
|
|
|
Set up server repo
|
|
$ hg init rnserver
|
|
$ cd rnserver
|
|
$ mkcommit a
|
|
$ hg book -r 'desc(add)' rbook
|
|
$ cd ..
|
|
|
|
Set up client repo
|
|
$ hg clone rnserver rnclient
|
|
updating to branch default
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
$ cd rnclient
|
|
$ hg book --all
|
|
no bookmarks set
|
|
default/rbook 0:1f0dee641bb7
|
|
$ cd ..
|
|
|
|
Advance a server bookmark to an unknown commit and create a new server bookmark
|
|
We want to test both the advancement of locally known remote bookmark and the
|
|
creation of a new one (locally unknonw).
|
|
$ cd rnserver
|
|
$ mkcommit b
|
|
$ hg book -r 'max(desc(add))' rbook
|
|
moving bookmark 'rbook' forward from 1f0dee641bb7
|
|
$ hg book -r 'max(desc(add))' rbook2
|
|
$ hg book
|
|
rbook 1:7c3bad9141dc
|
|
rbook2 1:7c3bad9141dc
|
|
$ cd ..
|
|
|
|
Force client to get data about new bookmarks without getting commits
|
|
$ cd rnclient
|
|
$ hg push
|
|
pushing to $TESTTMP/repo2/rnserver
|
|
searching for changes
|
|
no changes found
|
|
[1]
|
|
$ hg book --all
|
|
no bookmarks set
|
|
default/rbook 0:1f0dee641bb7
|
|
$ hg update rbook
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|