mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
infinitepush: remove server replay features
Summary: Remove forwardfill and replaybookmarks. They are no longer needed on the client-side. This also makes it easier to drop obsstore. Differential Revision: D31877898 fbshipit-source-id: 5e38a432ee14820ecdac637dde30e155ba60f1ff
This commit is contained in:
parent
03462e4db2
commit
c59d6d61f8
@ -71,15 +71,6 @@ Configs::
|
||||
# Name of the repository
|
||||
reponame = ''
|
||||
|
||||
# Server-side option. Used only if storetype=sql
|
||||
# Whether or not to record new bundles into the forwardfillqueue table.
|
||||
forwardfill = False
|
||||
|
||||
# Server-side option. Used only if storetype=sql
|
||||
# Whether or not to record new scratch bookmarks into the
|
||||
# replaybookmarksqueue table.
|
||||
replaybookmarks = False
|
||||
|
||||
# Client-side option. Used by --list-remote option. List of remote scratch
|
||||
# patterns to list if no patterns are specified.
|
||||
defaultremotepatterns = ['*']
|
||||
|
@ -79,8 +79,6 @@ class sqlindex(object):
|
||||
self.shorthasholdrevthreshold = ui.configint(
|
||||
"infinitepush", "shorthasholdrevthreshold", 60
|
||||
)
|
||||
self.forwardfill = ui.configbool("infinitepush", "forwardfill")
|
||||
self.replaybookmarks = ui.configbool("infinitepush", "replaybookmarks")
|
||||
|
||||
def sqlconnect(self):
|
||||
if self.sqlconn:
|
||||
@ -154,12 +152,6 @@ class sqlindex(object):
|
||||
params=(bundleid, self.reponame),
|
||||
)
|
||||
|
||||
if self.forwardfill and bundleid is not None and not iscrossbackendsync:
|
||||
self.sqlcursor.execute(
|
||||
"INSERT INTO forwardfillerqueue(bundle, reponame) VALUES (%s, %s)",
|
||||
params=(bundleid, self.reponame),
|
||||
)
|
||||
|
||||
# insert nodes to bundle mapping
|
||||
|
||||
self.sqlcursor.executemany(
|
||||
@ -208,8 +200,6 @@ class sqlindex(object):
|
||||
params=(bookmark, node, self.reponame),
|
||||
)
|
||||
|
||||
self.logmanybookmarksforreplay({bookmark: node}, isbackup)
|
||||
|
||||
def addmanybookmarks(self, bookmarks, isbackup):
|
||||
"""Record the contents of the ``bookmarks`` dict as bookmarks."""
|
||||
if not self._connected:
|
||||
@ -226,8 +216,6 @@ class sqlindex(object):
|
||||
data,
|
||||
)
|
||||
|
||||
self.logmanybookmarksforreplay(bookmarks, isbackup)
|
||||
|
||||
def deletebookmarks(self, patterns):
|
||||
"""Delete all bookmarks that match any of the patterns in ``patterns``."""
|
||||
if not self._connected:
|
||||
@ -417,32 +405,6 @@ class sqlindex(object):
|
||||
params=(jsonmetadata, self.reponame, node),
|
||||
)
|
||||
|
||||
def logmanybookmarksforreplay(self, bookmarks, isbackup):
|
||||
"""Log the contents of the ``bookmarks`` dict for replay."""
|
||||
|
||||
if isbackup:
|
||||
# We don't replay backup bookmarks.
|
||||
return
|
||||
|
||||
if not self.replaybookmarks:
|
||||
return
|
||||
|
||||
data = [
|
||||
(
|
||||
bookmark,
|
||||
node,
|
||||
hashlib.sha1(pycompat.encodeutf8(bookmark)).hexdigest(),
|
||||
self.reponame,
|
||||
)
|
||||
for (bookmark, node) in pycompat.iteritems(bookmarks)
|
||||
]
|
||||
|
||||
self.sqlcursor.executemany(
|
||||
"INSERT INTO replaybookmarksqueue(bookmark, node, bookmark_hash, reponame) "
|
||||
"VALUES (%s, %s, %s, %s)",
|
||||
data,
|
||||
)
|
||||
|
||||
|
||||
class CustomConverter(mysql.connector.conversion.MySQLConverter):
|
||||
"""Ensure that all values being returned are returned as python string
|
||||
|
@ -9,10 +9,6 @@ mutationblacklist = """
|
||||
test-fb-hgext-hiddenerror.t
|
||||
test-fb-hgext-treemanifest-infinitepush.t
|
||||
test-fb-hgext-treemanifest-treeonly-linknodes.t
|
||||
test-infinitepush-forwardfillerqueue.t
|
||||
test-infinitepush-replaybookmarksqueue-ignore-backup.t
|
||||
test-infinitepush-replaybookmarksqueue-multiple-updates.t
|
||||
test-infinitepush-replaybookmarksqueue-one-bookmark.t
|
||||
test-inherit-mode.t
|
||||
test-mutation-fromobsmarkers.t
|
||||
test-rebase-dest.t
|
||||
|
@ -74,20 +74,6 @@ reponame=$1
|
||||
EOF
|
||||
}
|
||||
|
||||
enableforwardfill() {
|
||||
cat << EOF >> .hg/hgrc
|
||||
[infinitepush]
|
||||
forwardfill=True
|
||||
EOF
|
||||
}
|
||||
|
||||
enablereplaybookmarks() {
|
||||
cat << EOF >> .hg/hgrc
|
||||
[infinitepush]
|
||||
replaybookmarks=True
|
||||
EOF
|
||||
}
|
||||
|
||||
createinfinitepushtablessql() {
|
||||
cat <<EOF
|
||||
DROP TABLE IF EXISTS nodestobundle;
|
||||
|
@ -1,89 +0,0 @@
|
||||
#chg-compatible
|
||||
|
||||
#if no-windows no-osx
|
||||
$ disable treemanifest
|
||||
$ mkcommit() {
|
||||
> echo "$1" > "$1"
|
||||
> hg add "$1"
|
||||
> hg ci -d "0 0" -m "$1"
|
||||
> }
|
||||
$ . "$TESTDIR/infinitepush/library.sh"
|
||||
$ setupcommon
|
||||
|
||||
Configure the server
|
||||
$ hg init server
|
||||
$ cd server
|
||||
$ setupsqlserverhgrc repo123
|
||||
$ setupdb
|
||||
$ cd ..
|
||||
|
||||
Without forwardfill, it should not insert into the queue
|
||||
$ hg clone -q ssh://user@dummy/server client1
|
||||
$ cd client1
|
||||
$ setupsqlclienthgrc
|
||||
$ mkcommit commit1
|
||||
$ hg push -r . --to scratch/book --create
|
||||
pushing to ssh://user@dummy/server
|
||||
searching for changes
|
||||
remote: pushing 1 commit:
|
||||
remote: cb9a30b04b9d commit1
|
||||
$ cd ..
|
||||
|
||||
Enable forwardfill on the server
|
||||
$ cd server
|
||||
$ enableforwardfill
|
||||
$ cd ..
|
||||
|
||||
With forwardfill, it should insert into the queue
|
||||
$ hg clone -q ssh://user@dummy/server client2
|
||||
$ cd client2
|
||||
$ setupsqlclienthgrc
|
||||
$ mkcommit commit2
|
||||
$ hg push -r . --to scratch/book2 --create
|
||||
pushing to ssh://user@dummy/server
|
||||
searching for changes
|
||||
remote: pushing 1 commit:
|
||||
remote: 6fdf683f5af9 commit2
|
||||
$ cd ..
|
||||
|
||||
Proper metadata should have been recorded
|
||||
$ querysqlindex "SELECT * FROM nodestobundle;"
|
||||
node bundle reponame
|
||||
6fdf683f5af9a2be091b81ef475f335e2624fb0d 8347a06785e3bdd572ebeb7df3aac1356acb4ce5 repo123
|
||||
cb9a30b04b9df854f40d21fdac525408f3bd6c78 944fe1c133f63c7711aa15db2dd9216084dacc36 repo123
|
||||
$ querysqlindex "SELECT id, reponame, bundle FROM forwardfillerqueue;"
|
||||
id reponame bundle
|
||||
1 repo123 8347a06785e3bdd572ebeb7df3aac1356acb4ce5
|
||||
|
||||
Check that crossbackendsync bundle param prevents us from recording into forwardfillerqueue
|
||||
-- set up param-adding extension to test crossbackendsync
|
||||
$ cat >> "$TESTTMP/param_adder.py" <<EOF
|
||||
> from __future__ import absolute_import
|
||||
> from edenscm.mercurial import exchange, extensions
|
||||
> from edenscm.hgext.infinitepush import bundleparts, constants
|
||||
>
|
||||
> def extsetup(ui):
|
||||
> orig = exchange.b2partsgenmapping[constants.scratchbranchparttype]
|
||||
> def wrapped(pushop, bundler):
|
||||
> bundler.addparam("crossbackendsync", value="True")
|
||||
> return orig(pushop, bundler)
|
||||
> exchange.b2partsgenmapping[constants.scratchbranchparttype] = wrapped
|
||||
> EOF
|
||||
|
||||
-- try pushing to Mercurial backend with this new extension
|
||||
$ cd "$TESTTMP/client2"
|
||||
$ mkcommit commit3
|
||||
$ hg push -r . --to scratch/book3 --create \
|
||||
> --debug --config devel.bundle2.debug=on \
|
||||
> --config extensions.param_adder="$TESTTMP/param_adder.py" \
|
||||
> 2>&1 | egrep '(commit3|crossbackendsync)'
|
||||
bundle2-output: bundle parameter: crossbackendsync=True infinitepush=True
|
||||
remote: 8e0c8ddac9fb commit3
|
||||
|
||||
-- note that this new push has *not* been recorded in the forwardfillerqueue
|
||||
because of the crossbackendsync param
|
||||
$ querysqlindex "SELECT id, reponame, bundle FROM forwardfillerqueue;"
|
||||
id reponame bundle
|
||||
1 repo123 8347a06785e3bdd572ebeb7df3aac1356acb4ce5
|
||||
|
||||
#endif
|
@ -1,59 +0,0 @@
|
||||
#chg-compatible
|
||||
|
||||
#if no-windows no-osx
|
||||
$ disable treemanifest
|
||||
$ mkcommit() {
|
||||
> echo "$1" > "$1"
|
||||
> hg add "$1"
|
||||
> hg ci -d "0 0" -m "$1"
|
||||
> }
|
||||
$ . "$TESTDIR/infinitepush/library.sh"
|
||||
$ setupcommon
|
||||
|
||||
Configure the server
|
||||
$ hg init server
|
||||
$ cd server
|
||||
$ setupsqlserverhgrc repo123
|
||||
$ setupdb
|
||||
$ enablereplaybookmarks
|
||||
$ cd ..
|
||||
|
||||
It should backup many bookmarks
|
||||
$ hg clone -q ssh://user@dummy/server client
|
||||
$ cd client
|
||||
$ setupsqlclienthgrc
|
||||
$ mkcommit commit0
|
||||
$ commit0="$(hg id -i)"
|
||||
$ hg up -q "$commit0" && mkcommit commit1
|
||||
$ hg up -q "$commit0" && mkcommit commit2
|
||||
$ hg up -q "$commit0" && mkcommit commit3
|
||||
$ hg cloud backup
|
||||
backing up stack rooted at ace906b76ab4
|
||||
commitcloud: backed up 4 commits
|
||||
remote: pushing 4 commits:
|
||||
remote: ace906b76ab4 commit0
|
||||
remote: b1e07bb9979c commit1
|
||||
remote: 33701f08790f commit2
|
||||
remote: db45a2d42cf6 commit3
|
||||
$ hg push -r . --to scratch/book --create
|
||||
pushing to ssh://user@dummy/server
|
||||
searching for changes
|
||||
remote: pushing 2 commits:
|
||||
remote: ace906b76ab4 commit0
|
||||
remote: db45a2d42cf6 commit3
|
||||
$ cd ..
|
||||
|
||||
Backups should be excluded
|
||||
$ querysqlindex "SELECT * FROM nodestobundle;"
|
||||
node bundle reponame
|
||||
33701f08790f0e038ca262ddb72728754f60ec88 318c3749b9def132140c54c6f84e853855aa5042 repo123
|
||||
ace906b76ab45ac794eb67142e1466725def57cb 318c3749b9def132140c54c6f84e853855aa5042 repo123
|
||||
b1e07bb9979cf151ae6a05d0cd9008737c77dfea 318c3749b9def132140c54c6f84e853855aa5042 repo123
|
||||
db45a2d42cf67d746ba59e17f09df3eb9e8c2f4c 318c3749b9def132140c54c6f84e853855aa5042 repo123
|
||||
$ querysqlindex "SELECT reponame, synced, bookmark, node FROM replaybookmarksqueue;"
|
||||
reponame synced bookmark node
|
||||
repo123 0 scratch/book db45a2d42cf67d746ba59e17f09df3eb9e8c2f4c
|
||||
$ querysqlindex "SELECT reponame, bookmark, node FROM bookmarkstonode ORDER BY node ASC;"
|
||||
reponame bookmark node
|
||||
repo123 scratch/book db45a2d42cf67d746ba59e17f09df3eb9e8c2f4c
|
||||
#endif
|
@ -1,59 +0,0 @@
|
||||
#chg-compatible
|
||||
|
||||
#if no-windows no-osx
|
||||
$ disable treemanifest
|
||||
$ mkcommit() {
|
||||
> echo "$1" > "$1"
|
||||
> hg add "$1"
|
||||
> hg ci -d "0 0" -m "$1"
|
||||
> }
|
||||
$ . "$TESTDIR/infinitepush/library.sh"
|
||||
$ setupcommon
|
||||
|
||||
Configure the server
|
||||
$ hg init server
|
||||
$ cd server
|
||||
$ setupsqlserverhgrc repo123
|
||||
$ setupdb
|
||||
$ enablereplaybookmarks
|
||||
$ cd ..
|
||||
|
||||
It should insert an entry for each update
|
||||
$ hg clone -q ssh://user@dummy/server client2
|
||||
$ cd client2
|
||||
$ setupsqlclienthgrc
|
||||
$ mkcommit commit2
|
||||
$ hg push -r . --to scratch/123 --create
|
||||
pushing to ssh://user@dummy/server
|
||||
searching for changes
|
||||
remote: pushing 1 commit:
|
||||
remote: 6fdf683f5af9 commit2
|
||||
$ mkcommit commit3
|
||||
$ hg push -r . --to scratch/123
|
||||
pushing to ssh://user@dummy/server
|
||||
searching for changes
|
||||
remote: pushing 2 commits:
|
||||
remote: 6fdf683f5af9 commit2
|
||||
remote: 8e0c8ddac9fb commit3
|
||||
$ mkcommit commit4
|
||||
$ hg push -r . --to scratch/123
|
||||
pushing to ssh://user@dummy/server
|
||||
searching for changes
|
||||
remote: pushing 3 commits:
|
||||
remote: 6fdf683f5af9 commit2
|
||||
remote: 8e0c8ddac9fb commit3
|
||||
remote: feccf85eaa94 commit4
|
||||
$ cd ..
|
||||
|
||||
Proper metadata should have been recorded
|
||||
$ querysqlindex "SELECT * FROM nodestobundle;"
|
||||
node bundle reponame
|
||||
6fdf683f5af9a2be091b81ef475f335e2624fb0d f47f4ea5c9dade34f2a38376fe371dc6e4c49c1d repo123
|
||||
8e0c8ddac9fb06e5cb0b3ca65a51632a7814f576 f47f4ea5c9dade34f2a38376fe371dc6e4c49c1d repo123
|
||||
feccf85eaa94ff5ec0f80b8fd871d0fa3125a09b f47f4ea5c9dade34f2a38376fe371dc6e4c49c1d repo123
|
||||
$ querysqlindex "SELECT id, reponame, synced, bookmark, node, bookmark_hash FROM replaybookmarksqueue;"
|
||||
id reponame synced bookmark node bookmark_hash
|
||||
1 repo123 0 scratch/123 6fdf683f5af9a2be091b81ef475f335e2624fb0d 68e2c1170bb6960df6ab9e2c7da427b5d3eca47e
|
||||
2 repo123 0 scratch/123 8e0c8ddac9fb06e5cb0b3ca65a51632a7814f576 68e2c1170bb6960df6ab9e2c7da427b5d3eca47e
|
||||
3 repo123 0 scratch/123 feccf85eaa94ff5ec0f80b8fd871d0fa3125a09b 68e2c1170bb6960df6ab9e2c7da427b5d3eca47e
|
||||
#endif
|
@ -1,57 +0,0 @@
|
||||
#chg-compatible
|
||||
|
||||
#if no-windows no-osx
|
||||
$ disable treemanifest
|
||||
$ mkcommit() {
|
||||
> echo "$1" > "$1"
|
||||
> hg add "$1"
|
||||
> hg ci -d "0 0" -m "$1"
|
||||
> }
|
||||
$ . "$TESTDIR/infinitepush/library.sh"
|
||||
$ setupcommon
|
||||
|
||||
Configure the server
|
||||
$ hg init server
|
||||
$ cd server
|
||||
$ setupsqlserverhgrc repo123
|
||||
$ setupdb
|
||||
$ cd ..
|
||||
|
||||
Without replaybookmarks, it should not insert into the queue
|
||||
$ hg clone -q ssh://user@dummy/server client1
|
||||
$ cd client1
|
||||
$ setupsqlclienthgrc
|
||||
$ mkcommit commit1
|
||||
$ hg push -r . --to scratch/book --create
|
||||
pushing to ssh://user@dummy/server
|
||||
searching for changes
|
||||
remote: pushing 1 commit:
|
||||
remote: cb9a30b04b9d commit1
|
||||
$ cd ..
|
||||
|
||||
Enable replaybookmarks on the server
|
||||
$ cd server
|
||||
$ enablereplaybookmarks
|
||||
$ cd ..
|
||||
|
||||
With replaybookmarks, it should insert into the queue
|
||||
$ hg clone -q ssh://user@dummy/server client2
|
||||
$ cd client2
|
||||
$ setupsqlclienthgrc
|
||||
$ mkcommit commit2
|
||||
$ hg push -r . --to scratch/book2 --create
|
||||
pushing to ssh://user@dummy/server
|
||||
searching for changes
|
||||
remote: pushing 1 commit:
|
||||
remote: 6fdf683f5af9 commit2
|
||||
$ cd ..
|
||||
|
||||
Proper metadata should have been recorded
|
||||
$ querysqlindex "SELECT * FROM nodestobundle;"
|
||||
node bundle reponame
|
||||
6fdf683f5af9a2be091b81ef475f335e2624fb0d 8347a06785e3bdd572ebeb7df3aac1356acb4ce5 repo123
|
||||
cb9a30b04b9df854f40d21fdac525408f3bd6c78 944fe1c133f63c7711aa15db2dd9216084dacc36 repo123
|
||||
$ querysqlindex "SELECT id, reponame, synced, bookmark, node, bookmark_hash FROM replaybookmarksqueue;"
|
||||
id reponame synced bookmark node bookmark_hash
|
||||
1 repo123 0 scratch/book2 6fdf683f5af9a2be091b81ef475f335e2624fb0d bd2df38131efcfd3f7bd81b4307f9e84d8984729
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user