tests/test-static-http.t
changeset 12491 f0c5c334ded1
parent 12156 4c94b6d0fb1c
child 12643 d08bb64888bc
equal deleted inserted replaced
12490:8ae02203065e 12491:f0c5c334ded1
       
     1 
       
     2   $ cp "$TESTDIR"/printenv.py .
       
     3   $ hg clone http://localhost:$HGPORT/ copy
       
     4   abort: error: Connection refused
       
     5   [255]
       
     6   $ test -d copy
       
     7   [1]
       
     8 
       
     9 This server doesn't do range requests so it's basically only good for
       
    10 one pull
       
    11 
       
    12   $ cat > dumb.py <<EOF
       
    13   > import BaseHTTPServer, SimpleHTTPServer, os, signal
       
    14   > 
       
    15   > def run(server_class=BaseHTTPServer.HTTPServer,
       
    16   >         handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
       
    17   >     server_address = ('localhost', int(os.environ['HGPORT']))
       
    18   >     httpd = server_class(server_address, handler_class)
       
    19   >     httpd.serve_forever()
       
    20   > 
       
    21   > signal.signal(signal.SIGTERM, lambda x: sys.exit(0))
       
    22   > run()
       
    23   > EOF
       
    24   $ python dumb.py 2>/dev/null &
       
    25   $ echo $! >> $DAEMON_PIDS
       
    26   $ mkdir remote
       
    27   $ cd remote
       
    28   $ hg init
       
    29   $ echo foo > bar
       
    30   $ hg add bar
       
    31   $ hg commit -m"test"
       
    32   $ hg tip
       
    33   changeset:   0:61c9426e69fe
       
    34   tag:         tip
       
    35   user:        test
       
    36   date:        Thu Jan 01 00:00:00 1970 +0000
       
    37   summary:     test
       
    38   
       
    39   $ cd ..
       
    40   $ hg clone static-http://localhost:$HGPORT/remote local
       
    41   requesting all changes
       
    42   adding changesets
       
    43   adding manifests
       
    44   adding file changes
       
    45   added 1 changesets with 1 changes to 1 files
       
    46   updating to branch default
       
    47   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    48   $ cd local
       
    49   $ hg verify
       
    50   checking changesets
       
    51   checking manifests
       
    52   crosschecking files in changesets and manifests
       
    53   checking files
       
    54   1 files, 1 changesets, 1 total revisions
       
    55   $ cat bar
       
    56   foo
       
    57   $ cd ../remote
       
    58   $ echo baz > quux
       
    59   $ hg commit -A -mtest2
       
    60   adding quux
       
    61 
       
    62 check for HTTP opener failures when cachefile does not exist
       
    63 
       
    64   $ rm .hg/*.cache
       
    65   $ cd ../local
       
    66   $ echo '[hooks]' >> .hg/hgrc
       
    67   $ echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
       
    68   $ hg pull
       
    69   changegroup hook: HG_NODE=822d6e31f08b9d6e3b898ce5e52efc0a4bf4905a HG_SOURCE=pull HG_URL=http://localhost:*/remote  (glob)
       
    70   pulling from static-http://localhost:*/remote (glob)
       
    71   searching for changes
       
    72   adding changesets
       
    73   adding manifests
       
    74   adding file changes
       
    75   added 1 changesets with 1 changes to 1 files
       
    76   (run 'hg update' to get a working copy)
       
    77 
       
    78 trying to push
       
    79 
       
    80   $ hg update
       
    81   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    82   $ echo more foo >> bar
       
    83   $ hg commit -m"test"
       
    84   $ hg push
       
    85   pushing to static-http://localhost:*/remote (glob)
       
    86   abort: cannot lock static-http repository
       
    87   [255]
       
    88 
       
    89 trying clone -r
       
    90 
       
    91   $ cd ..
       
    92   $ hg clone -r donotexist static-http://localhost:$HGPORT/remote local0
       
    93   abort: unknown revision 'donotexist'!
       
    94   [255]
       
    95   $ hg clone -r 0 static-http://localhost:$HGPORT/remote local0
       
    96   requesting all changes
       
    97   adding changesets
       
    98   adding manifests
       
    99   adding file changes
       
   100   added 1 changesets with 1 changes to 1 files
       
   101   updating to branch default
       
   102   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   103 
       
   104 test with "/" URI (issue 747)
       
   105 
       
   106   $ hg init
       
   107   $ echo a > a
       
   108   $ hg add a
       
   109   $ hg ci -ma
       
   110   $ hg clone static-http://localhost:$HGPORT/ local2
       
   111   requesting all changes
       
   112   adding changesets
       
   113   adding manifests
       
   114   adding file changes
       
   115   added 1 changesets with 1 changes to 1 files
       
   116   updating to branch default
       
   117   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   118   $ cd local2
       
   119   $ hg verify
       
   120   checking changesets
       
   121   checking manifests
       
   122   crosschecking files in changesets and manifests
       
   123   checking files
       
   124   1 files, 1 changesets, 1 total revisions
       
   125   $ cat a
       
   126   a
       
   127   $ hg paths
       
   128   default = static-http://localhost:*/ (glob)
       
   129 
       
   130 test with empty repo (issue965)
       
   131 
       
   132   $ cd ..
       
   133   $ hg init remotempty
       
   134   $ hg clone static-http://localhost:$HGPORT/remotempty local3
       
   135   no changes found
       
   136   updating to branch default
       
   137   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   138   $ cd local3
       
   139   $ hg verify
       
   140   checking changesets
       
   141   checking manifests
       
   142   crosschecking files in changesets and manifests
       
   143   checking files
       
   144   0 files, 0 changesets, 0 total revisions
       
   145   $ hg paths
       
   146   default = static-http://localhost:*/remotempty (glob)
       
   147 
       
   148 test with non-repo
       
   149 
       
   150   $ cd ..
       
   151   $ mkdir notarepo
       
   152   $ hg clone static-http://localhost:$HGPORT/notarepo local3
       
   153   abort: 'http://localhost:*/notarepo' does not appear to be an hg repository! (glob)
       
   154   [255]
       
   155   $ kill $!