2019-03-18 19:38:31 +03:00
|
|
|
$ . "$TESTDIR/hgsql/library.sh"
|
|
|
|
$ initserver master masterrepo
|
|
|
|
$ cd master
|
|
|
|
|
|
|
|
Check that a repo without an entry is treated as RW
|
2019-05-02 19:03:40 +03:00
|
|
|
$ hg debugshell -c "print(repo.sqlreporeadonlystate())"
|
|
|
|
(False, 'no reason was provided')
|
2019-04-02 03:58:01 +03:00
|
|
|
$ hg debugshell -c "print(repo.sqlisreporeadonly())"
|
2019-03-18 19:38:31 +03:00
|
|
|
False
|
|
|
|
|
|
|
|
Set the repo to RO for hg and mononoke
|
|
|
|
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT -e 'REPLACE INTO repo_lock(repo, state) VALUES ("masterrepo", 0)'
|
2019-05-02 19:03:40 +03:00
|
|
|
$ hg debugshell -c "print(repo.sqlreporeadonlystate())"
|
|
|
|
(True, 'no reason was provided')
|
2019-04-02 03:58:01 +03:00
|
|
|
$ hg debugshell -c "print(repo.sqlisreporeadonly())"
|
2019-03-18 19:38:31 +03:00
|
|
|
True
|
|
|
|
|
|
|
|
Set another repo to RW for hg and check that masterrepo is still RO
|
|
|
|
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT -e 'REPLACE INTO repo_lock(repo, state) VALUES ("masterrepo2", 1)'
|
2019-05-02 19:03:40 +03:00
|
|
|
$ hg debugshell -c "print(repo.sqlreporeadonlystate())"
|
|
|
|
(True, 'no reason was provided')
|
2019-04-02 03:58:01 +03:00
|
|
|
$ hg debugshell -c "print(repo.sqlisreporeadonly())"
|
2019-03-18 19:38:31 +03:00
|
|
|
True
|
|
|
|
|
|
|
|
Set the repo to RW for Mononoke only
|
|
|
|
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT -e 'REPLACE INTO repo_lock(repo, state) VALUES ("masterrepo", 2)'
|
2019-05-02 19:03:40 +03:00
|
|
|
$ hg debugshell -c "print(repo.sqlreporeadonlystate())"
|
|
|
|
(True, 'writes are being served by Mononoke (fburl.com/mononoke)')
|
2019-04-02 03:58:01 +03:00
|
|
|
$ hg debugshell -c "print(repo.sqlisreporeadonly())"
|
2019-03-18 19:38:31 +03:00
|
|
|
True
|
|
|
|
|
|
|
|
Set the repo to RW for hg only
|
|
|
|
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT -e 'REPLACE INTO repo_lock(repo, state) VALUES ("masterrepo", 1)'
|
2019-05-02 19:03:40 +03:00
|
|
|
$ hg debugshell -c "print(repo.sqlreporeadonlystate())"
|
|
|
|
(False, 'no reason was provided')
|
2019-04-02 03:58:01 +03:00
|
|
|
$ hg debugshell -c "print(repo.sqlisreporeadonly())"
|
2019-03-18 19:38:31 +03:00
|
|
|
False
|
|
|
|
|
|
|
|
Set the repo to RO again
|
|
|
|
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT -e 'REPLACE INTO repo_lock(repo, state) VALUES ("masterrepo", 0)'
|
2019-05-02 19:03:40 +03:00
|
|
|
$ hg debugshell -c "print(repo.sqlreporeadonlystate())"
|
|
|
|
(True, 'no reason was provided')
|
|
|
|
$ hg debugshell -c "print(repo.sqlisreporeadonly())"
|
|
|
|
True
|
|
|
|
Set the repo to RO for hg and mononoke (with reason)
|
|
|
|
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT -e 'REPLACE INTO repo_lock(repo, state, reason) VALUES ("masterrepo", 0, "reason123")'
|
|
|
|
$ hg debugshell -c "print(repo.sqlreporeadonlystate())"
|
|
|
|
(True, 'reason123')
|
|
|
|
$ hg debugshell -c "print(repo.sqlisreporeadonly())"
|
|
|
|
True
|
|
|
|
|
|
|
|
Set another repo to RW (with reason) for hg and check that masterrepo is still RO
|
|
|
|
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT -e 'REPLACE INTO repo_lock(repo, state, reason) VALUES ("masterrepo2", 1, "reason456")'
|
|
|
|
$ hg debugshell -c "print(repo.sqlreporeadonlystate())"
|
|
|
|
(True, 'reason123')
|
|
|
|
$ hg debugshell -c "print(repo.sqlisreporeadonly())"
|
|
|
|
True
|
|
|
|
|
|
|
|
Set the repo to RW for Mononoke only (with reason)
|
|
|
|
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT -e 'REPLACE INTO repo_lock(repo, state, reason) VALUES ("masterrepo", 2, "reason123")'
|
|
|
|
$ hg debugshell -c "print(repo.sqlreporeadonlystate())"
|
|
|
|
(True, 'reason123')
|
|
|
|
$ hg debugshell -c "print(repo.sqlisreporeadonly())"
|
|
|
|
True
|
|
|
|
|
|
|
|
Set the repo to RW for hg only (with reason)
|
|
|
|
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT -e 'REPLACE INTO repo_lock(repo, state, reason) VALUES ("masterrepo", 1, "reason123")'
|
|
|
|
$ hg debugshell -c "print(repo.sqlreporeadonlystate())"
|
|
|
|
(False, 'reason123')
|
|
|
|
$ hg debugshell -c "print(repo.sqlisreporeadonly())"
|
|
|
|
False
|
|
|
|
|
|
|
|
Set the repo to RO again (with reason)
|
|
|
|
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT -e 'REPLACE INTO repo_lock(repo, state, reason) VALUES ("masterrepo", 0, "reason123")'
|
|
|
|
$ hg debugshell -c "print(repo.sqlreporeadonlystate())"
|
|
|
|
(True, 'reason123')
|
2019-04-02 03:58:01 +03:00
|
|
|
$ hg debugshell -c "print(repo.sqlisreporeadonly())"
|
2019-03-18 19:38:31 +03:00
|
|
|
True
|