fixes recording of: 1. correct repo_id. 2. full ontorev

Summary:
This change fixes two problems in pushrebase recording, that will be used to test mononoke pushrebase:
- record correct `repo_id`, it used to be always 0
- `ontorev` truncation, as we store rev as hex string we need 40 bytes instead of 20

Reviewed By: ikostia

Differential Revision: D9398009

fbshipit-source-id: 91add2d75fbb9acf32b99dc952c467d44c2ccbc9
This commit is contained in:
Pavel Aslanov 2018-08-20 06:12:28 -07:00 committed by Facebook Github Bot
parent 57eaddb3b9
commit 8ed850dc2b
3 changed files with 6 additions and 5 deletions

View File

@ -98,6 +98,7 @@ def _recordpushrebaserecordtodb(ui, params):
return
repoid = ui.configint("pushrebase", "recordingrepoid")
params["repo_id"] = repoid
errmsg = "pushrebase was not recorded"
if repoid is None:
ui.warn(_("%s: %s") % (errmsg, "recordingrepoid was not set"))

View File

@ -1,7 +1,7 @@
CREATE TABLE `pushrebaserecording` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`repo_id` int(10) unsigned NOT NULL,
`ontorev` binary(20) NOT NULL,
`ontorev` binary(40) NOT NULL,
`onto` varchar(512) NOT NULL,
`conflicts` LONGTEXT DEFAULT NULL,
`pushrebase_errmsg` varchar(1024) DEFAULT NULL,

View File

@ -71,7 +71,7 @@ Non-conflicting commit should be accepted
> bundlepartuploadbinary=$TESTTMP/uploader.sh {filename}
> enablerecording=True
> recordingsqlargs=$DBHOST:$DBPORT:$DBNAME:$DBUSER:$DBPASS
> recordingrepoid=0
> recordingrepoid=42
> EOF
$ log
@ -92,7 +92,7 @@ Non-conflicting commit should be accepted
Check that new entry was added to the db
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT -e 'select repo_id, ontorev, onto, bundlehandle, conflicts, pushrebase_errmsg from pushrebaserecording'
repo_id ontorev onto bundlehandle conflicts pushrebase_errmsg
0 add0c792bfce89610d27 default handle NULL NULL
42 add0c792bfce89610d277fd5b1e32f5287994d1d default handle NULL NULL
Check that bundle was created, then try to send it from client2 to server2 using
unbundle method to make sure that bundle is valid
@ -149,8 +149,8 @@ Push conflicting changes
[255]
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT -e 'select repo_id, ontorev, onto, bundlehandle, conflicts, pushrebase_errmsg from pushrebaserecording'
repo_id ontorev onto bundlehandle conflicts pushrebase_errmsg
0 add0c792bfce89610d27 default handle NULL NULL
0 6a6d9484552c82e5f21b default handle a\nb NULL
42 add0c792bfce89610d277fd5b1e32f5287994d1d default handle NULL NULL
42 6a6d9484552c82e5f21b4ed4fce375930812f88c default handle a\nb NULL
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER $DBPASSOPT -e 'select timestamps from pushrebaserecording'
timestamps
{"46a2df24e27273bb06dbf28b085fcc2e911bf986": [0.0, 0]}