view tests/test-getbundle.t @ 13970:d13913355390

move opener from util to scmutil
author Adrian Buehlmann <adrian@cadifra.com>
date Wed, 20 Apr 2011 19:54:57 +0200
parents b51bf961b3cb
children ce99d887585f
line wrap: on
line source


= Test the getbundle() protocol function =

Enable graphlog extension:

  $ echo "[extensions]" >> $HGRCPATH
  $ echo "graphlog=" >> $HGRCPATH

Create a test repository:

  $ hg init repo
  $ cd repo
  $ hg debugbuilddag -n -m '+2 :fork +5 :p1 *fork +6 :p2 /p1 :m1 +3' > /dev/null
  $ hg glog --template '{node}\n'
  @  2bba2f40f321484159b395a43f20101d4bb7ead0
  |
  o  d9e5488323c782fe684573f3043369d199038b6f
  |
  o  6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
  |
  o    733bf0910832b26b768a09172f325f995b5476e1
  |\
  | o  b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
  | |
  | o  6b57ee934bb2996050540f84cdfc8dcad1e7267d
  | |
  | o  2c0ec49482e8abe888b7bd090b5827acfc22b3d7
  | |
  | o  c1818a9f5977dd4139a48f93f5425c67d44a9368
  | |
  | o  6c725a58ad10aea441540bfd06c507f63e8b9cdd
  | |
  | o  18063366a155bd56b5618229ae2ac3e91849aa5e
  | |
  | o  a21d913c992197a2eb60b298521ec0f045a04799
  | |
  o |  b6b2b682253df2ffedc10e9415e4114202b303c5
  | |
  o |  2114148793524fd045998f71a45b0aaf139f752b
  | |
  o |  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
  | |
  o |  ea919464b16e003894c48b6cb68df3cd9411b544
  | |
  o |  0f82d97ec2778746743fbc996740d409558fda22
  |/
  o  6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
  |
  o  10e64d654571f11577745b4d8372e859d9e4df63
  
  $ cd ..


= Test locally =

Get everything:

  $ hg debuggetbundle repo bundle
  $ hg debugbundle bundle
  10e64d654571f11577745b4d8372e859d9e4df63
  6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
  0f82d97ec2778746743fbc996740d409558fda22
  ea919464b16e003894c48b6cb68df3cd9411b544
  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
  2114148793524fd045998f71a45b0aaf139f752b
  b6b2b682253df2ffedc10e9415e4114202b303c5
  a21d913c992197a2eb60b298521ec0f045a04799
  18063366a155bd56b5618229ae2ac3e91849aa5e
  6c725a58ad10aea441540bfd06c507f63e8b9cdd
  c1818a9f5977dd4139a48f93f5425c67d44a9368
  2c0ec49482e8abe888b7bd090b5827acfc22b3d7
  6b57ee934bb2996050540f84cdfc8dcad1e7267d
  b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
  733bf0910832b26b768a09172f325f995b5476e1
  6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
  d9e5488323c782fe684573f3043369d199038b6f
  2bba2f40f321484159b395a43f20101d4bb7ead0

Get part of linear run:

  $ hg debuggetbundle repo bundle -H d9e5488323c782fe684573f3043369d199038b6f -C 733bf0910832b26b768a09172f325f995b5476e1
  $ hg debugbundle bundle
  6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
  d9e5488323c782fe684573f3043369d199038b6f

Get missing branch and merge:

  $ hg debuggetbundle repo bundle -H d9e5488323c782fe684573f3043369d199038b6f -C 6b57ee934bb2996050540f84cdfc8dcad1e7267d
  $ hg debugbundle bundle
  0f82d97ec2778746743fbc996740d409558fda22
  ea919464b16e003894c48b6cb68df3cd9411b544
  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
  2114148793524fd045998f71a45b0aaf139f752b
  b6b2b682253df2ffedc10e9415e4114202b303c5
  b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
  733bf0910832b26b768a09172f325f995b5476e1
  6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
  d9e5488323c782fe684573f3043369d199038b6f

Get from only one head:

  $ hg debuggetbundle repo bundle -H 6c725a58ad10aea441540bfd06c507f63e8b9cdd -C 6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
  $ hg debugbundle bundle
  a21d913c992197a2eb60b298521ec0f045a04799
  18063366a155bd56b5618229ae2ac3e91849aa5e
  6c725a58ad10aea441540bfd06c507f63e8b9cdd

Get parts of two branches:

  $ hg debuggetbundle repo bundle -H 6b57ee934bb2996050540f84cdfc8dcad1e7267d -C c1818a9f5977dd4139a48f93f5425c67d44a9368 -H 2114148793524fd045998f71a45b0aaf139f752b -C ea919464b16e003894c48b6cb68df3cd9411b544
  $ hg debugbundle bundle
  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
  2114148793524fd045998f71a45b0aaf139f752b
  2c0ec49482e8abe888b7bd090b5827acfc22b3d7
  6b57ee934bb2996050540f84cdfc8dcad1e7267d

Check that we get all needed file changes:

  $ hg debugbundle bundle --all
  format: id, p1, p2, cset, len(delta)
  
  changelog
  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 99
  2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 99
  2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c1818a9f5977dd4139a48f93f5425c67d44a9368 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 102
  6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 102
  
  manifest
  dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 113
  0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 113
  eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 295
  b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 114
  
  mf
  4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 17
  c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 18
  266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 149
  698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 19
  
  nf11
  33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 16
  
  nf12
  ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 16
  
  nf4
  3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 15
  
  nf5
  0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 15

Get branch and merge:

  $ hg debuggetbundle repo bundle -C 10e64d654571f11577745b4d8372e859d9e4df63 -H 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
  $ hg debugbundle bundle
  6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
  0f82d97ec2778746743fbc996740d409558fda22
  ea919464b16e003894c48b6cb68df3cd9411b544
  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
  2114148793524fd045998f71a45b0aaf139f752b
  b6b2b682253df2ffedc10e9415e4114202b303c5
  a21d913c992197a2eb60b298521ec0f045a04799
  18063366a155bd56b5618229ae2ac3e91849aa5e
  6c725a58ad10aea441540bfd06c507f63e8b9cdd
  c1818a9f5977dd4139a48f93f5425c67d44a9368
  2c0ec49482e8abe888b7bd090b5827acfc22b3d7
  6b57ee934bb2996050540f84cdfc8dcad1e7267d
  b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
  733bf0910832b26b768a09172f325f995b5476e1
  6e9a5adf5437e49c746288cf95c5ac34fa8f2f72


= Test via HTTP =

Get everything:

  $ hg serve -R repo -p $HGPORT -d --pid-file=hg.pid -E error.log -A access.log
  $ cat hg.pid >> $DAEMON_PIDS
  $ hg debuggetbundle http://localhost:$HGPORT/ bundle
  $ hg debugbundle bundle
  10e64d654571f11577745b4d8372e859d9e4df63
  6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
  0f82d97ec2778746743fbc996740d409558fda22
  ea919464b16e003894c48b6cb68df3cd9411b544
  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
  2114148793524fd045998f71a45b0aaf139f752b
  b6b2b682253df2ffedc10e9415e4114202b303c5
  a21d913c992197a2eb60b298521ec0f045a04799
  18063366a155bd56b5618229ae2ac3e91849aa5e
  6c725a58ad10aea441540bfd06c507f63e8b9cdd
  c1818a9f5977dd4139a48f93f5425c67d44a9368
  2c0ec49482e8abe888b7bd090b5827acfc22b3d7
  6b57ee934bb2996050540f84cdfc8dcad1e7267d
  b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
  733bf0910832b26b768a09172f325f995b5476e1
  6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
  d9e5488323c782fe684573f3043369d199038b6f
  2bba2f40f321484159b395a43f20101d4bb7ead0

Get parts of two branches:

  $ hg debuggetbundle http://localhost:$HGPORT/ bundle -H 6b57ee934bb2996050540f84cdfc8dcad1e7267d -C c1818a9f5977dd4139a48f93f5425c67d44a9368 -H 2114148793524fd045998f71a45b0aaf139f752b -C ea919464b16e003894c48b6cb68df3cd9411b544
  $ hg debugbundle bundle
  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
  2114148793524fd045998f71a45b0aaf139f752b
  2c0ec49482e8abe888b7bd090b5827acfc22b3d7
  6b57ee934bb2996050540f84cdfc8dcad1e7267d

Check that we get all needed file changes:

  $ hg debugbundle bundle --all
  format: id, p1, p2, cset, len(delta)
  
  changelog
  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 99
  2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 99
  2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c1818a9f5977dd4139a48f93f5425c67d44a9368 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 102
  6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 102
  
  manifest
  dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 113
  0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 113
  eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 295
  b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 114
  
  mf
  4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 17
  c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 18
  266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 149
  698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 19
  
  nf11
  33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 16
  
  nf12
  ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 16
  
  nf4
  3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 15
  
  nf5
  0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 15

Verify we hit the HTTP server:

  $ cat access.log
  * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
  * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - (glob)
  * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
  * - - [*] "GET /?cmd=getbundle&common=c1818a9f5977dd4139a48f93f5425c67d44a9368+ea919464b16e003894c48b6cb68df3cd9411b544&heads=6b57ee934bb2996050540f84cdfc8dcad1e7267d+2114148793524fd045998f71a45b0aaf139f752b HTTP/1.1" 200 - (glob)

  $ cat error.log