tests/test-archive.t
changeset 39707 5abc47d4ca6b
parent 38215 f715faeaceee
child 40249 c9e8c93e241c
equal deleted inserted replaced
39706:030d558c6456 39707:5abc47d4ca6b
   339   >                     % (os.environ['HGPORT'], requeststr))
   339   >                     % (os.environ['HGPORT'], requeststr))
   340   >     stdout.write(f.read())
   340   >     stdout.write(f.read())
   341   > except util.urlerr.httperror as e:
   341   > except util.urlerr.httperror as e:
   342   >     sys.stderr.write(str(e) + '\n')
   342   >     sys.stderr.write(str(e) + '\n')
   343   > EOF
   343   > EOF
   344   $ $PYTHON getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
   344   $ "$PYTHON" getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
   345   test-archive-1701ef1f1510/.hg_archival.txt
   345   test-archive-1701ef1f1510/.hg_archival.txt
   346   test-archive-1701ef1f1510/.hgsub
   346   test-archive-1701ef1f1510/.hgsub
   347   test-archive-1701ef1f1510/.hgsubstate
   347   test-archive-1701ef1f1510/.hgsubstate
   348   test-archive-1701ef1f1510/bar
   348   test-archive-1701ef1f1510/bar
   349   test-archive-1701ef1f1510/baz/bletch
   349   test-archive-1701ef1f1510/baz/bletch
   350   test-archive-1701ef1f1510/foo
   350   test-archive-1701ef1f1510/foo
   351   test-archive-1701ef1f1510/subrepo/sub
   351   test-archive-1701ef1f1510/subrepo/sub
   352   $ $PYTHON getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
   352   $ "$PYTHON" getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
   353   test-archive-1701ef1f1510/.hg_archival.txt
   353   test-archive-1701ef1f1510/.hg_archival.txt
   354   test-archive-1701ef1f1510/.hgsub
   354   test-archive-1701ef1f1510/.hgsub
   355   test-archive-1701ef1f1510/.hgsubstate
   355   test-archive-1701ef1f1510/.hgsubstate
   356   test-archive-1701ef1f1510/bar
   356   test-archive-1701ef1f1510/bar
   357   test-archive-1701ef1f1510/baz/bletch
   357   test-archive-1701ef1f1510/baz/bletch
   358   test-archive-1701ef1f1510/foo
   358   test-archive-1701ef1f1510/foo
   359   test-archive-1701ef1f1510/subrepo/sub
   359   test-archive-1701ef1f1510/subrepo/sub
   360   $ $PYTHON getarchive.py "$TIP" zip > archive.zip
   360   $ "$PYTHON" getarchive.py "$TIP" zip > archive.zip
   361   $ unzip -t archive.zip
   361   $ unzip -t archive.zip
   362   Archive:  archive.zip
   362   Archive:  archive.zip
   363       testing: test-archive-1701ef1f1510/.hg_archival.txt*OK (glob)
   363       testing: test-archive-1701ef1f1510/.hg_archival.txt*OK (glob)
   364       testing: test-archive-1701ef1f1510/.hgsub*OK (glob)
   364       testing: test-archive-1701ef1f1510/.hgsub*OK (glob)
   365       testing: test-archive-1701ef1f1510/.hgsubstate*OK (glob)
   365       testing: test-archive-1701ef1f1510/.hgsubstate*OK (glob)
   369       testing: test-archive-1701ef1f1510/subrepo/sub*OK (glob)
   369       testing: test-archive-1701ef1f1510/subrepo/sub*OK (glob)
   370   No errors detected in compressed data of archive.zip.
   370   No errors detected in compressed data of archive.zip.
   371 
   371 
   372 test that we can download single directories and files
   372 test that we can download single directories and files
   373 
   373 
   374   $ $PYTHON getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null
   374   $ "$PYTHON" getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null
   375   test-archive-1701ef1f1510/baz/bletch
   375   test-archive-1701ef1f1510/baz/bletch
   376   $ $PYTHON getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null
   376   $ "$PYTHON" getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null
   377   test-archive-1701ef1f1510/foo
   377   test-archive-1701ef1f1510/foo
   378 
   378 
   379 test that we detect file patterns that match no files
   379 test that we detect file patterns that match no files
   380 
   380 
   381   $ $PYTHON getarchive.py "$TIP" gz foobar
   381   $ "$PYTHON" getarchive.py "$TIP" gz foobar
   382   HTTP Error 404: file(s) not found: foobar
   382   HTTP Error 404: file(s) not found: foobar
   383 
   383 
   384 test that we reject unsafe patterns
   384 test that we reject unsafe patterns
   385 
   385 
   386   $ $PYTHON getarchive.py "$TIP" gz relre:baz
   386   $ "$PYTHON" getarchive.py "$TIP" gz relre:baz
   387   HTTP Error 404: file(s) not found: relre:baz
   387   HTTP Error 404: file(s) not found: relre:baz
   388 
   388 
   389   $ killdaemons.py
   389   $ killdaemons.py
   390 
   390 
   391   $ hg archive -t tar test.tar
   391   $ hg archive -t tar test.tar
   462   $ hg archive -t tgz tip.tar.gz
   462   $ hg archive -t tgz tip.tar.gz
   463   $ mv tip.tar.gz tip1.tar.gz
   463   $ mv tip.tar.gz tip1.tar.gz
   464   $ sleep 1
   464   $ sleep 1
   465   $ hg archive -t tgz tip.tar.gz
   465   $ hg archive -t tgz tip.tar.gz
   466   $ mv tip.tar.gz tip2.tar.gz
   466   $ mv tip.tar.gz tip2.tar.gz
   467   $ $PYTHON md5comp.py tip1.tar.gz tip2.tar.gz
   467   $ "$PYTHON" md5comp.py tip1.tar.gz tip2.tar.gz
   468   True
   468   True
   469 
   469 
   470   $ hg archive -t zip -p /illegal test.zip
   470   $ hg archive -t zip -p /illegal test.zip
   471   abort: archive prefix contains illegal components
   471   abort: archive prefix contains illegal components
   472   [255]
   472   [255]
   596   > print(int(os.stat(sys.argv[1]).st_mtime))
   596   > print(int(os.stat(sys.argv[1]).st_mtime))
   597   > EOF
   597   > EOF
   598 
   598 
   599   $ hg -R repo archive --prefix tar-extracted archive.tar
   599   $ hg -R repo archive --prefix tar-extracted archive.tar
   600   $ (TZ=UTC-3; export TZ; tar xf archive.tar)
   600   $ (TZ=UTC-3; export TZ; tar xf archive.tar)
   601   $ $PYTHON show_mtime.py tar-extracted/a
   601   $ "$PYTHON" show_mtime.py tar-extracted/a
   602   456789012
   602   456789012
   603 
   603 
   604   $ hg -R repo archive --prefix zip-extracted archive.zip
   604   $ hg -R repo archive --prefix zip-extracted archive.zip
   605   $ (TZ=UTC-3; export TZ; unzip -q archive.zip)
   605   $ (TZ=UTC-3; export TZ; unzip -q archive.zip)
   606   $ $PYTHON show_mtime.py zip-extracted/a
   606   $ "$PYTHON" show_mtime.py zip-extracted/a
   607   456789012
   607   456789012
   608 
   608 
   609   $ cd ..
   609   $ cd ..